Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr116037.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target int128 } */
3 /* { dg-additional-options "-Wno-psabi" } */
4
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;
10
11 VC vc;
12 VS vs;
13 VI vi;
14 VL vl;
15
16 VV
17 foo (unsigned long long x, VV vv)
18 {
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;
28 }
29
30 int
31 main ()
32 {
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 ();
42 }