Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / pr96239.c
blob8af56e12bb4367c7ddf208ede1a326d5af03639e
1 /* PR tree-optimization/96239 */
2 /* { dg-do run { target { ilp32 || lp64 } } } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times " r>> 8;" 1 "optimized" { target bswap } } } */
5 /* { dg-final { scan-tree-dump-times " = __builtin_bswap64 " 1 "optimized" { target bswap } } } */
6 /* { dg-final { scan-tree-dump-not " >> \(8\|16\|24\|32\|40\|48\|56\);" "optimized" { target bswap } } } */
8 typedef unsigned char V __attribute__((vector_size (2)));
9 typedef unsigned char W __attribute__((vector_size (8)));
11 __attribute__((noipa)) void
12 foo (unsigned short x, V *p)
14 *p = (V) { x >> 8, x };
17 __attribute__((noipa)) void
18 bar (unsigned long long x, W *p)
20 *p = (W) { x >> 56, x >> 48, x >> 40, x >> 32, x >> 24, x >> 16, x >> 8, x };
23 __attribute__((noipa)) void
24 baz (unsigned short x, V *p)
26 *p = (V) { x, x >> 8 };
29 __attribute__((noipa)) void
30 qux (unsigned long long x, W *p)
32 *p = (W) { x, x >> 8, x >> 16, x >> 24, x >> 32, x >> 40, x >> 48, x >> 56 };
35 int
36 main ()
38 V a, c, e, g;
39 W b, d, f, h;
40 foo (0xcafe, &a);
41 bar (0xdeadbeefcafebabeULL, &b);
42 baz (0xdead, &c);
43 qux (0xfeedbac1beefdeadULL, &d);
44 e = (V) { 0xca, 0xfe };
45 f = (W) { 0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0xba, 0xbe };
46 g = (V) { 0xad, 0xde };
47 h = (W) { 0xad, 0xde, 0xef, 0xbe, 0xc1, 0xba, 0xed, 0xfe };
48 if (__builtin_memcmp (&a, &e, sizeof (V))
49 || __builtin_memcmp (&b, &f, sizeof (W))
50 || __builtin_memcmp (&c, &g, sizeof (V))
51 || __builtin_memcmp (&d, &h, sizeof (W)))
52 __builtin_abort ();
53 return 0;