(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / soft-fp / single.h
blobb571d5058a32e6d375915b2b810a66b9d8b3fb26
1 /* Software floating-point emulation.
2 Definitions for IEEE Single Precision.
3 Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Richard Henderson (rth@cygnus.com),
6 Jakub Jelinek (jj@ultra.linux.cz),
7 David S. Miller (davem@redhat.com) and
8 Peter Maydell (pmaydell@chiark.greenend.org.uk).
10 The GNU C Library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 The GNU C Library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with the GNU C Library; if not, write to the Free
22 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 02111-1307 USA. */
25 #if _FP_W_TYPE_SIZE < 32
26 #error "Here's a nickel kid. Go buy yourself a real computer."
27 #endif
29 #define _FP_FRACBITS_S 24
30 #define _FP_FRACXBITS_S (_FP_W_TYPE_SIZE - _FP_FRACBITS_S)
31 #define _FP_WFRACBITS_S (_FP_WORKBITS + _FP_FRACBITS_S)
32 #define _FP_WFRACXBITS_S (_FP_W_TYPE_SIZE - _FP_WFRACBITS_S)
33 #define _FP_EXPBITS_S 8
34 #define _FP_EXPBIAS_S 127
35 #define _FP_EXPMAX_S 255
36 #define _FP_QNANBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2))
37 #define _FP_IMPLBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1))
38 #define _FP_OVERFLOW_S ((_FP_W_TYPE)1 << (_FP_WFRACBITS_S))
40 /* The implementation of _FP_MUL_MEAT_S and _FP_DIV_MEAT_S should be
41 chosen by the target machine. */
43 union _FP_UNION_S
45 float flt;
46 struct {
47 #if __BYTE_ORDER == __BIG_ENDIAN
48 unsigned sign : 1;
49 unsigned exp : _FP_EXPBITS_S;
50 unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
51 #else
52 unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
53 unsigned exp : _FP_EXPBITS_S;
54 unsigned sign : 1;
55 #endif
56 } bits __attribute__((packed));
59 #define FP_DECL_S(X) _FP_DECL(1,X)
60 #define FP_UNPACK_RAW_S(X,val) _FP_UNPACK_RAW_1(S,X,val)
61 #define FP_UNPACK_RAW_SP(X,val) _FP_UNPACK_RAW_1_P(S,X,val)
62 #define FP_PACK_RAW_S(val,X) _FP_PACK_RAW_1(S,val,X)
63 #define FP_PACK_RAW_SP(val,X) \
64 do { \
65 if (!FP_INHIBIT_RESULTS) \
66 _FP_PACK_RAW_1_P(S,val,X); \
67 } while (0)
69 #define FP_UNPACK_S(X,val) \
70 do { \
71 _FP_UNPACK_RAW_1(S,X,val); \
72 _FP_UNPACK_CANONICAL(S,1,X); \
73 } while (0)
75 #define FP_UNPACK_SP(X,val) \
76 do { \
77 _FP_UNPACK_RAW_1_P(S,X,val); \
78 _FP_UNPACK_CANONICAL(S,1,X); \
79 } while (0)
81 #define FP_PACK_S(val,X) \
82 do { \
83 _FP_PACK_CANONICAL(S,1,X); \
84 _FP_PACK_RAW_1(S,val,X); \
85 } while (0)
87 #define FP_PACK_SP(val,X) \
88 do { \
89 _FP_PACK_CANONICAL(S,1,X); \
90 if (!FP_INHIBIT_RESULTS) \
91 _FP_PACK_RAW_1_P(S,val,X); \
92 } while (0)
94 #define FP_ISSIGNAN_S(X) _FP_ISSIGNAN(S,1,X)
95 #define FP_NEG_S(R,X) _FP_NEG(S,1,R,X)
96 #define FP_ADD_S(R,X,Y) _FP_ADD(S,1,R,X,Y)
97 #define FP_SUB_S(R,X,Y) _FP_SUB(S,1,R,X,Y)
98 #define FP_MUL_S(R,X,Y) _FP_MUL(S,1,R,X,Y)
99 #define FP_DIV_S(R,X,Y) _FP_DIV(S,1,R,X,Y)
100 #define FP_SQRT_S(R,X) _FP_SQRT(S,1,R,X)
101 #define _FP_SQRT_MEAT_S(R,S,T,X,Q) _FP_SQRT_MEAT_1(R,S,T,X,Q)
103 #define FP_CMP_S(r,X,Y,un) _FP_CMP(S,1,r,X,Y,un)
104 #define FP_CMP_EQ_S(r,X,Y) _FP_CMP_EQ(S,1,r,X,Y)
106 #define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
107 #define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt)
109 #define _FP_FRAC_HIGH_S(X) _FP_FRAC_HIGH_1(X)
110 #define _FP_FRAC_HIGH_RAW_S(X) _FP_FRAC_HIGH_1(X)