@@ -37,19 +37,57 @@ func.func @arith_ops(%arg0: f32, %arg1: f32) {
37
37
38
38
// -----
39
39
40
+ // CHECK-LABEL: arith_integer_ops
40
41
func.func @arith_integer_ops (%arg0: i32 , %arg1: i32 ) {
41
- // CHECK: emitc.add %arg0, %arg1 : (i32, i32) -> i32
42
+ // CHECK: %[[C1:[^ ]*]] = emitc.cast %arg0 : i32 to ui3
43
+ // CHECK: %[[C2:[^ ]*]] = emitc.cast %arg1 : i32 to ui3
44
+ // CHECK: %[[ADD:[^ ]*]] = emitc.add %[[C1]], %[[C2]] : (ui32, ui32) -> ui32
45
+ // CHECK: %[[C3:[^ ]*]] = emitc.cast %[[ADD]] : ui32 to i3
42
46
%0 = arith.addi %arg0 , %arg1 : i32
43
- // CHECK: emitc.sub %arg0, %arg1 : (i32, i32) -> i32
47
+ // CHECK: %[[C1:[^ ]*]] = emitc.cast %arg0 : i32 to ui3
48
+ // CHECK: %[[C2:[^ ]*]] = emitc.cast %arg1 : i32 to ui3
49
+ // CHECK: %[[SUB:[^ ]*]] = emitc.sub %[[C1]], %[[C2]] : (ui32, ui32) -> ui32
50
+ // CHECK: %[[C3:[^ ]*]] = emitc.cast %[[SUB]] : ui32 to i3
44
51
%1 = arith.subi %arg0 , %arg1 : i32
45
- // CHECK: emitc.mul %arg0, %arg1 : (i32, i32) -> i32
52
+ // CHECK: %[[C1:[^ ]*]] = emitc.cast %arg0 : i32 to ui3
53
+ // CHECK: %[[C2:[^ ]*]] = emitc.cast %arg1 : i32 to ui3
54
+ // CHECK: %[[MUL:[^ ]*]] = emitc.mul %[[C1]], %[[C2]] : (ui32, ui32) -> ui32
55
+ // CHECK: %[[C3:[^ ]*]] = emitc.cast %[[MUL]] : ui32 to i3
46
56
%2 = arith.muli %arg0 , %arg1 : i32
47
57
48
58
return
49
59
}
50
60
51
61
// -----
52
62
63
+ // CHECK-LABEL: arith_integer_ops_signed_nsw
64
+ func.func @arith_integer_ops_signed_nsw (%arg0: i32 , %arg1: i32 ) {
65
+ // CHECK: emitc.add %arg0, %arg1 : (i32, i32) -> i32
66
+ %0 = arith.addi %arg0 , %arg1 overflow <nsw > : i32
67
+ // CHECK: emitc.sub %arg0, %arg1 : (i32, i32) -> i32
68
+ %1 = arith.subi %arg0 , %arg1 overflow <nsw > : i32
69
+ // CHECK: emitc.mul %arg0, %arg1 : (i32, i32) -> i32
70
+ %2 = arith.muli %arg0 , %arg1 overflow <nsw > : i32
71
+
72
+ return
73
+ }
74
+
75
+ // -----
76
+
77
+ // CHECK-LABEL: arith_index
78
+ func.func @arith_index (%arg0: index , %arg1: index ) {
79
+ // CHECK: emitc.add %arg0, %arg1 : (index, index) -> index
80
+ %0 = arith.addi %arg0 , %arg1 : index
81
+ // CHECK: emitc.sub %arg0, %arg1 : (index, index) -> index
82
+ %1 = arith.subi %arg0 , %arg1 : index
83
+ // CHECK: emitc.mul %arg0, %arg1 : (index, index) -> index
84
+ %2 = arith.muli %arg0 , %arg1 : index
85
+
86
+ return
87
+ }
88
+
89
+ // -----
90
+
53
91
func.func @arith_select (%arg0: i1 , %arg1: tensor <8 xi32 >, %arg2: tensor <8 xi32 >) -> () {
54
92
// CHECK: [[V0:[^ ]*]] = emitc.conditional %arg0, %arg1, %arg2 : tensor<8xi32>
55
93
%0 = arith.select %arg0 , %arg1 , %arg2 : i1 , tensor <8 xi32 >
0 commit comments