1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -O0 -mtriple=aarch64-unknown-unknown | FileCheck %s
4 ; Function Attrs: nobuiltin nounwind readonly
5 define i8 @popcount128(ptr nocapture nonnull readonly %0) {
6 ; CHECK-LABEL: popcount128:
7 ; CHECK: // %bb.0: // %Entry
8 ; CHECK-NEXT: ldr q0, [x0]
9 ; CHECK-NEXT: cnt v0.16b, v0.16b
10 ; CHECK-NEXT: uaddlv h1, v0.16b
11 ; CHECK-NEXT: // implicit-def: $q0
12 ; CHECK-NEXT: fmov s0, s1
13 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
14 ; CHECK-NEXT: fmov w0, s0
17 %1 = load i128, ptr %0, align 16
18 %2 = tail call i128 @llvm.ctpop.i128(i128 %1)
19 %3 = trunc i128 %2 to i8
23 ; Function Attrs: nounwind readnone speculatable willreturn
24 declare i128 @llvm.ctpop.i128(i128)
26 ; Function Attrs: nobuiltin nounwind readonly
27 define i16 @popcount256(ptr nocapture nonnull readonly %0) {
28 ; CHECK-LABEL: popcount256:
29 ; CHECK: // %bb.0: // %Entry
30 ; CHECK-NEXT: ldr x11, [x0]
31 ; CHECK-NEXT: ldr x10, [x0, #8]
32 ; CHECK-NEXT: ldr x9, [x0, #16]
33 ; CHECK-NEXT: ldr x8, [x0, #24]
34 ; CHECK-NEXT: // implicit-def: $q1
35 ; CHECK-NEXT: mov v1.d[0], x11
36 ; CHECK-NEXT: mov v1.d[1], x10
37 ; CHECK-NEXT: // implicit-def: $q0
38 ; CHECK-NEXT: mov v0.d[0], x9
39 ; CHECK-NEXT: mov v0.d[1], x8
40 ; CHECK-NEXT: cnt v1.16b, v1.16b
41 ; CHECK-NEXT: uaddlv h2, v1.16b
42 ; CHECK-NEXT: // implicit-def: $q1
43 ; CHECK-NEXT: fmov s1, s2
44 ; CHECK-NEXT: // kill: def $s1 killed $s1 killed $q1
45 ; CHECK-NEXT: mov w10, wzr
46 ; CHECK-NEXT: fmov w0, s1
47 ; CHECK-NEXT: mov w9, w0
48 ; CHECK-NEXT: mov w8, w10
49 ; CHECK-NEXT: bfi x9, x8, #32, #32
50 ; CHECK-NEXT: cnt v0.16b, v0.16b
51 ; CHECK-NEXT: uaddlv h1, v0.16b
52 ; CHECK-NEXT: // implicit-def: $q0
53 ; CHECK-NEXT: fmov s0, s1
54 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
55 ; CHECK-NEXT: fmov w0, s0
56 ; CHECK-NEXT: mov w8, w0
57 ; CHECK-NEXT: // kill: def $x10 killed $w10
58 ; CHECK-NEXT: bfi x8, x10, #32, #32
59 ; CHECK-NEXT: adds x8, x8, x9
60 ; CHECK-NEXT: mov w0, w8
63 %1 = load i256, ptr %0, align 16
64 %2 = tail call i256 @llvm.ctpop.i256(i256 %1)
65 %3 = trunc i256 %2 to i16
69 ; Function Attrs: nounwind readnone speculatable willreturn
70 declare i256 @llvm.ctpop.i256(i256)
72 define <1 x i128> @popcount1x128(<1 x i128> %0) {
73 ; CHECK-LABEL: popcount1x128:
74 ; CHECK: // %bb.0: // %Entry
75 ; CHECK-NEXT: // implicit-def: $q0
76 ; CHECK-NEXT: mov v0.d[0], x0
77 ; CHECK-NEXT: mov v0.d[1], x1
78 ; CHECK-NEXT: cnt v0.16b, v0.16b
79 ; CHECK-NEXT: uaddlv h1, v0.16b
80 ; CHECK-NEXT: // implicit-def: $q0
81 ; CHECK-NEXT: fmov s0, s1
82 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
83 ; CHECK-NEXT: mov w8, wzr
84 ; CHECK-NEXT: fmov w0, s0
85 ; CHECK-NEXT: // kill: def $x0 killed $w0
86 ; CHECK-NEXT: // kill: def $x8 killed $w8
87 ; CHECK-NEXT: bfi x0, x8, #32, #32
88 ; CHECK-NEXT: mov x1, xzr
91 %1 = tail call <1 x i128> @llvm.ctpop.v1.i128(<1 x i128> %0)
95 declare <1 x i128> @llvm.ctpop.v1.i128(<1 x i128>)