diff options
author | ed <ed@FreeBSD.org> | 2010-11-11 15:13:11 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2010-11-11 15:13:11 +0000 |
commit | 870837e3e92f721a44db51308f2b900d928fb04f (patch) | |
tree | 9f851f7f6da4a4d9010d26bf17881d3bc5320f2b /contrib/compiler-rt/lib/ppc/DD.h | |
parent | a1b6fa69a6f674978270e402b8bba6552e152066 (diff) | |
parent | 653bb6745595746d04ad4acacaaab66caaaeb69b (diff) | |
download | FreeBSD-src-870837e3e92f721a44db51308f2b900d928fb04f.zip FreeBSD-src-870837e3e92f721a44db51308f2b900d928fb04f.tar.gz |
Import libcompiler_rt into HEAD and add Makefiles.
Obtained from: user/ed/compiler-rt
Diffstat (limited to 'contrib/compiler-rt/lib/ppc/DD.h')
-rw-r--r-- | contrib/compiler-rt/lib/ppc/DD.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/compiler-rt/lib/ppc/DD.h b/contrib/compiler-rt/lib/ppc/DD.h new file mode 100644 index 0000000..9ecd1f5 --- /dev/null +++ b/contrib/compiler-rt/lib/ppc/DD.h @@ -0,0 +1,46 @@ +#ifndef __DD_HEADER +#define __DD_HEADER + +#include <stdint.h> + +typedef union { + long double ld; + struct { + double hi; + double lo; + }s; +}DD; + +typedef union { + double d; + uint64_t x; +} doublebits; + +#define LOWORDER(xy,xHi,xLo,yHi,yLo) \ + (((((xHi)*(yHi) - (xy)) + (xHi)*(yLo)) + (xLo)*(yHi)) + (xLo)*(yLo)) + +static inline double __attribute__((always_inline)) +fabs(double x) +{ + doublebits result = { .d = x }; + result.x &= UINT64_C(0x7fffffffffffffff); + return result.d; +} + +static inline double __attribute__((always_inline)) +high26bits(double x) +{ + doublebits result = { .d = x }; + result.x &= UINT64_C(0xfffffffff8000000); + return result.d; +} + +static inline int __attribute__((always_inline)) +different_sign(double x, double y) +{ + doublebits xsignbit = { .d = x }, ysignbit = { .d = y }; + int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63); + return result; +} + +#endif /* __DD_HEADER */ |