X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2FTransforms%2FInstCombine%2Fsub-xor.ll;h=3a24074e72a779f77d3c18d1a1a4b8ab174ee63e;hb=4635abb06529379bf2641b26d07d29aed5ce59f4;hp=bfa9f408c6f893a50393bc3741b9ad0be0cf60bd;hpb=009da05e750b7bac7e1902fcdc85394de4ea63b3;p=oota-llvm.git diff --git a/test/Transforms/InstCombine/sub-xor.ll b/test/Transforms/InstCombine/sub-xor.ll index bfa9f408c6f..3a24074e72a 100644 --- a/test/Transforms/InstCombine/sub-xor.ll +++ b/test/Transforms/InstCombine/sub-xor.ll @@ -5,7 +5,7 @@ define i32 @test1(i32 %x) nounwind { %sub = sub i32 63, %and ret i32 %sub -; CHECK: @test1 +; CHECK-LABEL: @test1( ; CHECK-NEXT: and i32 %x, 31 ; CHECK-NEXT: xor i32 %and, 63 ; CHECK-NEXT: ret @@ -18,8 +18,30 @@ define i32 @test2(i32 %x) nounwind { %sub = sub i32 31, %count ret i32 %sub -; CHECK: @test2 +; CHECK-LABEL: @test2( ; CHECK-NEXT: ctlz ; CHECK-NEXT: xor i32 %count, 31 ; CHECK-NEXT: ret } + +define i32 @test3(i32 %x) nounwind { + %and = and i32 %x, 31 + %sub = xor i32 31, %and + %add = add i32 %sub, 42 + ret i32 %add + +; CHECK-LABEL: @test3( +; CHECK-NEXT: and i32 %x, 31 +; CHECK-NEXT: sub nsw i32 73, %and +; CHECK-NEXT: ret +} + +define i32 @test4(i32 %x) nounwind { + %sub = xor i32 %x, 2147483648 + %add = add i32 %sub, 42 + ret i32 %add + +; CHECK-LABEL: @test4( +; CHECK-NEXT: add i32 %x, -2147483606 +; CHECK-NEXT: ret +}