Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/popcnt-sve.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -march=armv8.2-a+sve -fno-vect-cost-model -fno-schedule-insns -fno-schedule-insns2" } */
3 /* { dg-final { check-function-bodies "**" "" "" } } */
4
5 /*
6 ** f_v4hi:
7 ** ptrue (p[0-7]).b, vl8
8 ** ldr d([0-9]+), \[x0\]
9 ** cnt z\2.h, \1/m, z\2.h
10 ** str d\2, \[x1\]
11 ** ret
12 */
13 void
14 f_v4hi (unsigned short *__restrict b, unsigned short *__restrict d)
15 {
16 d[0] = __builtin_popcount (b[0]);
17 d[1] = __builtin_popcount (b[1]);
18 d[2] = __builtin_popcount (b[2]);
19 d[3] = __builtin_popcount (b[3]);
20 }
21
22 /*
23 ** f_v8hi:
24 ** ptrue (p[0-7]).b, vl16
25 ** ldr q([0-9]+), \[x0\]
26 ** cnt z\2.h, \1/m, z\2.h
27 ** str q\2, \[x1\]
28 ** ret
29 */
30 void
31 f_v8hi (unsigned short *__restrict b, unsigned short *__restrict d)
32 {
33 d[0] = __builtin_popcount (b[0]);
34 d[1] = __builtin_popcount (b[1]);
35 d[2] = __builtin_popcount (b[2]);
36 d[3] = __builtin_popcount (b[3]);
37 d[4] = __builtin_popcount (b[4]);
38 d[5] = __builtin_popcount (b[5]);
39 d[6] = __builtin_popcount (b[6]);
40 d[7] = __builtin_popcount (b[7]);
41 }
42
43 /*
44 ** f_v2si:
45 ** ptrue (p[0-7]).b, vl8
46 ** ldr d([0-9]+), \[x0\]
47 ** cnt z\2.s, \1/m, z\2.s
48 ** str d\2, \[x1\]
49 ** ret
50 */
51 void
52 f_v2si (unsigned int *__restrict b, unsigned int *__restrict d)
53 {
54 d[0] = __builtin_popcount (b[0]);
55 d[1] = __builtin_popcount (b[1]);
56 }
57
58 /*
59 ** f_v4si:
60 ** ptrue (p[0-7]).b, vl16
61 ** ldr q([0-9]+), \[x0\]
62 ** cnt z\2.s, \1/m, z\2.s
63 ** str q\2, \[x1\]
64 ** ret
65 */
66 void
67 f_v4si (unsigned int *__restrict b, unsigned int *__restrict d)
68 {
69 d[0] = __builtin_popcount (b[0]);
70 d[1] = __builtin_popcount (b[1]);
71 d[2] = __builtin_popcount (b[2]);
72 d[3] = __builtin_popcount (b[3]);
73 }
74
75 /*
76 ** f_v2di:
77 ** ptrue (p[0-7]).b, vl16
78 ** ldr q([0-9]+), \[x0\]
79 ** cnt z\2.d, \1/m, z\2.d
80 ** str q\2, \[x1\]
81 ** ret
82 */
83 void
84 f_v2di (unsigned long *__restrict b, unsigned long *__restrict d)
85 {
86 d[0] = __builtin_popcountll (b[0]);
87 d[1] = __builtin_popcountll (b[1]);
88 }