brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 8f31a96 Raw
46 lines · c
1#ifndef COMPILERRT_DD_HEADER2#define COMPILERRT_DD_HEADER3 4#include "../int_lib.h"5 6typedef union {7  long double ld;8  struct {9    double hi;10    double lo;11  } s;12} DD;13 14typedef 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 22static __inline ALWAYS_INLINE double local_fabs(double x) {23  doublebits result = {.d = x};24  result.x &= UINT64_C(0x7fffffffffffffff);25  return result.d;26}27 28static __inline ALWAYS_INLINE double high26bits(double x) {29  doublebits result = {.d = x};30  result.x &= UINT64_C(0xfffffffff8000000);31  return result.d;32}33 34static __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;38}39 40long double __gcc_qadd(long double, long double);41long double __gcc_qsub(long double, long double);42long double __gcc_qmul(long double, long double);43long double __gcc_qdiv(long double, long double);44 45#endif // COMPILERRT_DD_HEADER46