libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr116037.c
blob5bab24107fc2a330773099f15e5e6e459aebae5a
1 /* { dg-do run } */
2 /* { dg-require-effective-target int128 } */
3 /* { dg-additional-options "-Wno-psabi" } */
5 typedef __attribute__((__vector_size__ (64))) unsigned char VC;
6 typedef __attribute__((__vector_size__ (64))) unsigned short VS;
7 typedef __attribute__((__vector_size__ (64))) unsigned int VI;
8 typedef __attribute__((__vector_size__ (64))) unsigned long long VL;
9 typedef __attribute__((__vector_size__ (64))) unsigned __int128 VV;
11 VC vc;
12 VS vs;
13 VI vi;
14 VL vl;
17 foo (unsigned long long x, VV vv)
19 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
20 x &= -((VC) vv)[0];
21 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
22 x &= -((VC) vv)[sizeof (__int128) - 1];
23 #else
24 x &= -(unsigned char) (vv[0]);
25 #endif
26 vi *= (VI) (VS){ -vs[0], vc[0], vs[1], vi[7], vs[7], vl[7], x, vi[5] };
27 return x + vv;
30 int
31 main ()
33 VV v = foo (0x01aabbccdd, (VV) { -0xff });
34 if (v[0] != 0x01aabbccdd - 0xff)
35 __builtin_abort ();
36 if (v[1] != 0x01aabbccdd)
37 __builtin_abort ();
38 if (v[2] != 0x01aabbccdd)
39 __builtin_abort ();
40 if (v[3] != 0x01aabbccdd)
41 __builtin_abort ();