Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/popcnt11.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -march=armv8.2-a+sve" } */
3 /* { dg-final { check-function-bodies "**" "" "" } } */
4
5 /*
6 ** f_qi:
7 ** ldr b([0-9]+), \[x0\]
8 ** cnt v\1.8b, v\1.8b
9 ** smov w0, v\1.b\[0\]
10 ** ret
11 */
12 unsigned
13 f_qi (unsigned char *a)
14 {
15 return __builtin_popcountg (a[0]);
16 }
17
18 /*
19 ** f_hi:
20 ** ldr h([0-9]+), \[x0\]
21 ** ptrue (p[0-7]).b, vl8
22 ** cnt z\1.h, \2/m, z\1.h
23 ** smov w0, v\1.h\[0\]
24 ** ret
25 */
26 unsigned
27 f_hi (unsigned short *a)
28 {
29 return __builtin_popcountg (a[0]);
30 }
31
32 /*
33 ** f_si:
34 ** ldr s([0-9]+), \[x0\]
35 ** ptrue (p[0-7]).b, vl8
36 ** cnt z\1.s, \2/m, z\1.s
37 ** umov x0, v\1.d\[0\]
38 ** ret
39 */
40 unsigned
41 f_si (unsigned int *a)
42 {
43 return __builtin_popcountg (a[0]);
44 }
45
46 /*
47 ** f_di:
48 ** ldr d([0-9]+), \[x0\]
49 ** ptrue (p[0-7])\.b, vl8
50 ** cnt z\1\.d, \2/m, z\1\.d
51 ** fmov x0, d\1
52 ** ret
53 */
54 unsigned
55 f_di (unsigned long *a)
56 {
57 return __builtin_popcountg (a[0]);
58 }