; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s 2>%t | FileCheck %s ; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t ; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it. ; WARN-NOT: warning target triple = "aarch64-unknown-linux-gnu" ; ; CLZ ; define @ctlz_b( %a) #0 { ; CHECK-LABEL: ctlz_b: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.b ; CHECK-NEXT: clz z0.b, p0/m, z0.b ; CHECK-NEXT: ret %res = call @llvm.ctlz.nxv16i8( %a) ret %res } define @ctlz_h( %a) #0 { ; CHECK-LABEL: ctlz_h: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.h ; CHECK-NEXT: clz z0.h, p0/m, z0.h ; CHECK-NEXT: ret %res = call @llvm.ctlz.nxv8i16( %a) ret %res } define @ctlz_s( %a) #0 { ; CHECK-LABEL: ctlz_s: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.s ; CHECK-NEXT: clz z0.s, p0/m, z0.s ; CHECK-NEXT: ret %res = call @llvm.ctlz.nxv4i32( %a) ret %res } define @ctlz_d( %a) #0 { ; CHECK-LABEL: ctlz_d: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.d ; CHECK-NEXT: clz z0.d, p0/m, z0.d ; CHECK-NEXT: ret %res = call @llvm.ctlz.nxv2i64( %a) ret %res } ; ; CNT ; define @ctpop_b( %a) #0 { ; CHECK-LABEL: ctpop_b: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.b ; CHECK-NEXT: cnt z0.b, p0/m, z0.b ; CHECK-NEXT: ret %res = call @llvm.ctpop.nxv16i8( %a) ret %res } define @ctpop_h( %a) #0 { ; CHECK-LABEL: ctpop_h: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.h ; CHECK-NEXT: cnt z0.h, p0/m, z0.h ; CHECK-NEXT: ret %res = call @llvm.ctpop.nxv8i16( %a) ret %res } define @ctpop_s( %a) #0 { ; CHECK-LABEL: ctpop_s: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.s ; CHECK-NEXT: cnt z0.s, p0/m, z0.s ; CHECK-NEXT: ret %res = call @llvm.ctpop.nxv4i32( %a) ret %res } define @ctpop_d( %a) #0 { ; CHECK-LABEL: ctpop_d: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.d ; CHECK-NEXT: cnt z0.d, p0/m, z0.d ; CHECK-NEXT: ret %res = call @llvm.ctpop.nxv2i64( %a) ret %res } ; ; Count trailing zeros ; define @cttz_b( %a) #0 { ; CHECK-LABEL: cttz_b: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.b ; CHECK-NEXT: rbit z0.b, p0/m, z0.b ; CHECK-NEXT: clz z0.b, p0/m, z0.b ; CHECK-NEXT: ret %res = call @llvm.cttz.nxv16i8( %a) ret %res } define @cttz_h( %a) #0 { ; CHECK-LABEL: cttz_h: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.h ; CHECK-NEXT: rbit z0.h, p0/m, z0.h ; CHECK-NEXT: clz z0.h, p0/m, z0.h ; CHECK-NEXT: ret %res = call @llvm.cttz.nxv8i16( %a) ret %res } define @cttz_s( %a) #0 { ; CHECK-LABEL: cttz_s: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.s ; CHECK-NEXT: rbit z0.s, p0/m, z0.s ; CHECK-NEXT: clz z0.s, p0/m, z0.s ; CHECK-NEXT: ret %res = call @llvm.cttz.nxv4i32( %a) ret %res } define @cttz_d( %a) #0 { ; CHECK-LABEL: cttz_d: ; CHECK: // %bb.0: ; CHECK-NEXT: ptrue p0.d ; CHECK-NEXT: rbit z0.d, p0/m, z0.d ; CHECK-NEXT: clz z0.d, p0/m, z0.d ; CHECK-NEXT: ret %res = call @llvm.cttz.nxv2i64( %a) ret %res } attributes #0 = { "target-features"="+sve" } declare @llvm.ctlz.nxv16i8() declare @llvm.ctlz.nxv8i16() declare @llvm.ctlz.nxv4i32() declare @llvm.ctlz.nxv2i64() declare @llvm.ctpop.nxv16i8() declare @llvm.ctpop.nxv8i16() declare @llvm.ctpop.nxv4i32() declare @llvm.ctpop.nxv2i64() declare @llvm.cttz.nxv16i8() declare @llvm.cttz.nxv8i16() declare @llvm.cttz.nxv4i32() declare @llvm.cttz.nxv2i64()