2.9
[glibc/nacl-glibc.git] / sysdeps / alpha / soft-fp / local-soft-fp.h
blobe93a2ad06493089ba4856d46671400b554d7c58a
1 #include <stdlib.h>
2 #include <soft-fp.h>
3 #include <quad.h>
5 /* Helpers for the Ots functions which receive long double arguments
6 in two integer registers, and return values in $16+$17. */
8 #undef _FP_UNPACK_RAW_2
9 #define _FP_UNPACK_RAW_2(fs, X, val) \
10 do { \
11 union _FP_UNION_##fs _flo; \
12 _flo.longs.a = val##l; \
13 _flo.longs.b = val##h; \
14 X##_f0 = _flo.bits.frac0; \
15 X##_f1 = _flo.bits.frac1; \
16 X##_e = _flo.bits.exp; \
17 X##_s = _flo.bits.sign; \
18 } while (0)
20 #undef _FP_PACK_RAW_2
21 #define _FP_PACK_RAW_2(fs, val, X) \
22 do { \
23 union _FP_UNION_##fs _flo; \
24 _flo.bits.frac0 = X##_f0; \
25 _flo.bits.frac1 = X##_f1; \
26 _flo.bits.exp = X##_e; \
27 _flo.bits.sign = X##_s; \
28 val##l = _flo.longs.a; \
29 val##h = _flo.longs.b; \
30 } while (0)
32 #define FP_DECL_RETURN(X) \
33 long X##l, X##h
35 /* ??? We don't have a real way to tell the compiler that we're wanting
36 to return values in $16+$17. Instead use a volatile asm to make sure
37 that the values are live, and just hope that nothing kills the values
38 in between here and the end of the function. */
39 #define FP_RETURN(X) \
40 do { \
41 register long r16 __asm__("16") = X##l; \
42 register long r17 __asm__("17") = X##h; \
43 asm volatile ("" : : "r"(r16), "r"(r17)); \
44 } while (0)