Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr91824-1.c

raw
1 /* PR target/91824 */
2 /* { dg-do compile { target lp64 } } */
3 /* { dg-options "-O2 -mpopcnt" } */
4 /* { dg-final { scan-assembler-not "cltq" } } */
5
6 unsigned int foo (void);
7
8 unsigned long
9 f1 (unsigned int x)
10 {
11 return __builtin_popcount (x);
12 }
13
14 unsigned long
15 f2 (unsigned int x)
16 {
17 return (unsigned) __builtin_popcount (x);
18 }
19
20 unsigned long
21 f3 (unsigned int x)
22 {
23 return __builtin_popcount (x) & 63ULL;
24 }
25
26 unsigned long
27 f4 (unsigned int x)
28 {
29 return __builtin_popcount (x) & 1023ULL;
30 }
31
32 unsigned long
33 f5 (void)
34 {
35 return __builtin_popcount (foo ());
36 }
37
38 unsigned long
39 f6 (void)
40 {
41 return (unsigned) __builtin_popcount (foo ());
42 }
43
44 unsigned long
45 f7 (void)
46 {
47 return __builtin_popcount (foo ()) & 63ULL;
48 }
49
50 unsigned long
51 f8 (void)
52 {
53 return __builtin_popcount (foo ()) & 1023ULL;
54 }