OSDN Git Service

* gcc.c-torture/execute/960321-1.x: Remove.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / simd-5.c
1 /* Test saving and restoring of SIMD registers.  */
2
3 typedef short Q __attribute__((vector_size(8)));
4
5 Q q1 = {1, 2}, q2 = {3, 4}, q3 = {5, 6}, q4 = {7, 8};
6
7 Q w1, w2, w3, w4;
8 Q z1, z2, z3, z4;
9
10 volatile int dummy;
11
12 void  __attribute__((__noinline__))
13 func0 (void)
14 {
15   dummy = 1;
16 }
17
18 void __attribute__((__noinline__))
19 func1 (void)
20 {
21   Q a, b;
22   a = q1 * q2;
23   b = q3 * q4;
24   w1 = a;
25   w2 = b;
26   func0 ();
27   w3 = a;
28   w4 = b;
29 }
30
31 void __attribute__((__noinline__))
32 func2 (void)
33 {
34   Q a, b;
35   a = q1 + q2;
36   b = q3 - q4;
37   z1 = a;
38   z2 = b;
39   func1 ();
40   z3 = a;
41   z4 = b;
42 }
43
44 int
45 main (void)
46 {
47   func2 ();
48
49   if (memcmp (&w1, &w3, sizeof (Q)) != 0)
50     abort ();
51   if (memcmp (&w2, &w4, sizeof (Q)) != 0)
52     abort ();
53   if (memcmp (&z1, &z3, sizeof (Q)) != 0)
54     abort ();
55   if (memcmp (&z2, &z4, sizeof (Q)) != 0)
56     abort ();
57
58   return 0;
59 }