1 /* Definitions of target machine for GNU compiler, for IBM S/390
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3 Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4 Ulrich Weigand (uweigand@de.ibm.com).
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
26 #define SIGNBIT 0x80000000
27 #define SIGND(fp) ((fp.l.upper) & SIGNBIT)
28 #define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
29 #define FRACD_LL(fp) (fp.ll & (HIDDEND_LL-1))
30 #define HIDDEND_LL ((UDItype_x)1 << 52)
32 typedef int DItype_x
__attribute__ ((mode (DI
)));
33 typedef unsigned int UDItype_x
__attribute__ ((mode (DI
)));
34 typedef int SItype_x
__attribute__ ((mode (SI
)));
35 typedef unsigned int USItype_x
__attribute__ ((mode (SI
)));
46 UDItype_x
__fixunsdfdi (double a1
);
48 /* convert double to unsigned int */
50 __fixunsdfdi (double a1
)
52 register union double_long dl1
;
58 /* +/- 0, denormalized, negative */
60 if (!EXPD (dl1
) || SIGND(dl1
))
63 exp
= EXPD (dl1
) - EXCESSD
- 53;
72 if ((EXPD(dl1
) == 0x7ff) && (FRACD_LL(dl1
) != 0)) /* NaN */
75 /* Number big number & + inf */
78 return 0xFFFFFFFFFFFFFFFFULL
;
83 /* shift down until exp < 12 or l = 0 */
91 #define __fixunsdfdi ___fixunsdfdi
96 #define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
98 #define SIGNBIT 0x80000000
99 #define SIGND(fp) ((fp.l.upper) & SIGNBIT)
100 #define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
101 #define FRACD_LL(fp) (fp.ll & (HIDDEND_LL-1))
102 #define HIDDEND_LL ((UDItype_x)1 << 52)
104 typedef int DItype_x
__attribute__ ((mode (DI
)));
105 typedef unsigned int UDItype_x
__attribute__ ((mode (DI
)));
106 typedef int SItype_x
__attribute__ ((mode (SI
)));
107 typedef unsigned int USItype_x
__attribute__ ((mode (SI
)));
118 DItype_x
__fixdfdi (double a1
);
120 /* convert double to int */
122 __fixdfdi (double a1
)
124 register union double_long dl1
;
130 /* +/- 0, denormalized */
135 exp
= EXPD (dl1
) - EXCESSD
- 53;
144 if ((EXPD(dl1
) == 0x7ff) && (FRACD_LL(dl1
) != 0)) /* NaN */
145 return 0x8000000000000000ULL
;
147 /* Number big number & +/- inf */
150 l
= (long long)1<<63;
158 /* shift down until exp < 12 or l = 0 */
164 return (SIGND (dl1
) ? -l
: l
);
166 #define __fixdfdi ___fixdfdi
171 #define EXP(fp) (((fp.l) >> 23) & 0xFF)
173 #define SIGNBIT 0x80000000
174 #define SIGN(fp) ((fp.l) & SIGNBIT)
175 #define HIDDEN (1 << 23)
176 #define MANT(fp) (((fp.l) & 0x7FFFFF) | HIDDEN)
177 #define FRAC(fp) ((fp.l) & 0x7FFFFF)
179 typedef int DItype_x
__attribute__ ((mode (DI
)));
180 typedef unsigned int UDItype_x
__attribute__ ((mode (DI
)));
181 typedef int SItype_x
__attribute__ ((mode (SI
)));
182 typedef unsigned int USItype_x
__attribute__ ((mode (SI
)));
190 UDItype_x
__fixunssfdi (float a1
);
192 /* convert float to unsigned int */
194 __fixunssfdi (float a1
)
196 register union float_long fl1
;
198 register UDItype_x l
;
202 /* +/- 0, denormalized, negative */
204 if (!EXP (fl1
) || SIGN(fl1
))
207 exp
= EXP (fl1
) - EXCESS
- 24;
216 if ((EXP(fl1
) == 0xff) && (FRAC(fl1
) != 0)) /* NaN */
219 /* Number big number & + inf */
222 return 0xFFFFFFFFFFFFFFFFULL
;
234 #define __fixunssfdi ___fixunssfdi
239 #define EXP(fp) (((fp.l) >> 23) & 0xFF)
241 #define SIGNBIT 0x80000000
242 #define SIGN(fp) ((fp.l) & SIGNBIT)
243 #define HIDDEN (1 << 23)
244 #define MANT(fp) (((fp.l) & 0x7FFFFF) | HIDDEN)
245 #define FRAC(fp) ((fp.l) & 0x7FFFFF)
247 typedef int DItype_x
__attribute__ ((mode (DI
)));
248 typedef unsigned int UDItype_x
__attribute__ ((mode (DI
)));
249 typedef int SItype_x
__attribute__ ((mode (SI
)));
250 typedef unsigned int USItype_x
__attribute__ ((mode (SI
)));
258 DItype_x
__fixsfdi (float a1
);
260 /* convert double to int */
264 register union float_long fl1
;
270 /* +/- 0, denormalized */
275 exp
= EXP (fl1
) - EXCESS
- 24;
284 if ((EXP(fl1
) == 0xff) && (FRAC(fl1
) != 0)) /* NaN */
285 return 0x8000000000000000ULL
;
287 /* Number big number & +/- inf */
290 l
= (long long)1<<63;
303 return (SIGN (fl1
) ? -l
: l
);
305 #define __fixsfdi ___fixsfdi