[Mlir-commits] [mlir] [mlir][spirv] Add pattern matching for arith.index_cast index to i1 for ArithToSPIRV (PR #156031)

Ian Li llvmlistbot at llvm.org
Tue Sep 2 21:00:58 PDT 2025


================
@@ -734,14 +734,22 @@ func.func @index_castui4(%arg0: index) {
   return
 }
 
-// CHECK-LABEL: index_castindexi1
-func.func @index_castindexi1(%arg0 : index) {
+// CHECK-LABEL: index_castindexi1_1
+func.func @index_castindexi1_1(%arg0 : index) {
   // CHECK: %[[ZERO:.+]] = spirv.Constant 0 : i32
   // CHECK: spirv.INotEqual %[[ZERO]], %{{.+}} : i32
   %0 = arith.index_cast %arg0 : index to i1
   return
 }
 
+// CHECK-LABEL: index_castindexi1_2
+func.func @index_castindexi1_2(%arg0 : vector<3xindex>) {
+  // CHECK: %[[ZERO:.+]] = spirv.Constant dense<0> : vector<3xi32>
+  // CHECK: spirv.INotEqual %[[ZERO]], %{{.+}} : vector<3xi32>
+  %0 = arith.index_cast %arg0 : vector<3xindex> to vector<3xi1>
----------------
ianayl wrote:

I did not know that; thanks again for the catch!

https://github.com/llvm/llvm-project/pull/156031


More information about the Mlir-commits mailing list