[llvm] r309839 - [InstCombine] Add missing test case for (xor (sext (cmp)), -1) -> (sext (!cmp)).

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 10:33:02 PDT 2017


Author: ctopper
Date: Wed Aug  2 10:33:02 2017
New Revision: 309839

URL: http://llvm.org/viewvc/llvm-project?rev=309839&view=rev
Log:
[InstCombine] Add missing test case for (xor (sext (cmp)), -1) -> (sext (!cmp)).

Modified:
    llvm/trunk/test/Transforms/InstCombine/cast.ll

Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=309839&r1=309838&r2=309839&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast.ll Wed Aug  2 10:33:02 2017
@@ -1522,3 +1522,17 @@ define i8 @pr33078_4(i3 %x) {
   %D = trunc i16 %C to i8
   ret i8 %D
 }
+
+; (sext (xor (cmp), -1)) -> (sext (!cmp))
+define i64 @test94(i32 %a) {
+; CHECK-LABEL: @test94(
+; CHECK-NEXT:    [[TMP1:%.*]] = icmp ne i32 [[A:%.*]], -2
+; CHECK-NEXT:    [[TMP2:%.*]] = sext i1 [[TMP1]] to i64
+; CHECK-NEXT:    ret i64 [[TMP2]]
+;
+  %1 = icmp eq i32 %a, -2
+  %2 = sext i1 %1 to i8
+  %3 = xor i8 %2, -1
+  %4 = sext i8 %3 to i64
+  ret i64 %4
+}




More information about the llvm-commits mailing list