diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -9643,9 +9643,10 @@ // The only legal i1 vectors are SVE vectors, so we can use SVE-specific // lowering code. if (auto *ConstVal = dyn_cast(SplatVal)) { + if (ConstVal->isNullValue()) + return SDValue(DAG.getMachineNode(AArch64::PFALSE, dl, VT), 0); if (ConstVal->isOne()) return getPTrue(DAG, dl, VT, AArch64SVEPredPattern::all); - // TODO: Add special case for constant false } // The general case of i1. There isn't any natural way to do this, // so we use some trickery with whilelo. diff --git a/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares-with-imm.ll b/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares-with-imm.ll --- a/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares-with-imm.ll +++ b/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares-with-imm.ll @@ -1072,7 +1072,7 @@ define @ir_cmplo_h( %a) { ; CHECK-LABEL: ir_cmplo_h -; CHECK: whilelo p0.h, xzr, xzr +; CHECK: pfalse p0.b ; CHECK-NEXT: ret %elt = insertelement undef, i16 0, i32 0 %splat = shufflevector %elt, undef, zeroinitializer diff --git a/llvm/test/CodeGen/AArch64/sve-zeroinit.ll b/llvm/test/CodeGen/AArch64/sve-zeroinit.ll --- a/llvm/test/CodeGen/AArch64/sve-zeroinit.ll +++ b/llvm/test/CodeGen/AArch64/sve-zeroinit.ll @@ -54,28 +54,28 @@ define @test_zeroinit_2xi1() { ; CHECK-LABEL: test_zeroinit_2xi1 -; CHECK: whilelo p0.d, xzr, xzr +; CHECK: pfalse p0.b ; CHECK-NEXT: ret ret zeroinitializer } define @test_zeroinit_4xi1() { ; CHECK-LABEL: test_zeroinit_4xi1 -; CHECK: whilelo p0.s, xzr, xzr +; CHECK: pfalse p0.b ; CHECK-NEXT: ret ret zeroinitializer } define @test_zeroinit_8xi1() { ; CHECK-LABEL: test_zeroinit_8xi1 -; CHECK: whilelo p0.h, xzr, xzr +; CHECK: pfalse p0.b ; CHECK-NEXT: ret ret zeroinitializer } define @test_zeroinit_16xi1() { ; CHECK-LABEL: test_zeroinit_16xi1 -; CHECK: whilelo p0.b, xzr, xzr +; CHECK: pfalse p0.b ; CHECK-NEXT: ret ret zeroinitializer }