1 /* fp-test.c - Check that all floating-point operations are available.
2 Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc.
3 Contributed by Ronald F. Guilmette <rfg@monkeys.com>.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 /* This is a trivial test program which may be useful to people who are
23 porting the GCC or G++ compilers to a new system. The intent here is
24 merely to check that all floating-point operations have been provided
25 by the port. (Note that I say ``provided'' rather than ``implemented''.)
27 To use this file, simply compile it (with GCC or G++) and then try to
28 link it in the normal way (also using GCC or G++ respectively). If
29 all of the floating -point operations (including conversions) have
30 been provided, then this file will link without incident. If however
31 one or more of the primitive floating-point operations have not been
32 properly provided, you will get link-time errors indicating which
33 floating-point operations are unavailable.
35 This file will typically be used when porting the GNU compilers to
36 some system which lacks floating-point hardware, and for which
37 software emulation routines (for FP ops) are needed in order to
44 extern double acos (double);
45 extern double asin (double);
46 extern double atan (double);
47 extern double atan2 (double, double);
48 extern double cos (double);
49 extern double sin (double);
50 extern double tan (double);
51 extern double cosh (double);
52 extern double sinh (double);
53 extern double tanh (double);
54 extern double exp (double);
55 extern double frexp (double, int *);
56 extern double ldexp (double, int);
57 extern double log (double);
58 extern double log10 (double);
59 extern double modf (double, double *);
60 extern double pow (double, double);
61 extern double sqrt (double);
62 extern double ceil (double);
63 extern double fabs (double);
64 extern double floor (double);
65 extern double fmod (double, double);
69 volatile signed char sc
;
70 volatile unsigned char uc
;
72 volatile signed short ss
;
73 volatile unsigned short us
;
75 volatile signed int si
;
76 volatile unsigned int ui
;
78 volatile signed long sl
;
79 volatile unsigned long ul
;
81 volatile float f1
= 1.0, f2
= 1.0, f3
= 1.0;
82 volatile double d1
= 1.0, d2
= 1.0, d3
= 1.0;
83 volatile long double D1
= 1.0, D2
= 1.0, D3
= 1.0;
107 si
= __builtin_isgreater (f1
, f2
);
108 si
= __builtin_isgreaterequal (f1
, f2
);
109 si
= __builtin_isless (f1
, f2
);
110 si
= __builtin_islessequal (f1
, f2
);
111 si
= __builtin_islessgreater (f1
, f2
);
112 si
= __builtin_isunordered (f1
, f2
);
153 si
= __builtin_isgreater (d1
, d2
);
154 si
= __builtin_isgreaterequal (d1
, d2
);
155 si
= __builtin_isless (d1
, d2
);
156 si
= __builtin_islessequal (d1
, d2
);
157 si
= __builtin_islessgreater (d1
, d2
);
158 si
= __builtin_isunordered (d1
, d2
);
199 si
= __builtin_isgreater (D1
, D2
);
200 si
= __builtin_isgreaterequal (D1
, D2
);
201 si
= __builtin_isless (D1
, D2
);
202 si
= __builtin_islessequal (D1
, D2
);
203 si
= __builtin_islessgreater (D1
, D2
);
204 si
= __builtin_isunordered (D1
, D2
);
239 d1
= frexp (d2
, &i1
);