1 //===-- cmpsf2_test.c - Test __cmpsf2 -------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file tests single-precision soft-float comparisons for the compiler-rt
11 // library.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include <stdio.h>
16 
17 int __eqsf2(float, float);
18 int __gesf2(float, float);
19 int __gtsf2(float, float);
20 int __lesf2(float, float);
21 int __ltsf2(float, float);
22 int __nesf2(float, float);
23 int __unordsf2(float, float);
24 
25 struct TestVector {
26     float a;
27     float b;
28     int eqReference;
29     int geReference;
30     int gtReference;
31     int leReference;
32     int ltReference;
33     int neReference;
34     int unReference;
35 };
36 
test__cmpsf2(const struct TestVector * vector)37 int test__cmpsf2(const struct TestVector *vector) {
38 
39     if (__eqsf2(vector->a, vector->b) != vector->eqReference) {
40         printf("error in __eqsf2(%a, %a) = %d, expected %d\n",
41                vector->a, vector->b,
42                __eqsf2(vector->a, vector->b),
43                vector->eqReference);
44         return 1;
45     }
46 
47     if (__gesf2(vector->a, vector->b) != vector->geReference) {
48         printf("error in __gesf2(%a, %a) = %d, expected %d\n",
49                vector->a, vector->b,
50                __gesf2(vector->a, vector->b),
51                vector->geReference);
52         return 1;
53     }
54 
55     if (__gtsf2(vector->a, vector->b) != vector->gtReference) {
56         printf("error in __gtsf2(%a, %a) = %d, expected %d\n",
57                vector->a, vector->b,
58                __gtsf2(vector->a, vector->b),
59                vector->gtReference);
60         return 1;
61     }
62 
63     if (__lesf2(vector->a, vector->b) != vector->leReference) {
64         printf("error in __lesf2(%a, %a) = %d, expected %d\n",
65                vector->a, vector->b,
66                __lesf2(vector->a, vector->b),
67                vector->leReference);
68         return 1;
69     }
70 
71     if (__ltsf2(vector->a, vector->b) != vector->ltReference) {
72         printf("error in __ltsf2(%a, %a) = %d, expected %d\n",
73                vector->a, vector->b,
74                __ltsf2(vector->a, vector->b),
75                vector->ltReference);
76         return 1;
77     }
78 
79     if (__nesf2(vector->a, vector->b) != vector->neReference) {
80         printf("error in __nesf2(%a, %a) = %d, expected %d\n",
81                vector->a, vector->b,
82                __nesf2(vector->a, vector->b),
83                vector->neReference);
84         return 1;
85     }
86 
87     if (__unordsf2(vector->a, vector->b) != vector->unReference) {
88         printf("error in __unordsf2(%a, %a) = %d, expected %d\n",
89                vector->a, vector->b,
90                __unordsf2(vector->a, vector->b),
91                vector->unReference);
92         return 1;
93     }
94 
95     return 0;
96 }
97 
98 /*
99 void generateVectors() {
100 
101     const float arguments[] = {
102         __builtin_nanf(""),
103         -__builtin_inff(),
104         -0x1.fffffep127,
105         -0x1.000002p0
106         -0x1.000000p0,
107         -0x1.fffffep-1f,
108         -0x1.000000p-126f,
109         -0x0.fffffep-126f,
110         -0x0.000002p-126f,
111         -0.0,
112          0.0,
113          0x0.000002p-126f,
114          0x0.fffffep-126f,
115          0x1.000000p-126f,
116          0x1.fffffep-1f,
117          0x1.000000p0,
118          0x1.000002p0,
119          0x1.fffffep127,
120          __builtin_inff()
121     };
122 
123     int numArguments = sizeof arguments / sizeof arguments[0];
124 
125     for (int i=0; i<numArguments; ++i) {
126         for (int j=0; j<numArguments; ++j) {
127             const float a = arguments[i];
128             const float b = arguments[j];
129             const int leResult = a < b ? -1 : a == b ? 0 :  1;
130             const int geResult = a > b ?  1 : a == b ? 0 : -1;
131             const int unResult = a != a || b != b ? 1 : 0;
132             printf("{%a,%a,%d,%d,%d,%d,%d,%d,%d},\n",
133                    a, b,
134                    leResult,
135                    geResult,
136                    geResult,
137                    leResult,
138                    leResult,
139                    leResult,
140                    unResult);
141         }
142     }
143 } */
144 
145 static const struct TestVector vectors[] = {
146     {__builtin_nanf(""),__builtin_nanf(""),1,-1,-1,1,1,1,1},
147     {__builtin_nanf(""),-__builtin_inff(),1,-1,-1,1,1,1,1},
148     {__builtin_nanf(""),-0x1.fffffep+127f,1,-1,-1,1,1,1,1},
149     {__builtin_nanf(""),-0x1p0f,1,-1,-1,1,1,1,1},
150     {__builtin_nanf(""),-0x1.fffffep-1f,1,-1,-1,1,1,1,1},
151     {__builtin_nanf(""),-0x1p-126f,1,-1,-1,1,1,1,1},
152     {__builtin_nanf(""),-0x1.fffffcp-127,1,-1,-1,1,1,1,1},
153     {__builtin_nanf(""),-0x1p-149f,1,-1,-1,1,1,1,1},
154     {__builtin_nanf(""),-0x0p0f,1,-1,-1,1,1,1,1},
155     {__builtin_nanf(""),0x0p0f,1,-1,-1,1,1,1,1},
156     {__builtin_nanf(""),0x1p-149f,1,-1,-1,1,1,1,1},
157     {__builtin_nanf(""),0x1.fffffcp-127,1,-1,-1,1,1,1,1},
158     {__builtin_nanf(""),0x1p-126f,1,-1,-1,1,1,1,1},
159     {__builtin_nanf(""),0x1.fffffep-1f,1,-1,-1,1,1,1,1},
160     {__builtin_nanf(""),0x1p0f,1,-1,-1,1,1,1,1},
161     {__builtin_nanf(""),0x1.000002p0f,1,-1,-1,1,1,1,1},
162     {__builtin_nanf(""),0x1.fffffep+127f,1,-1,-1,1,1,1,1},
163     {__builtin_nanf(""),__builtin_inff(),1,-1,-1,1,1,1,1},
164     {-__builtin_inff(),__builtin_nanf(""),1,-1,-1,1,1,1,1},
165     {-__builtin_inff(),-__builtin_inff(),0,0,0,0,0,0,0},
166     {-__builtin_inff(),-0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
167     {-__builtin_inff(),-0x1p0f,-1,-1,-1,-1,-1,-1,0},
168     {-__builtin_inff(),-0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
169     {-__builtin_inff(),-0x1p-126f,-1,-1,-1,-1,-1,-1,0},
170     {-__builtin_inff(),-0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
171     {-__builtin_inff(),-0x1p-149f,-1,-1,-1,-1,-1,-1,0},
172     {-__builtin_inff(),-0x0p0f,-1,-1,-1,-1,-1,-1,0},
173     {-__builtin_inff(),0x0p0f,-1,-1,-1,-1,-1,-1,0},
174     {-__builtin_inff(),0x1p-149f,-1,-1,-1,-1,-1,-1,0},
175     {-__builtin_inff(),0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
176     {-__builtin_inff(),0x1p-126f,-1,-1,-1,-1,-1,-1,0},
177     {-__builtin_inff(),0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
178     {-__builtin_inff(),0x1p0f,-1,-1,-1,-1,-1,-1,0},
179     {-__builtin_inff(),0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
180     {-__builtin_inff(),0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
181     {-__builtin_inff(),__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
182     {-0x1.fffffep+127f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
183     {-0x1.fffffep+127f,-__builtin_inff(),1,1,1,1,1,1,0},
184     {-0x1.fffffep+127f,-0x1.fffffep+127f,0,0,0,0,0,0,0},
185     {-0x1.fffffep+127f,-0x1p0f,-1,-1,-1,-1,-1,-1,0},
186     {-0x1.fffffep+127f,-0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
187     {-0x1.fffffep+127f,-0x1p-126f,-1,-1,-1,-1,-1,-1,0},
188     {-0x1.fffffep+127f,-0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
189     {-0x1.fffffep+127f,-0x1p-149f,-1,-1,-1,-1,-1,-1,0},
190     {-0x1.fffffep+127f,-0x0p0f,-1,-1,-1,-1,-1,-1,0},
191     {-0x1.fffffep+127f,0x0p0f,-1,-1,-1,-1,-1,-1,0},
192     {-0x1.fffffep+127f,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
193     {-0x1.fffffep+127f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
194     {-0x1.fffffep+127f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
195     {-0x1.fffffep+127f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
196     {-0x1.fffffep+127f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
197     {-0x1.fffffep+127f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
198     {-0x1.fffffep+127f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
199     {-0x1.fffffep+127f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
200     {-0x1p0f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
201     {-0x1p0f,-__builtin_inff(),1,1,1,1,1,1,0},
202     {-0x1p0f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
203     {-0x1p0f,-0x1p0f,0,0,0,0,0,0,0},
204     {-0x1p0f,-0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
205     {-0x1p0f,-0x1p-126f,-1,-1,-1,-1,-1,-1,0},
206     {-0x1p0f,-0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
207     {-0x1p0f,-0x1p-149f,-1,-1,-1,-1,-1,-1,0},
208     {-0x1p0f,-0x0p0f,-1,-1,-1,-1,-1,-1,0},
209     {-0x1p0f,0x0p0f,-1,-1,-1,-1,-1,-1,0},
210     {-0x1p0f,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
211     {-0x1p0f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
212     {-0x1p0f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
213     {-0x1p0f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
214     {-0x1p0f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
215     {-0x1p0f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
216     {-0x1p0f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
217     {-0x1p0f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
218     {-0x1.fffffep-1f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
219     {-0x1.fffffep-1f,-__builtin_inff(),1,1,1,1,1,1,0},
220     {-0x1.fffffep-1f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
221     {-0x1.fffffep-1f,-0x1p0f,1,1,1,1,1,1,0},
222     {-0x1.fffffep-1f,-0x1.fffffep-1f,0,0,0,0,0,0,0},
223     {-0x1.fffffep-1f,-0x1p-126f,-1,-1,-1,-1,-1,-1,0},
224     {-0x1.fffffep-1f,-0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
225     {-0x1.fffffep-1f,-0x1p-149f,-1,-1,-1,-1,-1,-1,0},
226     {-0x1.fffffep-1f,-0x0p0f,-1,-1,-1,-1,-1,-1,0},
227     {-0x1.fffffep-1f,0x0p0f,-1,-1,-1,-1,-1,-1,0},
228     {-0x1.fffffep-1f,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
229     {-0x1.fffffep-1f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
230     {-0x1.fffffep-1f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
231     {-0x1.fffffep-1f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
232     {-0x1.fffffep-1f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
233     {-0x1.fffffep-1f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
234     {-0x1.fffffep-1f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
235     {-0x1.fffffep-1f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
236     {-0x1p-126f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
237     {-0x1p-126f,-__builtin_inff(),1,1,1,1,1,1,0},
238     {-0x1p-126f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
239     {-0x1p-126f,-0x1p0f,1,1,1,1,1,1,0},
240     {-0x1p-126f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
241     {-0x1p-126f,-0x1p-126f,0,0,0,0,0,0,0},
242     {-0x1p-126f,-0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
243     {-0x1p-126f,-0x1p-149f,-1,-1,-1,-1,-1,-1,0},
244     {-0x1p-126f,-0x0p0f,-1,-1,-1,-1,-1,-1,0},
245     {-0x1p-126f,0x0p0f,-1,-1,-1,-1,-1,-1,0},
246     {-0x1p-126f,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
247     {-0x1p-126f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
248     {-0x1p-126f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
249     {-0x1p-126f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
250     {-0x1p-126f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
251     {-0x1p-126f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
252     {-0x1p-126f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
253     {-0x1p-126f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
254     {-0x1.fffffcp-127,__builtin_nanf(""),1,-1,-1,1,1,1,1},
255     {-0x1.fffffcp-127,-__builtin_inff(),1,1,1,1,1,1,0},
256     {-0x1.fffffcp-127,-0x1.fffffep+127f,1,1,1,1,1,1,0},
257     {-0x1.fffffcp-127,-0x1p0f,1,1,1,1,1,1,0},
258     {-0x1.fffffcp-127,-0x1.fffffep-1f,1,1,1,1,1,1,0},
259     {-0x1.fffffcp-127,-0x1p-126f,1,1,1,1,1,1,0},
260     {-0x1.fffffcp-127,-0x1.fffffcp-127,0,0,0,0,0,0,0},
261     {-0x1.fffffcp-127,-0x1p-149f,-1,-1,-1,-1,-1,-1,0},
262     {-0x1.fffffcp-127,-0x0p0f,-1,-1,-1,-1,-1,-1,0},
263     {-0x1.fffffcp-127,0x0p0f,-1,-1,-1,-1,-1,-1,0},
264     {-0x1.fffffcp-127,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
265     {-0x1.fffffcp-127,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
266     {-0x1.fffffcp-127,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
267     {-0x1.fffffcp-127,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
268     {-0x1.fffffcp-127,0x1p0f,-1,-1,-1,-1,-1,-1,0},
269     {-0x1.fffffcp-127,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
270     {-0x1.fffffcp-127,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
271     {-0x1.fffffcp-127,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
272     {-0x1p-149f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
273     {-0x1p-149f,-__builtin_inff(),1,1,1,1,1,1,0},
274     {-0x1p-149f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
275     {-0x1p-149f,-0x1p0f,1,1,1,1,1,1,0},
276     {-0x1p-149f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
277     {-0x1p-149f,-0x1p-126f,1,1,1,1,1,1,0},
278     {-0x1p-149f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
279     {-0x1p-149f,-0x1p-149f,0,0,0,0,0,0,0},
280     {-0x1p-149f,-0x0p0f,-1,-1,-1,-1,-1,-1,0},
281     {-0x1p-149f,0x0p0f,-1,-1,-1,-1,-1,-1,0},
282     {-0x1p-149f,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
283     {-0x1p-149f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
284     {-0x1p-149f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
285     {-0x1p-149f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
286     {-0x1p-149f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
287     {-0x1p-149f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
288     {-0x1p-149f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
289     {-0x1p-149f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
290     {-0x0p0f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
291     {-0x0p0f,-__builtin_inff(),1,1,1,1,1,1,0},
292     {-0x0p0f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
293     {-0x0p0f,-0x1p0f,1,1,1,1,1,1,0},
294     {-0x0p0f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
295     {-0x0p0f,-0x1p-126f,1,1,1,1,1,1,0},
296     {-0x0p0f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
297     {-0x0p0f,-0x1p-149f,1,1,1,1,1,1,0},
298     {-0x0p0f,-0x0p0f,0,0,0,0,0,0,0},
299     {-0x0p0f,0x0p0f,0,0,0,0,0,0,0},
300     {-0x0p0f,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
301     {-0x0p0f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
302     {-0x0p0f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
303     {-0x0p0f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
304     {-0x0p0f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
305     {-0x0p0f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
306     {-0x0p0f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
307     {-0x0p0f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
308     {0x0p0f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
309     {0x0p0f,-__builtin_inff(),1,1,1,1,1,1,0},
310     {0x0p0f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
311     {0x0p0f,-0x1p0f,1,1,1,1,1,1,0},
312     {0x0p0f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
313     {0x0p0f,-0x1p-126f,1,1,1,1,1,1,0},
314     {0x0p0f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
315     {0x0p0f,-0x1p-149f,1,1,1,1,1,1,0},
316     {0x0p0f,-0x0p0f,0,0,0,0,0,0,0},
317     {0x0p0f,0x0p0f,0,0,0,0,0,0,0},
318     {0x0p0f,0x1p-149f,-1,-1,-1,-1,-1,-1,0},
319     {0x0p0f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
320     {0x0p0f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
321     {0x0p0f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
322     {0x0p0f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
323     {0x0p0f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
324     {0x0p0f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
325     {0x0p0f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
326     {0x1p-149f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
327     {0x1p-149f,-__builtin_inff(),1,1,1,1,1,1,0},
328     {0x1p-149f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
329     {0x1p-149f,-0x1p0f,1,1,1,1,1,1,0},
330     {0x1p-149f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
331     {0x1p-149f,-0x1p-126f,1,1,1,1,1,1,0},
332     {0x1p-149f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
333     {0x1p-149f,-0x1p-149f,1,1,1,1,1,1,0},
334     {0x1p-149f,-0x0p0f,1,1,1,1,1,1,0},
335     {0x1p-149f,0x0p0f,1,1,1,1,1,1,0},
336     {0x1p-149f,0x1p-149f,0,0,0,0,0,0,0},
337     {0x1p-149f,0x1.fffffcp-127,-1,-1,-1,-1,-1,-1,0},
338     {0x1p-149f,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
339     {0x1p-149f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
340     {0x1p-149f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
341     {0x1p-149f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
342     {0x1p-149f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
343     {0x1p-149f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
344     {0x1.fffffcp-127,__builtin_nanf(""),1,-1,-1,1,1,1,1},
345     {0x1.fffffcp-127,-__builtin_inff(),1,1,1,1,1,1,0},
346     {0x1.fffffcp-127,-0x1.fffffep+127f,1,1,1,1,1,1,0},
347     {0x1.fffffcp-127,-0x1p0f,1,1,1,1,1,1,0},
348     {0x1.fffffcp-127,-0x1.fffffep-1f,1,1,1,1,1,1,0},
349     {0x1.fffffcp-127,-0x1p-126f,1,1,1,1,1,1,0},
350     {0x1.fffffcp-127,-0x1.fffffcp-127,1,1,1,1,1,1,0},
351     {0x1.fffffcp-127,-0x1p-149f,1,1,1,1,1,1,0},
352     {0x1.fffffcp-127,-0x0p0f,1,1,1,1,1,1,0},
353     {0x1.fffffcp-127,0x0p0f,1,1,1,1,1,1,0},
354     {0x1.fffffcp-127,0x1p-149f,1,1,1,1,1,1,0},
355     {0x1.fffffcp-127,0x1.fffffcp-127,0,0,0,0,0,0,0},
356     {0x1.fffffcp-127,0x1p-126f,-1,-1,-1,-1,-1,-1,0},
357     {0x1.fffffcp-127,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
358     {0x1.fffffcp-127,0x1p0f,-1,-1,-1,-1,-1,-1,0},
359     {0x1.fffffcp-127,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
360     {0x1.fffffcp-127,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
361     {0x1.fffffcp-127,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
362     {0x1p-126f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
363     {0x1p-126f,-__builtin_inff(),1,1,1,1,1,1,0},
364     {0x1p-126f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
365     {0x1p-126f,-0x1p0f,1,1,1,1,1,1,0},
366     {0x1p-126f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
367     {0x1p-126f,-0x1p-126f,1,1,1,1,1,1,0},
368     {0x1p-126f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
369     {0x1p-126f,-0x1p-149f,1,1,1,1,1,1,0},
370     {0x1p-126f,-0x0p0f,1,1,1,1,1,1,0},
371     {0x1p-126f,0x0p0f,1,1,1,1,1,1,0},
372     {0x1p-126f,0x1p-149f,1,1,1,1,1,1,0},
373     {0x1p-126f,0x1.fffffcp-127,1,1,1,1,1,1,0},
374     {0x1p-126f,0x1p-126f,0,0,0,0,0,0,0},
375     {0x1p-126f,0x1.fffffep-1f,-1,-1,-1,-1,-1,-1,0},
376     {0x1p-126f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
377     {0x1p-126f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
378     {0x1p-126f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
379     {0x1p-126f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
380     {0x1.fffffep-1f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
381     {0x1.fffffep-1f,-__builtin_inff(),1,1,1,1,1,1,0},
382     {0x1.fffffep-1f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
383     {0x1.fffffep-1f,-0x1p0f,1,1,1,1,1,1,0},
384     {0x1.fffffep-1f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
385     {0x1.fffffep-1f,-0x1p-126f,1,1,1,1,1,1,0},
386     {0x1.fffffep-1f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
387     {0x1.fffffep-1f,-0x1p-149f,1,1,1,1,1,1,0},
388     {0x1.fffffep-1f,-0x0p0f,1,1,1,1,1,1,0},
389     {0x1.fffffep-1f,0x0p0f,1,1,1,1,1,1,0},
390     {0x1.fffffep-1f,0x1p-149f,1,1,1,1,1,1,0},
391     {0x1.fffffep-1f,0x1.fffffcp-127,1,1,1,1,1,1,0},
392     {0x1.fffffep-1f,0x1p-126f,1,1,1,1,1,1,0},
393     {0x1.fffffep-1f,0x1.fffffep-1f,0,0,0,0,0,0,0},
394     {0x1.fffffep-1f,0x1p0f,-1,-1,-1,-1,-1,-1,0},
395     {0x1.fffffep-1f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
396     {0x1.fffffep-1f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
397     {0x1.fffffep-1f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
398     {0x1p0f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
399     {0x1p0f,-__builtin_inff(),1,1,1,1,1,1,0},
400     {0x1p0f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
401     {0x1p0f,-0x1p0f,1,1,1,1,1,1,0},
402     {0x1p0f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
403     {0x1p0f,-0x1p-126f,1,1,1,1,1,1,0},
404     {0x1p0f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
405     {0x1p0f,-0x1p-149f,1,1,1,1,1,1,0},
406     {0x1p0f,-0x0p0f,1,1,1,1,1,1,0},
407     {0x1p0f,0x0p0f,1,1,1,1,1,1,0},
408     {0x1p0f,0x1p-149f,1,1,1,1,1,1,0},
409     {0x1p0f,0x1.fffffcp-127,1,1,1,1,1,1,0},
410     {0x1p0f,0x1p-126f,1,1,1,1,1,1,0},
411     {0x1p0f,0x1.fffffep-1f,1,1,1,1,1,1,0},
412     {0x1p0f,0x1p0f,0,0,0,0,0,0,0},
413     {0x1p0f,0x1.000002p0f,-1,-1,-1,-1,-1,-1,0},
414     {0x1p0f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
415     {0x1p0f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
416     {0x1.000002p0f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
417     {0x1.000002p0f,-__builtin_inff(),1,1,1,1,1,1,0},
418     {0x1.000002p0f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
419     {0x1.000002p0f,-0x1p0f,1,1,1,1,1,1,0},
420     {0x1.000002p0f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
421     {0x1.000002p0f,-0x1p-126f,1,1,1,1,1,1,0},
422     {0x1.000002p0f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
423     {0x1.000002p0f,-0x1p-149f,1,1,1,1,1,1,0},
424     {0x1.000002p0f,-0x0p0f,1,1,1,1,1,1,0},
425     {0x1.000002p0f,0x0p0f,1,1,1,1,1,1,0},
426     {0x1.000002p0f,0x1p-149f,1,1,1,1,1,1,0},
427     {0x1.000002p0f,0x1.fffffcp-127,1,1,1,1,1,1,0},
428     {0x1.000002p0f,0x1p-126f,1,1,1,1,1,1,0},
429     {0x1.000002p0f,0x1.fffffep-1f,1,1,1,1,1,1,0},
430     {0x1.000002p0f,0x1p0f,1,1,1,1,1,1,0},
431     {0x1.000002p0f,0x1.000002p0f,0,0,0,0,0,0,0},
432     {0x1.000002p0f,0x1.fffffep+127f,-1,-1,-1,-1,-1,-1,0},
433     {0x1.000002p0f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
434     {0x1.fffffep+127f,__builtin_nanf(""),1,-1,-1,1,1,1,1},
435     {0x1.fffffep+127f,-__builtin_inff(),1,1,1,1,1,1,0},
436     {0x1.fffffep+127f,-0x1.fffffep+127f,1,1,1,1,1,1,0},
437     {0x1.fffffep+127f,-0x1p0f,1,1,1,1,1,1,0},
438     {0x1.fffffep+127f,-0x1.fffffep-1f,1,1,1,1,1,1,0},
439     {0x1.fffffep+127f,-0x1p-126f,1,1,1,1,1,1,0},
440     {0x1.fffffep+127f,-0x1.fffffcp-127,1,1,1,1,1,1,0},
441     {0x1.fffffep+127f,-0x1p-149f,1,1,1,1,1,1,0},
442     {0x1.fffffep+127f,-0x0p0f,1,1,1,1,1,1,0},
443     {0x1.fffffep+127f,0x0p0f,1,1,1,1,1,1,0},
444     {0x1.fffffep+127f,0x1p-149f,1,1,1,1,1,1,0},
445     {0x1.fffffep+127f,0x1.fffffcp-127,1,1,1,1,1,1,0},
446     {0x1.fffffep+127f,0x1p-126f,1,1,1,1,1,1,0},
447     {0x1.fffffep+127f,0x1.fffffep-1f,1,1,1,1,1,1,0},
448     {0x1.fffffep+127f,0x1p0f,1,1,1,1,1,1,0},
449     {0x1.fffffep+127f,0x1.000002p0f,1,1,1,1,1,1,0},
450     {0x1.fffffep+127f,0x1.fffffep+127f,0,0,0,0,0,0,0},
451     {0x1.fffffep+127f,__builtin_inff(),-1,-1,-1,-1,-1,-1,0},
452     {__builtin_inff(),__builtin_nanf(""),1,-1,-1,1,1,1,1},
453     {__builtin_inff(),-__builtin_inff(),1,1,1,1,1,1,0},
454     {__builtin_inff(),-0x1.fffffep+127f,1,1,1,1,1,1,0},
455     {__builtin_inff(),-0x1p0f,1,1,1,1,1,1,0},
456     {__builtin_inff(),-0x1.fffffep-1f,1,1,1,1,1,1,0},
457     {__builtin_inff(),-0x1p-126f,1,1,1,1,1,1,0},
458     {__builtin_inff(),-0x1.fffffcp-127,1,1,1,1,1,1,0},
459     {__builtin_inff(),-0x1p-149f,1,1,1,1,1,1,0},
460     {__builtin_inff(),-0x0p0f,1,1,1,1,1,1,0},
461     {__builtin_inff(),0x0p0f,1,1,1,1,1,1,0},
462     {__builtin_inff(),0x1p-149f,1,1,1,1,1,1,0},
463     {__builtin_inff(),0x1.fffffcp-127,1,1,1,1,1,1,0},
464     {__builtin_inff(),0x1p-126f,1,1,1,1,1,1,0},
465     {__builtin_inff(),0x1.fffffep-1f,1,1,1,1,1,1,0},
466     {__builtin_inff(),0x1p0f,1,1,1,1,1,1,0},
467     {__builtin_inff(),0x1.000002p0f,1,1,1,1,1,1,0},
468     {__builtin_inff(),0x1.fffffep+127f,1,1,1,1,1,1,0},
469     {__builtin_inff(),__builtin_inff(),0,0,0,0,0,0,0},
470 };
471 
main(int argc,char * argv[])472 int main(int argc, char *argv[]) {
473     const int numVectors = sizeof vectors / sizeof vectors[0];
474     int i;
475     for (i = 0; i<numVectors; ++i) {
476         if (test__cmpsf2(&vectors[i])) return 1;
477     }
478     return 0;
479 }
480