2014-04-14 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / vec-may_alias.c
blobe970497454f93e91de1dea0de51650a5d0da95eb
1 /* { dg-do run } */
2 /* { dg-options "-O2 -w -Wno-abi" } */
4 typedef int v2si __attribute__ ((vector_size (8)));
5 typedef short v4hi __attribute__ ((vector_size (8)));
6 typedef short v4hia __attribute__ ((vector_size (8), may_alias));
8 __attribute__ ((noinline, noclone))
9 int f (v2si A, int N)
10 { return ((v4hia)A)[N]; }
12 __attribute__ ((noinline, noclone))
13 int g (v2si A, int N)
14 { return ((v4hi)A)[N]; }
16 int main()
18 v2si x = { 0, 0 }, y = { 1, 1 };
19 if (f (x, 0) || f (x, 1) || f (x, 2) || f (x, 3))
20 __builtin_abort ();
21 if (g (y, 0) != 1 || g (y, 1) || g (y, 2) != 1 || g (y, 3))
22 __builtin_abort ();
23 return 0;