OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [mips/] [mips-ps-4.c] - Blame information for rev 321

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 321 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -mpaired-single" } */
3
 
4
/* Test MIPS paired-single comparisons */
5
#include <stdlib.h>
6
#include <stdio.h>
7
 
8
typedef float v2sf __attribute__((vector_size(8)));
9
 
10
NOMIPS16 int test0 (v2sf a, v2sf b);
11
NOMIPS16 int test1 (v2sf a, v2sf b);
12
NOMIPS16 int test2 (v2sf a, v2sf b);
13
NOMIPS16 int test3 (v2sf a, v2sf b);
14
NOMIPS16 int test4 (v2sf a, v2sf b);
15
NOMIPS16 int test5 (v2sf a, v2sf b);
16
NOMIPS16 int test6 (v2sf a, v2sf b);
17
NOMIPS16 int test7 (v2sf a, v2sf b);
18
NOMIPS16 int test8 (v2sf a, v2sf b);
19
NOMIPS16 int test9 (v2sf a, v2sf b);
20
NOMIPS16 int test10 (v2sf a, v2sf b);
21
NOMIPS16 int test11 (v2sf a, v2sf b);
22
NOMIPS16 int test12 (v2sf a, v2sf b);
23
NOMIPS16 int test13 (v2sf a, v2sf b);
24
NOMIPS16 int test14 (v2sf a, v2sf b);
25
NOMIPS16 int test15 (v2sf a, v2sf b);
26
NOMIPS16 int test16 (v2sf a, v2sf b);
27
NOMIPS16 int test17 (v2sf a, v2sf b);
28
NOMIPS16 int test18 (v2sf a, v2sf b);
29
NOMIPS16 int test19 (v2sf a, v2sf b);
30
NOMIPS16 int test20 (v2sf a, v2sf b);
31
NOMIPS16 int test21 (v2sf a, v2sf b);
32
NOMIPS16 int test22 (v2sf a, v2sf b);
33
NOMIPS16 int test23 (v2sf a, v2sf b);
34
NOMIPS16 int test24 (v2sf a, v2sf b);
35
NOMIPS16 int test25 (v2sf a, v2sf b);
36
NOMIPS16 int test26 (v2sf a, v2sf b);
37
NOMIPS16 int test27 (v2sf a, v2sf b);
38
NOMIPS16 int test28 (v2sf a, v2sf b);
39
NOMIPS16 int test29 (v2sf a, v2sf b);
40
NOMIPS16 int test30 (v2sf a, v2sf b);
41
NOMIPS16 int test31 (v2sf a, v2sf b);
42
 
43
float qnan = 1.0f/0.0f - 1.0f/0.0f;
44
 
45
NOMIPS16 int main()
46
{
47
  union { long long ll; int i[2]; } endianness_test;
48
  int little_endian;
49
  v2sf a, b;
50
  int i, j;
51
 
52
  endianness_test.ll = 1;
53
  little_endian = endianness_test.i[0];
54
 
55
  /* Case 1 {diff, diff} */
56
  a = (v2sf) {1, 2};
57
  b = (v2sf) {3, 4};
58
  i = __builtin_mips_upper_c_eq_ps (a, b);
59
  j = __builtin_mips_lower_c_eq_ps (a, b);
60
  if (i != 0 || j != 0)
61
    abort ();
62
 
63
  /* Case 2 {same, diff} */
64
  a = (v2sf) {1.0, 2.0};
65
  b = (v2sf) {1.0, 4.0};
66
  i = __builtin_mips_upper_c_eq_ps (a, b);
67
  j = __builtin_mips_lower_c_eq_ps (a, b);
68
  if (little_endian)
69
    {
70
      if (i != 0 || j != 1)
71
        abort ();
72
    }
73
  else
74
    {
75
      if (i != 1 || j != 0)
76
        abort ();
77
    }
78
 
79
  /* Case 3 {diff, same} */
80
  a = (v2sf) {1, 2};
81
  b = (v2sf) {3, 2};
82
  i = __builtin_mips_upper_c_eq_ps (a, b);
83
  j = __builtin_mips_lower_c_eq_ps (a, b);
84
  if (little_endian)
85
    {
86
      if (i != 1 || j != 0)
87
        abort ();
88
    }
89
  else
90
    {
91
      if (i != 0 || j != 1)
92
        abort ();
93
    }
94
 
95
  /* Case 4 {same, same} */
96
  a = (v2sf) {1, 2};
97
  b = (v2sf) {1, 2};
98
  i = __builtin_mips_upper_c_eq_ps (a, b);
99
  j = __builtin_mips_lower_c_eq_ps (a, b);
100
  if (i != 1 || j != 1)
101
    abort ();
102
 
103
  /* Test upper/lower with 16 operators */
104
  if (little_endian)
105
   {
106
     a = (v2sf) {1984.0, 10.58};
107
     b = (v2sf) {1984.0, 567.345};
108
   }
109
  else
110
   {
111
     a = (v2sf) {10.58, 1984.0};
112
     b = (v2sf) {567.345, 1984.0};
113
   }
114
 
115
  i = test0 (a, b);
116
  if (i != 0)
117
    abort ();
118
  i = test1 (a, b);
119
  if (i != 0)
120
    abort ();
121
  i = test2 (a, b);
122
  if (i != 0)
123
    abort ();
124
  i = test3 (a, b);
125
  if (i != 0)
126
    abort ();
127
  i = test4 (a, b);
128
  if (i != 0)
129
    abort ();
130
  i = test5 (a, b);
131
  if (i != 1)
132
    abort ();
133
  i = test6 (a, b);
134
  if (i != 0)
135
    abort ();
136
  i = test7 (a, b);
137
  if (i != 1)
138
    abort ();
139
  i = test8 (a, b);
140
  if (i != 1)
141
    abort ();
142
  i = test9 (a, b);
143
  if (i != 0)
144
    abort ();
145
  i = test10 (a, b);
146
  if (i != 1)
147
    abort ();
148
  i = test11 (a, b);
149
  if (i != 0)
150
    abort ();
151
  i = test12 (a, b);
152
  if (i != 1)
153
    abort ();
154
  i = test13 (a, b);
155
  if (i != 1)
156
    abort ();
157
  i = test14 (a, b);
158
  if (i != 1)
159
    abort ();
160
  i = test15 (a, b);
161
  if (i != 1)
162
    abort ();
163
  i = test16 (a, b);
164
  if (i != 0)
165
    abort ();
166
  i = test17 (a, b);
167
  if (i != 0)
168
    abort ();
169
  i = test18 (a, b);
170
  if (i != 0)
171
    abort ();
172
  i = test19 (a, b);
173
  if (i != 0)
174
    abort ();
175
  i = test20 (a, b);
176
  if (i != 0)
177
    abort ();
178
  i = test21 (a, b);
179
  if (i != 1)
180
    abort ();
181
  i = test22 (a, b);
182
  if (i != 0)
183
    abort ();
184
  i = test23 (a, b);
185
  if (i != 1)
186
    abort ();
187
  i = test24 (a, b);
188
  if (i != 1)
189
    abort ();
190
  i = test25 (a, b);
191
  if (i != 0)
192
    abort ();
193
  i = test26 (a, b);
194
  if (i != 1)
195
    abort ();
196
  i = test27 (a, b);
197
  if (i != 0)
198
    abort ();
199
  i = test28 (a, b);
200
  if (i != 1)
201
    abort ();
202
  i = test29 (a, b);
203
  if (i != 1)
204
    abort ();
205
  i = test30 (a, b);
206
  if (i != 1)
207
    abort ();
208
  i = test31 (a, b);
209
  if (i != 1)
210
    abort ();
211
 
212
  /* Reverse arguments */
213
  i = test0 (b, a);
214
  if (i != 0)
215
    abort ();
216
  i = test1 (b, a);
217
  if (i != 0)
218
    abort ();
219
  i = test2 (b, a);
220
  if (i != 0)
221
    abort ();
222
  i = test3 (b, a);
223
  if (i != 0)
224
    abort ();
225
  i = test4 (b, a);
226
  if (i != 0)
227
    abort ();
228
  i = test5 (b, a);
229
  if (i != 1)
230
    abort ();
231
  i = test6 (b, a);
232
  if (i != 0)
233
    abort ();
234
  i = test7 (b, a);
235
  if (i != 1)
236
    abort ();
237
  i = test8 (b, a);
238
  if (i != 0)
239
    abort ();
240
  i = test9 (b, a);
241
  if (i != 0)
242
    abort ();
243
  i = test10 (b, a);
244
  if (i != 0)
245
    abort ();
246
  i = test11 (b, a);
247
  if (i != 0)
248
    abort ();
249
  i = test12 (b, a);
250
  if (i != 0)
251
    abort ();
252
  i = test13 (b, a);
253
  if (i != 1)
254
    abort ();
255
  i = test14 (b, a);
256
  if (i != 0)
257
    abort ();
258
  i = test15 (b, a);
259
  if (i != 1)
260
    abort ();
261
  i = test16 (b, a);
262
  if (i != 0)
263
    abort ();
264
  i = test17 (b, a);
265
  if (i != 0)
266
    abort ();
267
  i = test18 (b, a);
268
  if (i != 0)
269
    abort ();
270
  i = test19 (b, a);
271
  if (i != 0)
272
    abort ();
273
  i = test20 (b, a);
274
  if (i != 0)
275
    abort ();
276
  i = test21 (b, a);
277
  if (i != 1)
278
    abort ();
279
  i = test22 (b, a);
280
  if (i != 0)
281
    abort ();
282
  i = test23 (b, a);
283
  if (i != 1)
284
    abort ();
285
  i = test24 (b, a);
286
  if (i != 0)
287
    abort ();
288
  i = test25 (b, a);
289
  if (i != 0)
290
    abort ();
291
  i = test26 (b, a);
292
  if (i != 0)
293
    abort ();
294
  i = test27 (b, a);
295
  if (i != 0)
296
    abort ();
297
  i = test28 (b, a);
298
  if (i != 0)
299
    abort ();
300
  i = test29 (b, a);
301
  if (i != 1)
302
    abort ();
303
  i = test30 (b, a);
304
  if (i != 0)
305
    abort ();
306
  i = test31 (b, a);
307
  if (i != 1)
308
    abort ();
309
 
310
#ifndef __FAST_MATH__
311
  /* Test upper/lower with 16 operators */
312
  if (little_endian)
313
   {
314
     a = (v2sf) {qnan, qnan};
315
     b = (v2sf) {1984.0, 567.345};
316
   }
317
  else
318
   {
319
     a = (v2sf) {qnan, qnan};
320
     b = (v2sf) {567.345, 1984.0};
321
   }
322
 
323
  i = test0 (a, b);
324
  if (i != 0)
325
    abort ();
326
  i = test1 (a, b);
327
  if (i != 0)
328
    abort ();
329
  i = test2 (a, b);
330
  if (i != 1)
331
    abort ();
332
  i = test3 (a, b);
333
  if (i != 1)
334
    abort ();
335
  i = test4 (a, b);
336
  if (i != 0)
337
    abort ();
338
  i = test5 (a, b);
339
  if (i != 0)
340
    abort ();
341
  i = test6 (a, b);
342
  if (i != 1)
343
    abort ();
344
  i = test7 (a, b);
345
  if (i != 1)
346
    abort ();
347
  i = test8 (a, b);
348
  if (i != 0)
349
    abort ();
350
  i = test9 (a, b);
351
  if (i != 0)
352
    abort ();
353
  i = test10 (a, b);
354
  if (i != 1)
355
    abort ();
356
  i = test11 (a, b);
357
  if (i != 1)
358
    abort ();
359
  i = test12 (a, b);
360
  if (i != 0)
361
    abort ();
362
  i = test13 (a, b);
363
  if (i != 0)
364
    abort ();
365
  i = test14 (a, b);
366
  if (i != 1)
367
    abort ();
368
  i = test15 (a, b);
369
  if (i != 1)
370
    abort ();
371
  i = test16 (a, b);
372
  if (i != 0)
373
    abort ();
374
  i = test17 (a, b);
375
  if (i != 0)
376
    abort ();
377
  i = test18 (a, b);
378
  if (i != 1)
379
    abort ();
380
  i = test19 (a, b);
381
  if (i != 1)
382
    abort ();
383
  i = test20 (a, b);
384
  if (i != 0)
385
    abort ();
386
  i = test21 (a, b);
387
  if (i != 0)
388
    abort ();
389
  i = test22 (a, b);
390
  if (i != 1)
391
    abort ();
392
  i = test23 (a, b);
393
  if (i != 1)
394
    abort ();
395
  i = test24 (a, b);
396
  if (i != 0)
397
    abort ();
398
  i = test25 (a, b);
399
  if (i != 0)
400
    abort ();
401
  i = test26 (a, b);
402
  if (i != 1)
403
    abort ();
404
  i = test27 (a, b);
405
  if (i != 1)
406
    abort ();
407
  i = test28 (a, b);
408
  if (i != 0)
409
    abort ();
410
  i = test29 (a, b);
411
  if (i != 0)
412
    abort ();
413
  i = test30 (a, b);
414
  if (i != 1)
415
    abort ();
416
  i = test31 (a, b);
417
  if (i != 1)
418
    abort ();
419
#endif
420
 
421
  printf ("Test Passes\n");
422
  exit (0);
423
}
424
 
425
NOMIPS16 int test0 (v2sf a, v2sf b)
426
{
427
  return __builtin_mips_upper_c_f_ps (a, b);
428
}
429
 
430
NOMIPS16 int test1 (v2sf a, v2sf b)
431
{
432
  return __builtin_mips_lower_c_f_ps (a, b);
433
}
434
 
435
NOMIPS16 int test2 (v2sf a, v2sf b)
436
{
437
  return __builtin_mips_upper_c_un_ps (a, b);
438
}
439
 
440
NOMIPS16 int test3 (v2sf a, v2sf b)
441
{
442
  return __builtin_mips_lower_c_un_ps (a, b);
443
}
444
 
445
NOMIPS16 int test4 (v2sf a, v2sf b)
446
{
447
  return __builtin_mips_upper_c_eq_ps (a, b);
448
}
449
 
450
NOMIPS16 int test5 (v2sf a, v2sf b)
451
{
452
  return __builtin_mips_lower_c_eq_ps (a, b);
453
}
454
 
455
NOMIPS16 int test6 (v2sf a, v2sf b)
456
{
457
  return __builtin_mips_upper_c_ueq_ps (a, b);
458
}
459
 
460
NOMIPS16 int test7 (v2sf a, v2sf b)
461
{
462
  return __builtin_mips_lower_c_ueq_ps (a, b);
463
}
464
 
465
NOMIPS16 int test8 (v2sf a, v2sf b)
466
{
467
  return __builtin_mips_upper_c_olt_ps (a, b);
468
}
469
 
470
NOMIPS16 int test9 (v2sf a, v2sf b)
471
{
472
  return __builtin_mips_lower_c_olt_ps (a, b);
473
}
474
 
475
NOMIPS16 int test10 (v2sf a, v2sf b)
476
{
477
  return __builtin_mips_upper_c_ult_ps (a, b);
478
}
479
 
480
NOMIPS16 int test11 (v2sf a, v2sf b)
481
{
482
  return __builtin_mips_lower_c_ult_ps (a, b);
483
}
484
 
485
NOMIPS16 int test12 (v2sf a, v2sf b)
486
{
487
  return __builtin_mips_upper_c_ole_ps (a, b);
488
}
489
 
490
NOMIPS16 int test13 (v2sf a, v2sf b)
491
{
492
  return __builtin_mips_lower_c_ole_ps (a, b);
493
}
494
 
495
NOMIPS16 int test14 (v2sf a, v2sf b)
496
{
497
  return __builtin_mips_upper_c_ule_ps (a, b);
498
}
499
 
500
NOMIPS16 int test15 (v2sf a, v2sf b)
501
{
502
  return __builtin_mips_lower_c_ule_ps (a, b);
503
}
504
 
505
NOMIPS16 int test16 (v2sf a, v2sf b)
506
{
507
  return __builtin_mips_upper_c_sf_ps (a, b);
508
}
509
 
510
NOMIPS16 int test17 (v2sf a, v2sf b)
511
{
512
  return __builtin_mips_lower_c_sf_ps (a, b);
513
}
514
 
515
NOMIPS16 int test18 (v2sf a, v2sf b)
516
{
517
  return __builtin_mips_upper_c_ngle_ps (a, b);
518
}
519
 
520
NOMIPS16 int test19 (v2sf a, v2sf b)
521
{
522
  return __builtin_mips_lower_c_ngle_ps (a, b);
523
}
524
 
525
NOMIPS16 int test20 (v2sf a, v2sf b)
526
{
527
  return __builtin_mips_upper_c_seq_ps (a, b);
528
}
529
 
530
NOMIPS16 int test21 (v2sf a, v2sf b)
531
{
532
  return __builtin_mips_lower_c_seq_ps (a, b);
533
}
534
 
535
NOMIPS16 int test22 (v2sf a, v2sf b)
536
{
537
  return __builtin_mips_upper_c_ngl_ps (a, b);
538
}
539
 
540
NOMIPS16 int test23 (v2sf a, v2sf b)
541
{
542
  return __builtin_mips_lower_c_ngl_ps (a, b);
543
}
544
 
545
NOMIPS16 int test24 (v2sf a, v2sf b)
546
{
547
  return __builtin_mips_upper_c_lt_ps (a, b);
548
}
549
 
550
NOMIPS16 int test25 (v2sf a, v2sf b)
551
{
552
  return __builtin_mips_lower_c_lt_ps (a, b);
553
}
554
 
555
NOMIPS16 int test26 (v2sf a, v2sf b)
556
{
557
  return __builtin_mips_upper_c_nge_ps (a, b);
558
}
559
 
560
NOMIPS16 int test27 (v2sf a, v2sf b)
561
{
562
  return __builtin_mips_lower_c_nge_ps (a, b);
563
}
564
 
565
NOMIPS16 int test28 (v2sf a, v2sf b)
566
{
567
  return __builtin_mips_upper_c_le_ps (a, b);
568
}
569
 
570
NOMIPS16 int test29 (v2sf a, v2sf b)
571
{
572
  return __builtin_mips_lower_c_le_ps (a, b);
573
}
574
 
575
NOMIPS16 int test30 (v2sf a, v2sf b)
576
{
577
  return __builtin_mips_upper_c_ngt_ps (a, b);
578
}
579
 
580
NOMIPS16 int test31 (v2sf a, v2sf b)
581
{
582
  return __builtin_mips_lower_c_ngt_ps (a, b);
583
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.