1 ; This test makes sure that these instructions are properly eliminated. 2 ; 3 ; RUN: opt < %s -instcombine -S | FileCheck %s 4 5 ; PR1253 6 define i1 @test0(i32 %A) { 7 ; CHECK: @test0 8 ; CHECK: %C = icmp slt i32 %A, 0 9 %B = xor i32 %A, -2147483648 10 %C = icmp sgt i32 %B, -1 11 ret i1 %C 12 } 13 14 define i1 @test1(i32 %A) { 15 ; CHECK: @test1 16 ; CHECK: %C = icmp slt i32 %A, 0 17 %B = xor i32 %A, 12345 18 %C = icmp slt i32 %B, 0 19 ret i1 %C 20 } 21 22 ; PR1014 23 define i32 @test2(i32 %tmp1) { 24 ; CHECK: @test2 25 ; CHECK-NEXT: and i32 %tmp1, 32 26 ; CHECK-NEXT: or i32 %ovm, 8 27 ; CHECK-NEXT: ret i32 28 %ovm = and i32 %tmp1, 32 29 %ov3 = add i32 %ovm, 145 30 %ov110 = xor i32 %ov3, 153 31 ret i32 %ov110 32 } 33 34 define i32 @test3(i32 %tmp1) { 35 ; CHECK: @test3 36 ; CHECK-NEXT: and i32 %tmp1, 32 37 ; CHECK-NEXT: or i32 %ovm, 8 38 ; CHECK-NEXT: ret i32 39 %ovm = or i32 %tmp1, 145 40 %ov31 = and i32 %ovm, 177 41 %ov110 = xor i32 %ov31, 153 42 ret i32 %ov110 43 } 44 45 define i32 @test4(i32 %A, i32 %B) { 46 %1 = xor i32 %A, -1 47 %2 = ashr i32 %1, %B 48 %3 = xor i32 %2, -1 49 ret i32 %3 50 ; CHECK: @test4 51 ; CHECK: %1 = ashr i32 %A, %B 52 ; CHECK: ret i32 %1 53 } 54