llvm.org GIT mirror llvm / 8ed88ee
[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369839 91177308-0d34-0410-b5e6-96231b3b80d8 Roman Lebedev 23 days ago
1 changed file(s) with 13 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
262262 ret i32 %r
263263 }
264264
265 ; We don't touch sign checks
266 define i32 @n22_sign_check(i32 %x, i32 %y) {
267 ; CHECK-LABEL: @n22_sign_check(
265 ; There is nothing special about sign-bit-tests, we can fold them.
266 define i32 @t22_sign_check(i32 %x, i32 %y) {
267 ; CHECK-LABEL: @t22_sign_check(
268268 ; CHECK-NEXT: [[T:%.*]] = icmp slt i32 [[X:%.*]], 0
269269 ; CHECK-NEXT: [[R:%.*]] = select i1 [[T]], i32 -1, i32 [[Y:%.*]]
270270 ; CHECK-NEXT: ret i32 [[R]]
271271 ;
272272 %t = icmp slt i32 %x, 0
273273 %r = select i1 %t, i32 -1, i32 %y
274 ret i32 %r
275 }
276 define i32 @t22_sign_check2(i32 %x, i32 %y) {
277 ; CHECK-LABEL: @t22_sign_check2(
278 ; CHECK-NEXT: [[T:%.*]] = icmp sgt i32 [[X:%.*]], -1
279 ; CHECK-NEXT: [[R:%.*]] = select i1 [[T]], i32 0, i32 [[Y:%.*]]
280 ; CHECK-NEXT: ret i32 [[R]]
281 ;
282 %t = icmp sgt i32 %x, -1
283 %r = select i1 %t, i32 0, i32 %y
274284 ret i32 %r
275285 }
276286