Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr117811.c

raw
1 /* { dg-do run } */
2
3 #include <string.h>
4
5 typedef int v4 __attribute__((vector_size (4 * sizeof (int))));
6
7 void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift)
8 {
9 v4 t = *vec;
10
11 if (shift > 0)
12 {
13 t = t >> shift;
14 }
15
16 *vec = t;
17 }
18
19 int main ()
20 {
21 #if __SIZEOF_INT__ >= 4
22 v4 vec = {0x1000000, 0x2000, 0x300, 0x40};
23 v4 vec2 = {0x100000, 0x200, 0x30, 0x4};
24 #else
25 v4 vec = {0x4000, 0x2000, 0x300, 0x40};
26 v4 vec2 = {0x400, 0x200, 0x30, 0x4};
27 #endif
28 do_shift (&vec, 4);
29 if (memcmp (&vec, &vec2, sizeof (v4)) != 0)
30 __builtin_abort ();
31 return 0;
32 }