Fortran: Fix associate_69.f90 that fails on some platforms [PR115700]
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / simd-1.c
blobfbd3f5ce76999d94d2f3029cde2b76f21f68fac9
1 /* Origin: Aldy Hernandez <aldyh@redhat.com>
3 Purpose: Test generic SIMD support. This test should work
4 regardless of if the target has SIMD instructions.
5 */
7 void abort (void);
8 void exit (int);
10 typedef int __attribute__((mode(SI))) __attribute__((vector_size (16))) vecint;
11 typedef int __attribute__((mode(SI))) siint;
13 vecint i = { 150, 100, 150, 200 };
14 vecint j = { 10, 13, 20, 30 };
15 vecint k;
17 union {
18 vecint v;
19 siint i[4];
20 } res;
22 /* This should go away once we can use == and != on vector types. */
23 void
24 verify (siint a1, siint a2, siint a3, siint a4,
25 siint b1, siint b2, siint b3, siint b4)
27 if (a1 != b1
28 || a2 != b2
29 || a3 != b3
30 || a4 != b4)
31 abort ();
34 int
35 main ()
37 k = i + j;
38 res.v = k;
40 verify (res.i[0], res.i[1], res.i[2], res.i[3], 160, 113, 170, 230);
42 k = i * j;
43 res.v = k;
45 verify (res.i[0], res.i[1], res.i[2], res.i[3], 1500, 1300, 3000, 6000);
47 k = i / j;
48 res.v = k;
50 verify (res.i[0], res.i[1], res.i[2], res.i[3], 15, 7, 7, 6);
52 k = i & j;
53 res.v = k;
55 verify (res.i[0], res.i[1], res.i[2], res.i[3], 2, 4, 20, 8);
57 k = i | j;
58 res.v = k;
60 verify (res.i[0], res.i[1], res.i[2], res.i[3], 158, 109, 150, 222);
62 k = i ^ j;
63 res.v = k;
65 verify (res.i[0], res.i[1], res.i[2], res.i[3], 156, 105, 130, 214);
67 k = -i;
68 res.v = k;
69 verify (res.i[0], res.i[1], res.i[2], res.i[3],
70 -150, -100, -150, -200);
72 k = ~i;
73 res.v = k;
74 verify (res.i[0], res.i[1], res.i[2], res.i[3], -151, -101, -151, -201);
76 exit (0);