PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / pr32912-2.c
blobf29e63e70581e528624a2756018f61133c5ebfc4
1 /* { dg-do run } */
2 /* { dg-options "-O2 -w" } */
3 /* { dg-skip-if "TImode not supported" { "avr-*-*" } { "*" } { "" } } */
5 extern void abort (void);
7 #if(__SIZEOF_INT__ >= 4)
8 typedef int __m128i __attribute__ ((__vector_size__ (16)));
9 #else
10 typedef long __m128i __attribute__ ((__vector_size__ (16)));
11 #endif
12 __m128i
13 foo (void)
15 __m128i x = { 0x11111111, 0x22222222, 0x44444444 };
16 return x;
19 __m128i
20 bar (void)
22 __m128i x = { 0x11111111, 0x22222222, 0x44444444 };
23 return ~x;
26 int
27 main (void)
29 #if(__SIZEOF_INT__ >= 4)
30 union { __m128i v; int i[sizeof (__m128i) / sizeof (int)]; } u, v;
31 #else
32 union { __m128i v; long i[sizeof (__m128i) / sizeof (long)]; } u, v;
33 #endif
34 int i;
36 u.v = foo ();
37 v.v = bar ();
38 for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++)
40 if (u.i[i] != ~v.i[i])
41 abort ();
42 if (i < 3)
44 if (u.i[i] != (0x11111111 << i))
45 abort ();
47 else if (u.i[i])
48 abort ();
50 return 0;