[llvm] 2852b8b - [SPIR-V] Extend runLowerI1Comparisons to cover vector i1 types (#206409)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 05:29:21 PDT 2026


Author: Arseniy Obolenskiy
Date: 2026-06-29T14:29:17+02:00
New Revision: 2852b8beb9a87e72f6eccb297bbe1f0c8fcf7083

URL: https://github.com/llvm/llvm-project/commit/2852b8beb9a87e72f6eccb297bbe1f0c8fcf7083
DIFF: https://github.com/llvm/llvm-project/commit/2852b8beb9a87e72f6eccb297bbe1f0c8fcf7083.diff

LOG: [SPIR-V] Extend runLowerI1Comparisons to cover vector i1 types (#206409)

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp
    llvm/test/CodeGen/SPIRV/passes/SPIRVRegularizer-i1-icmp.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp b/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp
index 04e062c4b2dff..e3ea827e3f4c6 100644
--- a/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp
@@ -162,7 +162,7 @@ static void runLowerI1Comparisons(Function &F) {
     if (!Cmp)
       continue;
 
-    bool IsI1 = Cmp->getOperand(0)->getType()->isIntegerTy(1);
+    bool IsI1 = Cmp->getOperand(0)->getType()->getScalarType()->isIntegerTy(1);
     if (!IsI1)
       continue;
 

diff  --git a/llvm/test/CodeGen/SPIRV/passes/SPIRVRegularizer-i1-icmp.ll b/llvm/test/CodeGen/SPIRV/passes/SPIRVRegularizer-i1-icmp.ll
index 361a422c425c3..d72f3690383b0 100644
--- a/llvm/test/CodeGen/SPIRV/passes/SPIRVRegularizer-i1-icmp.ll
+++ b/llvm/test/CodeGen/SPIRV/passes/SPIRVRegularizer-i1-icmp.ll
@@ -22,3 +22,23 @@ define i1 @ugt_i1(i1 %p, i1 %q) {
   %r = icmp ugt i1 %p, %q
   ret i1 %r
 }
+
+define <4 x i1> @ult_v4i1(<4 x i1> %p, <4 x i1> %q) {
+; CHECK-LABEL: define <4 x i1> @ult_v4i1(
+; CHECK-SAME: <4 x i1> [[P:%.*]], <4 x i1> [[Q:%.*]]) {
+; CHECK:    [[NOT:%.*]] = xor <4 x i1> [[P]], splat (i1 true)
+; CHECK:    [[R:%.*]] = and <4 x i1> [[Q]], [[NOT]]
+; CHECK:    ret <4 x i1> [[R]]
+  %r = icmp ult <4 x i1> %p, %q
+  ret <4 x i1> %r
+}
+
+define <4 x i1> @ugt_v4i1(<4 x i1> %p, <4 x i1> %q) {
+; CHECK-LABEL: define <4 x i1> @ugt_v4i1(
+; CHECK-SAME: <4 x i1> [[P:%.*]], <4 x i1> [[Q:%.*]]) {
+; CHECK:    [[NOT:%.*]] = xor <4 x i1> [[Q]], splat (i1 true)
+; CHECK:    [[R:%.*]] = and <4 x i1> [[P]], [[NOT]]
+; CHECK:    ret <4 x i1> [[R]]
+  %r = icmp ugt <4 x i1> %p, %q
+  ret <4 x i1> %r
+}


        


More information about the llvm-commits mailing list