libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / pr101384.c
blob7030c0a481e6326fa14884397782901f3a836cc7
1 /* PR target/101384 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -Wno-psabi -w" } */
5 typedef unsigned char __attribute__((__vector_size__ (16))) U;
6 typedef unsigned short __attribute__((__vector_size__ (8 * sizeof (short)))) V;
8 U u;
9 V v;
11 __attribute__((noipa)) U
12 foo (void)
14 U y = (U) { 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff,
15 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff } + u;
16 return y;
19 __attribute__((noipa)) V
20 bar (void)
22 V y = (V) { 0x8000, 0xffff, 0x8000, 0xffff,
23 0x8000, 0xffff, 0x8000, 0xffff } + v;
24 return y;
27 int
28 main ()
30 U x = foo ();
31 for (unsigned i = 0; i < 16; i++)
32 if (x[i] != ((i & 3) ? 0xff : 0x80))
33 __builtin_abort ();
34 V y = bar ();
35 for (unsigned i = 0; i < 8; i++)
36 if (y[i] != ((i & 1) ? 0xffff : 0x8000))
37 __builtin_abort ();
38 return 0;