Back to index

glibc  2.9
local-soft-fp.h
Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include <soft-fp.h>
00003 #include <quad.h>
00004 
00005 /* Helpers for the Ots functions which receive long double arguments
00006    in two integer registers, and return values in $16+$17.  */
00007 
00008 #undef _FP_UNPACK_RAW_2
00009 #define _FP_UNPACK_RAW_2(fs, X, val)                    \
00010   do {                                                  \
00011     union _FP_UNION_##fs _flo;                          \
00012     _flo.longs.a = val##l;                       \
00013     _flo.longs.b = val##h;                       \
00014     X##_f0 = _flo.bits.frac0;                           \
00015     X##_f1 = _flo.bits.frac1;                           \
00016     X##_e  = _flo.bits.exp;                      \
00017     X##_s  = _flo.bits.sign;                            \
00018   } while (0)
00019 
00020 #undef _FP_PACK_RAW_2
00021 #define _FP_PACK_RAW_2(fs, val, X)                      \
00022   do {                                                  \
00023     union _FP_UNION_##fs _flo;                          \
00024     _flo.bits.frac0 = X##_f0;                           \
00025     _flo.bits.frac1 = X##_f1;                           \
00026     _flo.bits.exp   = X##_e;                            \
00027     _flo.bits.sign  = X##_s;                            \
00028     val##l = _flo.longs.a;                       \
00029     val##h = _flo.longs.b;                       \
00030   } while (0)
00031 
00032 #define FP_DECL_RETURN(X) \
00033   long X##l, X##h
00034 
00035 /* ??? We don't have a real way to tell the compiler that we're wanting
00036    to return values in $16+$17.  Instead use a volatile asm to make sure
00037    that the values are live, and just hope that nothing kills the values
00038    in between here and the end of the function.  */
00039 #define FP_RETURN(X)                      \
00040 do {                                      \
00041   register long r16 __asm__("16") = X##l; \
00042   register long r17 __asm__("17") = X##h; \
00043   asm volatile ("" : : "r"(r16), "r"(r17));      \
00044 } while (0)