Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / optimize-bswapsi-7.c
blob1e4db5e48189a01f197dac036a5ed9c1dc810e13
1 /* PR tree-optimization/103376 */
2 /* { dg-do compile } */
3 /* { dg-require-effective-target bswap } */
4 /* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-optimized" } */
5 /* { dg-additional-options "-march=z900" { target s390-*-* } } */
7 static unsigned int
8 f1 (unsigned int x)
10 return (x << 24) | (x >> 8);
13 unsigned int
14 f2 (unsigned *p)
16 return ((f1 (p[0]) | (p[0] >> 8)) & 0xff000000U) | (p[0] >> 24) | ((p[0] & 0xff00U) << 8) | ((p[0] & 0xff0000U) >> 8);
19 unsigned int
20 f3 (unsigned *p)
22 return ((f1 (p[0]) | (p[0] & 0x00ff00ffU)) & 0xff00ff00U) | (f1 (f1 (f1 (p[0]))) & 0x00ff00ffU);
25 unsigned int
26 f4 (unsigned *p)
28 return (f1 (p[0]) ^ (p[0] >> 8)) ^ (p[0] >> 24) ^ ((p[0] & 0xff00U) << 8) ^ ((p[0] & 0xff0000U) >> 8);
31 unsigned int
32 f5 (unsigned *p)
34 return (((f1 (p[0]) | (p[0] >> 16)) ^ (p[0] >> 8)) & 0xffff0000U) ^ (p[0] >> 24) ^ ((p[0] & 0xff00U) << 8) ^ ((p[0] & 0xff0000U) >> 8);
37 /* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 4 "optimized" } } */