Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/popcnt.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mlsx" } */
3 /* { dg-final { scan-assembler-not {popcount} } } */
4 /* { dg-final { scan-assembler-times "vpcnt.d" 2 { target { loongarch64*-*-* } } } } */
5 /* { dg-final { scan-assembler-times "vpcnt.w" 4 { target { loongarch64*-*-* } } } } */
6
7 int
8 foo (int x)
9 {
10 return __builtin_popcount (x);
11 }
12
13 long
14 foo1 (long x)
15 {
16 return __builtin_popcountl (x);
17 }
18
19 long long
20 foo2 (long long x)
21 {
22 return __builtin_popcountll (x);
23 }
24
25 int
26 foo3 (int *p)
27 {
28 return __builtin_popcount (*p);
29 }
30
31 unsigned
32 foo4 (int x)
33 {
34 return __builtin_popcount (x);
35 }
36
37 unsigned long
38 foo5 (int x)
39 {
40 return __builtin_popcount (x);
41 }