@@ -30,6 +30,20 @@ func.func @test_addi() -> index {
3030 return %2 : index
3131}
3232
33+ // CHECK-LABEL: func @test_addi_vec
34+ // CHECK: %[[A:.*]] = test.with_bounds {smax = 5 : index, smin = 4 : index, umax = 5 : index, umin = 4 : index} : vector<4xindex>
35+ // CHECK: %[[B:.*]] = test.with_bounds {smax = 7 : index, smin = 6 : index, umax = 7 : index, umin = 6 : index} : vector<4xindex>
36+ // CHECK: %[[A_CASTED:.*]] = arith.index_castui %[[A]] : vector<4xindex> to vector<4xi8>
37+ // CHECK: %[[B_CASTED:.*]] = arith.index_castui %[[B]] : vector<4xindex> to vector<4xi8>
38+ // CHECK: %[[RES:.*]] = arith.addi %[[A_CASTED]], %[[B_CASTED]] : vector<4xi8>
39+ // CHECK: %[[RES_CASTED:.*]] = arith.index_castui %[[RES]] : vector<4xi8> to vector<4xindex>
40+ // CHECK: return %[[RES_CASTED]] : vector<4xindex>
41+ func.func @test_addi_vec () -> vector <4 xindex > {
42+ %0 = test.with_bounds { umin = 4 : index , umax = 5 : index , smin = 4 : index , smax = 5 : index } : vector <4 xindex >
43+ %1 = test.with_bounds { umin = 6 : index , umax = 7 : index , smin = 6 : index , smax = 7 : index } : vector <4 xindex >
44+ %2 = arith.addi %0 , %1 : vector <4 xindex >
45+ return %2 : vector <4 xindex >
46+ }
3347
3448// CHECK-LABEL: func @test_addi_i64
3549// CHECK: %[[A:.*]] = test.with_bounds {smax = 5 : i64, smin = 4 : i64, umax = 5 : i64, umin = 4 : i64} : i64
@@ -60,6 +74,20 @@ func.func @test_cmpi() -> i1 {
6074 return %2 : i1
6175}
6276
77+ // CHECK-LABEL: func @test_cmpi_vec
78+ // CHECK: %[[A:.*]] = test.with_bounds {smax = 10 : index, smin = 0 : index, umax = 10 : index, umin = 0 : index} : vector<4xindex>
79+ // CHECK: %[[B:.*]] = test.with_bounds {smax = 10 : index, smin = 0 : index, umax = 10 : index, umin = 0 : index} : vector<4xindex>
80+ // CHECK: %[[A_CASTED:.*]] = arith.index_castui %[[A]] : vector<4xindex> to vector<4xi8>
81+ // CHECK: %[[B_CASTED:.*]] = arith.index_castui %[[B]] : vector<4xindex> to vector<4xi8>
82+ // CHECK: %[[RES:.*]] = arith.cmpi slt, %[[A_CASTED]], %[[B_CASTED]] : vector<4xi8>
83+ // CHECK: return %[[RES]] : vector<4xi1>
84+ func.func @test_cmpi_vec () -> vector <4 xi1 > {
85+ %0 = test.with_bounds { umin = 0 : index , umax = 10 : index , smin = 0 : index , smax = 10 : index } : vector <4 xindex >
86+ %1 = test.with_bounds { umin = 0 : index , umax = 10 : index , smin = 0 : index , smax = 10 : index } : vector <4 xindex >
87+ %2 = arith.cmpi slt , %0 , %1 : vector <4 xindex >
88+ return %2 : vector <4 xi1 >
89+ }
90+
6391//===----------------------------------------------------------------------===//
6492// arith.addi
6593//===----------------------------------------------------------------------===//
0 commit comments