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 h0, v0.16b
11 ; CHECK-NEXT: // kill: def $q0 killed $h0
12 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
13 ; CHECK-NEXT: fmov w0, s0
16 %1 = load i128, ptr %0, align 16
17 %2 = tail call i128 @llvm.ctpop.i128(i128 %1)
18 %3 = trunc i128 %2 to i8
22 ; Function Attrs: nounwind readnone speculatable willreturn
23 declare i128 @llvm.ctpop.i128(i128)
25 ; Function Attrs: nobuiltin nounwind readonly
26 define i16 @popcount256(ptr nocapture nonnull readonly %0) {
27 ; CHECK-LABEL: popcount256:
28 ; CHECK: // %bb.0: // %Entry
29 ; CHECK-NEXT: ldr x11, [x0]
30 ; CHECK-NEXT: ldr x10, [x0, #8]
31 ; CHECK-NEXT: ldr x9, [x0, #16]
32 ; CHECK-NEXT: ldr x8, [x0, #24]
33 ; CHECK-NEXT: // implicit-def: $q1
34 ; CHECK-NEXT: mov v1.d[0], x11
35 ; CHECK-NEXT: mov v1.d[1], x10
36 ; CHECK-NEXT: // implicit-def: $q0
37 ; CHECK-NEXT: mov v0.d[0], x9
38 ; CHECK-NEXT: mov v0.d[1], x8
39 ; CHECK-NEXT: cnt v1.16b, v1.16b
40 ; CHECK-NEXT: uaddlv h1, v1.16b
41 ; CHECK-NEXT: // kill: def $q1 killed $h1
42 ; CHECK-NEXT: // kill: def $s1 killed $s1 killed $q1
43 ; CHECK-NEXT: fmov w0, s1
44 ; CHECK-NEXT: mov w10, wzr
45 ; CHECK-NEXT: mov w9, w0
46 ; CHECK-NEXT: mov w8, w10
47 ; CHECK-NEXT: bfi x9, x8, #32, #32
48 ; CHECK-NEXT: cnt v0.16b, v0.16b
49 ; CHECK-NEXT: uaddlv h0, v0.16b
50 ; CHECK-NEXT: // kill: def $q0 killed $h0
51 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
52 ; CHECK-NEXT: fmov w0, s0
53 ; CHECK-NEXT: mov w8, w0
54 ; CHECK-NEXT: // kill: def $x10 killed $w10
55 ; CHECK-NEXT: bfi x8, x10, #32, #32
56 ; CHECK-NEXT: adds x8, x8, x9
57 ; CHECK-NEXT: mov w0, w8
60 %1 = load i256, ptr %0, align 16
61 %2 = tail call i256 @llvm.ctpop.i256(i256 %1)
62 %3 = trunc i256 %2 to i16
66 ; Function Attrs: nounwind readnone speculatable willreturn
67 declare i256 @llvm.ctpop.i256(i256)
69 define <1 x i128> @popcount1x128(<1 x i128> %0) {
70 ; CHECK-LABEL: popcount1x128:
71 ; CHECK: // %bb.0: // %Entry
72 ; CHECK-NEXT: // implicit-def: $q0
73 ; CHECK-NEXT: mov v0.d[0], x0
74 ; CHECK-NEXT: mov v0.d[1], x1
75 ; CHECK-NEXT: cnt v0.16b, v0.16b
76 ; CHECK-NEXT: uaddlv h0, v0.16b
77 ; CHECK-NEXT: // kill: def $q0 killed $h0
78 ; CHECK-NEXT: mov x1, xzr
79 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
80 ; CHECK-NEXT: fmov w0, s0
81 ; CHECK-NEXT: mov w8, wzr
82 ; CHECK-NEXT: // kill: def $x0 killed $w0
83 ; CHECK-NEXT: // kill: def $x8 killed $w8
84 ; CHECK-NEXT: bfi x0, x8, #32, #32
87 %1 = tail call <1 x i128> @llvm.ctpop.v1.i128(<1 x i128> %0)
91 declare <1 x i128> @llvm.ctpop.v1.i128(<1 x i128>)