Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 1 | #ifndef COMPILERRT_DD_HEADER |
| 2 | #define COMPILERRT_DD_HEADER |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 3 | |
| 4 | #include "../int_lib.h" |
| 5 | |
| 6 | typedef union { |
| 7 | long double ld; |
| 8 | struct { |
| 9 | double hi; |
| 10 | double lo; |
| 11 | }s; |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 12 | } DD; |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 13 | |
| 14 | typedef union { |
| 15 | double d; |
| 16 | uint64_t x; |
| 17 | } doublebits; |
| 18 | |
| 19 | #define LOWORDER(xy,xHi,xLo,yHi,yLo) \ |
| 20 | (((((xHi)*(yHi) - (xy)) + (xHi)*(yLo)) + (xLo)*(yHi)) + (xLo)*(yLo)) |
| 21 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 22 | static __inline ALWAYS_INLINE double local_fabs(double x) { |
| 23 | doublebits result = {.d = x}; |
| 24 | result.x &= UINT64_C(0x7fffffffffffffff); |
| 25 | return result.d; |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 26 | } |
| 27 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 28 | static __inline ALWAYS_INLINE double high26bits(double x) { |
| 29 | doublebits result = {.d = x}; |
| 30 | result.x &= UINT64_C(0xfffffffff8000000); |
| 31 | return result.d; |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 32 | } |
| 33 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 34 | static __inline ALWAYS_INLINE int different_sign(double x, double y) { |
| 35 | doublebits xsignbit = {.d = x}, ysignbit = {.d = y}; |
| 36 | int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63); |
| 37 | return result; |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 38 | } |
| 39 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 40 | long double __gcc_qadd(long double, long double); |
| 41 | long double __gcc_qsub(long double, long double); |
| 42 | long double __gcc_qmul(long double, long double); |
| 43 | long double __gcc_qdiv(long double, long double); |
| 44 | |
| 45 | #endif /* COMPILERRT_DD_HEADER */ |