; RUN: opt -S -aarch64-sve-intrinsic-opts -mtriple=aarch64-linux-gnu -mattr=+sve < %s 2>%t | FileCheck --check-prefix OPT %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 define i1 @ptest_any1( %a) { ; OPT-LABEL: ptest_any1 ; OPT: %mask = tail call @llvm.aarch64.sve.ptrue.nxv2i1(i32 0) ; OPT-NOT: convert ; OPT-NEXT: %[[OUT:.*]] = call i1 @llvm.aarch64.sve.ptest.any.nxv2i1( %mask, %a) ; OPT-NEXT: ret i1 %[[OUT]] %mask = tail call @llvm.aarch64.sve.ptrue.nxv2i1(i32 0) %1 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( %mask) %2 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( %a) %out = call i1 @llvm.aarch64.sve.ptest.any.nxv16i1( %1, %2) ret i1 %out } ; No transform because the ptest is using differently sized operands. define i1 @ptest_any2( %a) { ; OPT-LABEL: ptest_any2 ; OPT: %mask = tail call @llvm.aarch64.sve.ptrue.nxv2i1(i32 31) ; OPT-NEXT: %1 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( %mask) ; OPT-NEXT: %2 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( %a) ; OPT-NEXT: %out = call i1 @llvm.aarch64.sve.ptest.any.nxv16i1( %1, %2) %mask = tail call @llvm.aarch64.sve.ptrue.nxv2i1(i32 31) %1 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( %mask) %2 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( %a) %out = call i1 @llvm.aarch64.sve.ptest.any.nxv16i1( %1, %2) ret i1 %out } define i1 @ptest_first( %a) { ; OPT-LABEL: ptest_first ; OPT: %mask = tail call @llvm.aarch64.sve.ptrue.nxv4i1(i32 0) ; OPT-NOT: convert ; OPT-NEXT: %[[OUT:.*]] = call i1 @llvm.aarch64.sve.ptest.first.nxv4i1( %mask, %a) ; OPT-NEXT: ret i1 %[[OUT]] %mask = tail call @llvm.aarch64.sve.ptrue.nxv4i1(i32 0) %1 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( %mask) %2 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv4i1( %a) %out = call i1 @llvm.aarch64.sve.ptest.first.nxv16i1( %1, %2) ret i1 %out } define i1 @ptest_first_same_ops( %a) { ; OPT-LABEL: ptest_first_same_ops ; OPT: %[[OUT:.*]] = call i1 @llvm.aarch64.sve.ptest.first.nxv2i1( %a, %a) ; OPT-NOT: convert ; OPT-NEXT: ret i1 %[[OUT]] %1 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv2i1( %a) %2 = tail call i1 @llvm.aarch64.sve.ptest.first.nxv16i1( %1, %1) ret i1 %2 } define i1 @ptest_last( %a) { ; OPT-LABEL: ptest_last ; OPT: %mask = tail call @llvm.aarch64.sve.ptrue.nxv8i1(i32 0) ; OPT-NOT: convert ; OPT-NEXT: %[[OUT:.*]] = call i1 @llvm.aarch64.sve.ptest.last.nxv8i1( %mask, %a) ; OPT-NEXT: ret i1 %[[OUT]] %mask = tail call @llvm.aarch64.sve.ptrue.nxv8i1(i32 0) %1 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( %mask) %2 = tail call @llvm.aarch64.sve.convert.to.svbool.nxv8i1( %a) %out = call i1 @llvm.aarch64.sve.ptest.last.nxv16i1( %1, %2) ret i1 %out } declare @llvm.aarch64.sve.ptrue.nxv16i1(i32) declare @llvm.aarch64.sve.ptrue.nxv8i1(i32) declare @llvm.aarch64.sve.ptrue.nxv4i1(i32) declare @llvm.aarch64.sve.ptrue.nxv2i1(i32) declare i1 @llvm.aarch64.sve.ptest.any.nxv16i1(, ) declare i1 @llvm.aarch64.sve.ptest.first.nxv16i1(, ) declare i1 @llvm.aarch64.sve.ptest.last.nxv16i1(, ) declare @llvm.aarch64.sve.convert.to.svbool.nxv8i1() declare @llvm.aarch64.sve.convert.to.svbool.nxv4i1() declare @llvm.aarch64.sve.convert.to.svbool.nxv2i1()