struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-cmpsf-1.c
blob13c7fc78b5434342f8d70e28d280ef29f0588ef0
1 /*
2 cmpsf-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 #include <limits.h>
12 #include <float.h>
14 #define F 140
15 #define T 13
17 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
18 int
19 feq (float x, float y)
21 if (x == y)
22 return T;
23 else
24 return F;
27 int
28 fne (float x, float y)
30 if (x != y)
31 return T;
32 else
33 return F;
36 int
37 flt (float x, float y)
39 if (x < y)
40 return T;
41 else
42 return F;
45 int
46 fge (float x, float y)
48 if (x >= y)
49 return T;
50 else
51 return F;
54 int
55 fgt (float x, float y)
57 if (x > y)
58 return T;
59 else
60 return F;
63 int
64 fle (float x, float y)
66 if (x <= y)
67 return T;
68 else
69 return F;
72 float args[] =
74 0.0F,
75 1.0F,
76 -1.0F,
77 FLT_MAX,
78 FLT_MIN,
79 0.0000000000001F,
80 123456789.0F,
81 -987654321.0F
84 #ifdef __SDCC_mcs51
85 const
86 #endif
88 int correct_results[] =
90 T, F, F, T, F, T,
91 F, T, T, F, F, T,
92 F, T, F, T, T, F,
93 F, T, T, F, F, T,
94 F, T, T, F, F, T,
95 F, T, T, F, F, T,
96 F, T, T, F, F, T,
97 F, T, F, T, T, F,
98 F, T, F, T, T, F,
99 T, F, F, T, F, T,
100 F, T, F, T, T, F,
101 F, T, T, F, F, T,
102 F, T, F, T, T, F,
103 F, T, F, T, T, F,
104 F, T, T, F, F, T,
105 F, T, F, T, T, F,
106 F, T, T, F, F, T,
107 F, T, T, F, F, T,
108 T, F, F, T, F, T,
109 F, T, T, F, F, T,
110 F, T, T, F, F, T,
111 F, T, T, F, F, T,
112 F, T, T, F, F, T,
113 F, T, F, T, T, F,
114 F, T, F, T, T, F,
115 F, T, F, T, T, F,
116 F, T, F, T, T, F,
117 T, F, F, T, F, T,
118 F, T, F, T, T, F,
119 F, T, F, T, T, F,
120 F, T, F, T, T, F,
121 F, T, F, T, T, F,
122 F, T, F, T, T, F,
123 F, T, T, F, F, T,
124 F, T, F, T, T, F,
125 F, T, T, F, F, T,
126 T, F, F, T, F, T,
127 F, T, T, F, F, T,
128 F, T, T, F, F, T,
129 F, T, F, T, T, F,
130 F, T, F, T, T, F,
131 F, T, T, F, F, T,
132 F, T, F, T, T, F,
133 F, T, T, F, F, T,
134 F, T, F, T, T, F,
135 T, F, F, T, F, T,
136 F, T, T, F, F, T,
137 F, T, F, T, T, F,
138 F, T, F, T, T, F,
139 F, T, F, T, T, F,
140 F, T, F, T, T, F,
141 F, T, T, F, F, T,
142 F, T, F, T, T, F,
143 F, T, F, T, T, F,
144 T, F, F, T, F, T,
145 F, T, F, T, T, F,
146 F, T, T, F, F, T,
147 F, T, T, F, F, T,
148 F, T, T, F, F, T,
149 F, T, T, F, F, T,
150 F, T, T, F, F, T,
151 F, T, T, F, F, T,
152 F, T, T, F, F, T,
153 T, F, F, T, F, T,
155 #endif
157 void
158 testTortureExecute (void)
160 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
161 const int *res = correct_results;
162 int i, j;
164 for (i = 0; i < 8; i++)
166 float arg0 = args[i];
167 for (j = 0; j < 8; j++)
169 float arg1 = args[j];
171 ASSERT(feq (arg0, arg1) == *res++);
172 ASSERT(fne (arg0, arg1) == *res++);
173 ASSERT(flt (arg0, arg1) == *res++);
174 ASSERT(fge (arg0, arg1) == *res++);
175 ASSERT(fgt (arg0, arg1) == *res++);
176 ASSERT(fle (arg0, arg1) == *res++);
179 #endif
180 return;