aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-popcount-11.c
blob: e59be003abb7b883679786005f4949ce9e4ba0d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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" } } */