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 };
41 bar (0xdeadbeefcafebabeULL
, &b
);
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
)))