diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-popcount-11.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/fold-popcount-11.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/fold-popcount-11.c b/gcc/testsuite/gcc.dg/fold-popcount-11.c new file mode 100644 index 0000000..e59be00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/fold-popcount-11.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int foo(unsigned short x) +{ + unsigned short t1 = __builtin_bswap16(x); + unsigned int t2 = t1; + return __builtin_popcount (t2); +} + +int fool(unsigned short x) +{ + unsigned short t1 = __builtin_bswap16(x); + unsigned long t2 = t1; + return __builtin_popcountl (t2); +} + +int fooll(unsigned short x) +{ + unsigned short t1 = __builtin_bswap16(x); + unsigned long long t2 = t1; + return __builtin_popcountll (t2); +} + +/* { dg-final { scan-tree-dump-not "bswap" "optimized" } } */ |