* es.po: Update.
[official-gcc.git] / gcc / testsuite / gcc.dg / pr48616.c
blob4517d79211903f26567fd5b30f122f72c07a2bde
1 /* PR tree-optimization/48616 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -ftree-vectorize" } */
4 /* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */
6 extern void abort (void);
7 int a[4] __attribute__((aligned (32)));
8 int b[4] __attribute__((aligned (32)));
9 int c[4] __attribute__((aligned (32)));
10 int d[4] __attribute__((aligned (32)));
11 int e[4] __attribute__((aligned (32)));
13 __attribute__((noinline, noclone))
14 int
15 foo (int x)
17 asm ("" : "+r" (x));
18 return x;
21 __attribute__((noinline, noclone))
22 void
23 fn1 (int i)
25 a[0] = b[0] << c[0];
26 a[1] = b[1] << c[1];
27 a[2] = b[2] << c[2];
28 a[3] = b[3] << c[3];
29 if (i)
31 d[0] = e[0] >> c[0];
32 d[1] = e[1] >> c[1];
33 d[2] = e[2] >> c[2];
34 d[3] = e[3] >> c[3];
38 __attribute__((noinline, noclone))
39 void
40 fn2 (int i)
42 a[0] = b[0] << 1;
43 a[1] = b[1] << 2;
44 a[2] = b[2] << 3;
45 a[3] = b[3] << 4;
46 if (i)
48 d[0] = e[0] >> 1;
49 d[1] = e[1] >> 2;
50 d[2] = e[2] >> 3;
51 d[3] = e[3] >> 4;
55 __attribute__((noinline, noclone))
56 void
57 fn3 (int i, int j)
59 int x = foo (j);
60 a[0] = b[0] << x;
61 a[1] = b[1] << x;
62 a[2] = b[2] << x;
63 a[3] = b[3] << x;
64 if (i)
66 d[0] = e[0] >> x;
67 d[1] = e[1] >> x;
68 d[2] = e[2] >> x;
69 d[3] = e[3] >> x;
73 __attribute__((noinline, noclone))
74 void
75 fn4 (int i)
77 a[0] = b[0] << 1;
78 a[1] = b[1] << 1;
79 a[2] = b[2] << 1;
80 a[3] = b[3] << 1;
81 if (i)
83 d[0] = e[0] >> 1;
84 d[1] = e[1] >> 1;
85 d[2] = e[2] >> 1;
86 d[3] = e[3] >> 1;
90 int
91 main ()
93 int i;
94 int *t;
95 for (i = 0; i < 4; i++)
97 b[i] = 32;
98 c[i] = i + 1;
99 e[i] = 32;
101 asm volatile ("" : : "r" (b) : "memory");
102 asm volatile ("" : : "r" (c) : "memory");
103 asm volatile ("" : "=r" (t) : "0" (d) : "memory");
104 fn1 (t != 0);
105 for (i = 0; i < 4; i++)
107 if (a[i] != (32 << (i + 1)) || d[i] != (32 >> (i + 1)))
108 abort ();
109 a[i] = 0;
110 d[i] = 0;
112 fn2 (t != 0);
113 for (i = 0; i < 4; i++)
115 if (a[i] != (32 << (i + 1)) || d[i] != (32 >> (i + 1)))
116 abort ();
117 a[i] = 0;
118 d[i] = 0;
120 fn3 (t != 0, t != 0);
121 for (i = 0; i < 4; i++)
123 if (a[i] != (32 << 1) || d[i] != (32 >> 1))
124 abort ();
125 a[i] = 0;
126 d[i] = 0;
128 fn4 (t != 0);
129 for (i = 0; i < 4; i++)
131 if (a[i] != (32 << 1) || d[i] != (32 >> 1))
132 abort ();
134 return 0;