none/tests/fdleak_cmsg_supp.supp: Add suppressions for older glibc
[valgrind.git] / none / tests / mips32 / fpu_branches.c
blobe12a6e3c659e712a03cb768018f29191c45034ee
1 #if defined(__mips_hard_float) && (__mips_isa_rev<6)
3 #include <stdio.h>
5 #define MAX_ARR 24
7 const float fs_f[] = {
8 0, 456.25, 3, -1,
9 1384.5, -7.25, 1000000000, -5786.5,
10 1752, 0.015625, 0.03125, -248562.75,
11 -45786.5, 456, 34.03125, 45786.75,
12 1752065, 107, -45667.25, -7,
13 -347856.5, 356047.5, -1.0, 23.0625
16 const float ft_f[] = {
17 -4578.5, 456.25, 34.03125, 4578.75,
18 175, 107, -456.25, -7.25,
19 -3478.5, 356.5, -1.0, 23.0625,
20 0, 456.25, 3, -1,
21 1384.5, -7, 100, -5786.5,
22 1752, 0.015625, 0.03125, -248562.75
25 const double fs_d[] = {
26 0, 456.25, 3, -1,
27 1384.5, -7.25, 1000000000, -5786.5,
28 1752, 0.015625, 0.03125, -248562.75,
29 -45786.5, 456, 34.03125, 45786.75,
30 1752065, 107, -45667.25, -7,
31 -347856.5, 356047.5, -1.0, 23.0625
34 const double ft_d[] = {
35 -45786.5, 456.25, 34.03125, 45786.75,
36 1752065, 107, -45667.25, -7.25,
37 -347856.5, 356047.5, -1.0, 23.0625,
38 0, 456.25, 3, -1,
39 1384.5, -7, 1000000000, -5786.5,
40 1752, 0.015625, 0.03125, -248562.75
43 /* Conditional macros.*/
44 #define TESTINST1s(instruction, RDval) \
45 { \
46 float outf = 0; \
47 __asm__ __volatile__( \
48 ".set noreorder" "\n\t" \
49 "mov.s $f0, %1" "\n\t" \
50 "mov.s $f2, %2" "\n\t" \
51 "c.eq.s $f0, $f2" "\n\t" \
52 instruction" end"instruction"s"#RDval "\n\t" \
53 "nop" "\n\t" \
54 "add.s $f0, $f0, $f2" "\n\t" \
55 "end"instruction"s"#RDval":" "\n\t" \
56 "mov.s %0, $f0" "\n\t" \
57 ".set reorder" "\n\t" \
58 : "=f" (outf) \
59 : "f" (fs_f[i]) , "f" (ft_f[i]) \
60 : "$f0", "$f2" \
61 ); \
62 printf("%s, c.eq.s out=%f, fs=%f, ft=%f\n", \
63 instruction, outf, fs_f[i], ft_f[i]); \
66 #define TESTINST1d(instruction, RDval) \
67 { \
68 double outd = 0; \
69 __asm__ __volatile__( \
70 ".set noreorder" "\n\t" \
71 "mov.d $f0, %1" "\n\t" \
72 "mov.d $f2, %2" "\n\t" \
73 "c.eq.d $f0, $f2" "\n\t" \
74 instruction" end"instruction"d"#RDval "\n\t" \
75 "nop" "\n\t" \
76 "add.d $f0, $f0, $f2" "\n\t" \
77 "end"instruction"d"#RDval":" "\n\t" \
78 "mov.d %0, $f0" "\n\t" \
79 ".set reorder" "\n\t" \
80 : "=f" (outd) \
81 : "f" (fs_d[i]) , "f" (ft_d[i]) \
82 : "$f0", "$f1", "$f2", "$f3" \
83 ); \
84 printf("%s, c.eq.d out=%f, fs=%f, ft=%f\n", \
85 instruction, outd, fs_d[i], ft_d[i]); \
88 #define TESTINST2s(instruction, RDval) \
89 { \
90 float outf = 0; \
91 __asm__ __volatile__( \
92 ".set noreorder" "\n\t" \
93 "mov.s $f0, %1" "\n\t" \
94 "mov.s $f2, %2" "\n\t" \
95 "c.eq.s $f0, $f2" "\n\t" \
96 instruction" end"instruction"s"#RDval "\n\t" \
97 "add.s $f0, $f0, $f2" "\n\t" \
98 "end"instruction"s"#RDval":" "\n\t" \
99 "mov.s %0, $f0" "\n\t" \
100 ".set reorder" "\n\t" \
101 : "=f" (outf) \
102 : "f" (fs_f[i]) , "f" (ft_f[i]) \
103 : "$f0", "$f2" \
104 ); \
105 printf("%s, c.eq.s out=%f, fs=%f, ft=%f\n", \
106 instruction, outf, fs_f[i], ft_f[i]); \
109 #define TESTINST2d(instruction, RDval) \
111 double outd = 0; \
112 __asm__ __volatile__( \
113 ".set noreorder" "\n\t" \
114 "mov.d $f0, %1" "\n\t" \
115 "mov.d $f2, %2" "\n\t" \
116 "c.eq.d $f0, $f2" "\n\t" \
117 instruction" end"instruction"d"#RDval "\n\t" \
118 "add.d $f0, $f0, $f2" "\n\t" \
119 "end"instruction"d"#RDval":" "\n\t" \
120 "mov.d %0, $f0" "\n\t" \
121 ".set reorder" "\n\t" \
122 : "=f" (outd) \
123 : "f" (fs_d[i]) , "f" (ft_d[i]) \
124 : "$f0", "$f1", "$f2", "$f3" \
125 ); \
126 printf("%s, c.eq.d out=%f, fs=%f, ft=%f\n", \
127 instruction, outd, fs_d[i], ft_d[i]); \
130 #define TESTINST_CONDs(instruction, RDval) \
132 float outf = 0; \
133 __asm__ __volatile__( \
134 ".set noreorder" "\n\t" \
135 "mov.s $f0, %1" "\n\t" \
136 "mov.s $f2, %2" "\n\t" \
137 instruction" $f0, $f2" "\n\t" \
138 "bc1f end"instruction"s"#RDval "\n\t" \
139 "nop" "\n\t" \
140 "add.s $f0, $f0, $f2" "\n\t" \
141 "end"instruction"s"#RDval":" "\n\t" \
142 "mov.s %0, $f0" "\n\t" \
143 ".set reorder" "\n\t" \
144 : "=f" (outf) \
145 : "f" (fs_f[i]) , "f" (ft_f[i]) \
146 : "$f0", "$f1", "$f2" \
147 ); \
148 printf("%s, bc1f out=%f, fs=%f, ft=%f\n", \
149 instruction, outf, fs_f[i], ft_f[i]); \
152 #define TESTINST_CONDd(instruction, RDval) \
154 double outd = 0; \
155 __asm__ __volatile__( \
156 ".set noreorder" "\n\t" \
157 "mov.d $f0, %1" "\n\t" \
158 "mov.d $f2, %2" "\n\t" \
159 instruction" $f0, $f2" "\n\t" \
160 "bc1f end"instruction"d"#RDval "\n\t" \
161 "nop" "\n\t" \
162 "add.d $f0, $f0, $f2" "\n\t" \
163 "end"instruction"d"#RDval":" "\n\t" \
164 "mov.d %0, $f0" "\n\t" \
165 ".set reorder" "\n\t" \
166 : "=f" (outd) \
167 : "f" (fs_d[i]) , "f" (ft_d[i]) \
168 : "$f0", "$f1", "$f2", "$f2" \
169 ); \
170 printf("%s, bc1f out=%f, fs=%f, ft=%f\n", \
171 instruction, outd, fs_d[i], ft_d[i]); \
174 int main()
176 int i = 0;
177 printf("--- BC1F --- if fs != ft then " \
178 "out = fs else out = fs + ft\n");
179 for (i = 0; i < MAX_ARR; i++) {
180 TESTINST1s("bc1f", i);
181 TESTINST1d("bc1f", i);
184 printf("--- BC1T --- if fs == ft then " \
185 "out = fs else out = fs + ft\n");
186 for (i = 0; i < MAX_ARR; i++) {
187 TESTINST1s("bc1t", i);
188 TESTINST1d("bc1t", i);
191 printf("--- BC1FL --- if fs == ft then " \
192 "out = ft else out = fs + ft\n");
193 for (i = 0; i < MAX_ARR; i++) {
194 TESTINST2s("bc1fl", i);
195 TESTINST2d("bc1fl", i);
198 printf("--- BC1TL --- if fs != ft then " \
199 "out = fs else out = fs + ft\n");
200 for (i = 0; i < MAX_ARR; i++) {
201 TESTINST2s("bc1tl", i);
202 TESTINST2d("bc1tl", i);
205 printf("--- C.F.S/D --- if false then " \
206 "out = fs + ft else out = fs\n");
207 for (i = 0; i < MAX_ARR; i++) {
208 TESTINST_CONDs("c.f.s", i);
209 TESTINST_CONDd("c.f.d", i);
212 printf("--- C.UN.S/D --- if unordered(fs, ft) then " \
213 "out = fs + ft else out = fs\n");
214 for (i = 0; i < MAX_ARR; i++) {
215 TESTINST_CONDs("c.un.s", i);
216 TESTINST_CONDd("c.un.d", i);
219 printf("--- C.EQ.S/D --- if fs == ft then " \
220 "out = fs + ft else out = fs\n");
221 for (i = 0; i < MAX_ARR; i++) {
222 TESTINST_CONDs("c.eq.s", i);
223 TESTINST_CONDd("c.eq.d", i);
226 printf("--- C.UEQ.S/D --- if (unordered(fs, ft) or (fs == ft)) then " \
227 "out = fs + ft else out = fs\n");
228 for (i = 0; i < MAX_ARR; i++) {
229 TESTINST_CONDs("c.ueq.s", i);
230 TESTINST_CONDd("c.ueq.d", i);
233 printf("--- C.OLT.S/D --- if (ordered(fs, ft) or (fs < ft)) then " \
234 "out = fs + ft else out = fs\n");
235 for (i = 0; i < MAX_ARR; i++) {
236 TESTINST_CONDs("c.olt.s", i);
237 TESTINST_CONDd("c.olt.d", i);
240 printf("--- C.ULT.S/D --- if (unordered(fs, ft) or (fs < ft)) then " \
241 "out = fs + ft else out = fs\n");
242 for (i = 0; i < MAX_ARR; i++) {
243 TESTINST_CONDs("c.ult.s", i);
244 TESTINST_CONDd("c.ult.d", i);
247 printf("--- C.OLE.S/D --- if (ordered(fs, ft) or (fs <= ft)) then " \
248 "out = fs + ft else out = fs\n");
249 for (i = 0; i < MAX_ARR; i++) {
250 TESTINST_CONDs("c.ole.s", i);
251 TESTINST_CONDd("c.ole.d", i);
254 printf("--- C.ULE.S/D --- if (unordered(fs, ft) or (fs <= ft)) then " \
255 "out = fs + ft else out = fs\n");
256 for (i = 0; i < MAX_ARR; i++) {
257 TESTINST_CONDs("c.ule.s", i);
258 TESTINST_CONDd("c.ule.d", i);
261 printf("--- C.SF.S/D --- if signaling false then " \
262 "out = fs + ft else out = fs\n");
263 for (i = 0; i < MAX_ARR; i++) {
264 TESTINST_CONDs("c.sf.s", i);
265 TESTINST_CONDd("c.sf.d", i);
268 printf("--- C.NGLE.S/D --- if not ((fs > ft) or (fs <= ft)) then " \
269 "out = fs + ft else out = fs\n");
270 for (i = 0; i < MAX_ARR; i++) {
271 TESTINST_CONDs("c.ngle.s", i);
272 TESTINST_CONDd("c.ngle.d", i);
275 printf("--- C.SEQ.S/D --- if signaling equal then " \
276 "out = fs + ft else out = fs\n");
277 for (i = 0; i < MAX_ARR; i++) {
278 TESTINST_CONDs("c.seq.s", i);
279 TESTINST_CONDd("c.seq.d", i);
282 printf("--- C.NGL.S/D --- if not ((fs > ft) or (fs < ft)) then " \
283 "out = fs + ft else out = fs\n");
284 for (i = 0; i < MAX_ARR; i++) {
285 TESTINST_CONDs("c.ngl.s", i);
286 TESTINST_CONDd("c.ngl.d", i);
289 printf("--- C.LT.S/D --- if fs < ft then " \
290 "out = fs + ft else out = fs\n");
291 for (i = 0; i < MAX_ARR; i++) {
292 TESTINST_CONDs("c.lt.s", i);
293 TESTINST_CONDd("c.lt.d", i);
296 printf("--- C.NGE.S/D --- if not (fs >= ft) then " \
297 "out = fs + ft else out = fs\n");
298 for (i = 0; i < MAX_ARR; i++) {
299 TESTINST_CONDs("c.nge.s", i);
300 TESTINST_CONDd("c.nge.d", i);
303 printf("--- C.LE.S/D --- if fs <= ft then " \
304 "out = fs + ft else out = fs\n");
305 for (i = 0; i < MAX_ARR; i++) {
306 TESTINST_CONDs("c.le.s", i);
307 TESTINST_CONDd("c.le.d", i);
310 printf("--- C.NGT.S/D --- if not (fs > ft) then " \
311 "out = fs + ft else out = fs\n");
312 for (i = 0; i < MAX_ARR; i++) {
313 TESTINST_CONDs("c.ngt.s", i);
314 TESTINST_CONDd("c.ngt.d", i);
316 return 0;
318 #else
319 int main() {
320 return 0;
322 #endif