@@ -128,82 +128,6 @@ func.func @selToArith(%arg0: i1, %arg1 : i1, %arg2 : i1) -> i1 {
128
128
return %res : i1
129
129
}
130
130
131
- // CHECK-LABEL: @redundantSelectTrue
132
- // CHECK-NEXT: %[[res:.+]] = arith.select %arg0, %arg1, %arg3
133
- // CHECK-NEXT: return %[[res]]
134
- func.func @redundantSelectTrue (%arg0: i1 , %arg1 : i32 , %arg2 : i32 , %arg3 : i32 ) -> i32 {
135
- %0 = arith.select %arg0 , %arg1 , %arg2 : i32
136
- %res = arith.select %arg0 , %0 , %arg3 : i32
137
- return %res : i32
138
- }
139
-
140
- // CHECK-LABEL: @redundantSelectFalse
141
- // CHECK-NEXT: %[[res:.+]] = arith.select %arg0, %arg3, %arg2
142
- // CHECK-NEXT: return %[[res]]
143
- func.func @redundantSelectFalse (%arg0: i1 , %arg1 : i32 , %arg2 : i32 , %arg3 : i32 ) -> i32 {
144
- %0 = arith.select %arg0 , %arg1 , %arg2 : i32
145
- %res = arith.select %arg0 , %arg3 , %0 : i32
146
- return %res : i32
147
- }
148
-
149
- // CHECK-LABEL: @selNotCond
150
- // CHECK-NEXT: %[[res1:.+]] = arith.select %arg0, %arg2, %arg1
151
- // CHECK-NEXT: %[[res2:.+]] = arith.select %arg0, %arg4, %arg3
152
- // CHECK-NEXT: return %[[res1]], %[[res2]]
153
- func.func @selNotCond (%arg0: i1 , %arg1 : i32 , %arg2 : i32 , %arg3 : i32 , %arg4 : i32 ) -> (i32 , i32 ) {
154
- %one = arith.constant 1 : i1
155
- %cond1 = arith.xori %arg0 , %one : i1
156
- %cond2 = arith.xori %one , %arg0 : i1
157
-
158
- %res1 = arith.select %cond1 , %arg1 , %arg2 : i32
159
- %res2 = arith.select %cond2 , %arg3 , %arg4 : i32
160
- return %res1 , %res2 : i32 , i32
161
- }
162
-
163
- // CHECK-LABEL: @selAndCond
164
- // CHECK-NEXT: %[[and:.+]] = arith.andi %arg1, %arg0
165
- // CHECK-NEXT: %[[res:.+]] = arith.select %[[and]], %arg2, %arg3
166
- // CHECK-NEXT: return %[[res]]
167
- func.func @selAndCond (%arg0: i1 , %arg1: i1 , %arg2 : i32 , %arg3 : i32 ) -> i32 {
168
- %sel = arith.select %arg0 , %arg2 , %arg3 : i32
169
- %res = arith.select %arg1 , %sel , %arg3 : i32
170
- return %res : i32
171
- }
172
-
173
- // CHECK-LABEL: @selAndNotCond
174
- // CHECK-NEXT: %[[one:.+]] = arith.constant true
175
- // CHECK-NEXT: %[[not:.+]] = arith.xori %arg0, %[[one]]
176
- // CHECK-NEXT: %[[and:.+]] = arith.andi %arg1, %[[not]]
177
- // CHECK-NEXT: %[[res:.+]] = arith.select %[[and]], %arg3, %arg2
178
- // CHECK-NEXT: return %[[res]]
179
- func.func @selAndNotCond (%arg0: i1 , %arg1: i1 , %arg2 : i32 , %arg3 : i32 ) -> i32 {
180
- %sel = arith.select %arg0 , %arg2 , %arg3 : i32
181
- %res = arith.select %arg1 , %sel , %arg2 : i32
182
- return %res : i32
183
- }
184
-
185
- // CHECK-LABEL: @selOrCond
186
- // CHECK-NEXT: %[[or:.+]] = arith.ori %arg1, %arg0
187
- // CHECK-NEXT: %[[res:.+]] = arith.select %[[or]], %arg2, %arg3
188
- // CHECK-NEXT: return %[[res]]
189
- func.func @selOrCond (%arg0: i1 , %arg1: i1 , %arg2 : i32 , %arg3 : i32 ) -> i32 {
190
- %sel = arith.select %arg0 , %arg2 , %arg3 : i32
191
- %res = arith.select %arg1 , %arg2 , %sel : i32
192
- return %res : i32
193
- }
194
-
195
- // CHECK-LABEL: @selOrNotCond
196
- // CHECK-NEXT: %[[one:.+]] = arith.constant true
197
- // CHECK-NEXT: %[[not:.+]] = arith.xori %arg0, %[[one]]
198
- // CHECK-NEXT: %[[or:.+]] = arith.ori %arg1, %[[not]]
199
- // CHECK-NEXT: %[[res:.+]] = arith.select %[[or]], %arg3, %arg2
200
- // CHECK-NEXT: return %[[res]]
201
- func.func @selOrNotCond (%arg0: i1 , %arg1: i1 , %arg2 : i32 , %arg3 : i32 ) -> i32 {
202
- %sel = arith.select %arg0 , %arg2 , %arg3 : i32
203
- %res = arith.select %arg1 , %arg3 , %sel : i32
204
- return %res : i32
205
- }
206
-
207
131
// Test case: Folding of comparisons with equal operands.
208
132
// CHECK-LABEL: @cmpi_equal_operands
209
133
// CHECK-DAG: %[[T:.*]] = arith.constant true
0 commit comments