1 ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple | FileCheck %s
2 ; RUN: llc < %s -mtriple=aarch64-eabi -mattr -neon -aarch64-neon-syntax=apple | FileCheck -check-prefix=CHECK-NONEON %s
4 define i32 @cnt32_advsimd(i32 %x) nounwind readnone {
5 %cnt = tail call i32 @llvm.ctpop.i32(i32 %x)
7 ; CHECK: mov w[[IN64:[0-9]+]], w0
8 ; CHECK: fmov d0, x[[IN64]]
10 ; CHECK: uaddlv.8b h0, v0
13 ; CHECK-NONEON-LABEL: cnt32_advsimd
14 ; CHECK-NONEON-NOT: 8b
15 ; CHECK-NONEON: and w{{[0-9]+}}, w{{[0-9]+}}, #0x55555555
16 ; CHECK-NONEON: and w{{[0-9]+}}, w{{[0-9]+}}, #0x33333333
17 ; CHECK-NONEON: and w{{[0-9]+}}, w{{[0-9]+}}, #0xf0f0f0f
21 define i32 @cnt32_advsimd_2(<2 x i32> %x) {
22 %1 = extractelement <2 x i32> %x, i64 0
23 %2 = tail call i32 @llvm.ctpop.i32(i32 %1)
27 ; CHECK: cnt.8b v0, v0
28 ; CHECK: uaddlv.8b h0, v0
31 ; CHECK-NONEON-LABEL: cnt32_advsimd_2
32 ; CHECK-NONEON-NOT: 8b
33 ; CHECK-NONEON: and w{{[0-9]+}}, w{{[0-9]+}}, #0x55555555
34 ; CHECK-NONEON: and w{{[0-9]+}}, w{{[0-9]+}}, #0x33333333
35 ; CHECK-NONEON: and w{{[0-9]+}}, w{{[0-9]+}}, #0xf0f0f0f
39 define i64 @cnt64_advsimd(i64 %x) nounwind readnone {
40 %cnt = tail call i64 @llvm.ctpop.i64(i64 %x)
43 ; CHECK: cnt.8b v0, v0
44 ; CHECK: uaddlv.8b h0, v0
47 ; CHECK-NONEON-LABEL: cnt64_advsimd
48 ; CHECK-NONEON-NOT: 8b
49 ; CHECK-NONEON: and x{{[0-9]+}}, x{{[0-9]+}}, #0x5555555555555555
50 ; CHECK-NONEON: and x{{[0-9]+}}, x{{[0-9]+}}, #0x3333333333333333
51 ; CHECK-NONEON: and x{{[0-9]+}}, x{{[0-9]+}}, #0xf0f0f0f0f0f0f0f
55 ; Do not use AdvSIMD when -mno-implicit-float is specified.
58 define i32 @cnt32(i32 %x) nounwind readnone noimplicitfloat {
59 %cnt = tail call i32 @llvm.ctpop.i32(i32 %x)
66 define i64 @cnt64(i64 %x) nounwind readnone noimplicitfloat {
67 %cnt = tail call i64 @llvm.ctpop.i64(i64 %x)
74 declare i32 @llvm.ctpop.i32(i32) nounwind readnone
75 declare i64 @llvm.ctpop.i64(i64) nounwind readnone