[llvm] r342203 - [InstCombine] Add some test cases for (add (sext x), (sext y)) --> (sext (add int x, y)) and (mul (sext x), (sext y)) --> (sext (mul x, y)). NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 13 22:16:59 PDT 2018
Author: ctopper
Date: Thu Sep 13 22:16:58 2018
New Revision: 342203
URL: http://llvm.org/viewvc/llvm-project?rev=342203&view=rev
Log:
[InstCombine] Add some test cases for (add (sext x), (sext y)) --> (sext (add int x, y)) and (mul (sext x), (sext y)) --> (sext (mul x, y)). NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/sink-zext.ll
Modified: llvm/trunk/test/Transforms/InstCombine/sink-zext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sink-zext.ll?rev=342203&r1=342202&r2=342203&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/sink-zext.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/sink-zext.ll Thu Sep 13 22:16:58 2018
@@ -328,4 +328,37 @@ define <2 x i64> @test10_vec(<2 x i32> %
ret <2 x i64> %mul
}
+define i64 @test11(i32 %V) {
+; CHECK-LABEL: @test11(
+; CHECK-NEXT: [[CALL1:%.*]] = call i32 @callee(), !range !1
+; CHECK-NEXT: [[CALL2:%.*]] = call i32 @callee(), !range !1
+; CHECK-NEXT: [[ADDCONV:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]
+; CHECK-NEXT: [[ADD:%.*]] = sext i32 [[ADDCONV]] to i64
+; CHECK-NEXT: ret i64 [[ADD]]
+;
+ %call1 = call i32 @callee(), !range !1
+ %call2 = call i32 @callee(), !range !1
+ %sext1 = sext i32 %call1 to i64
+ %sext2 = sext i32 %call2 to i64
+ %add = add i64 %sext1, %sext2
+ ret i64 %add
+}
+
+define i64 @test12(i32 %V) {
+; CHECK-LABEL: @test12(
+; CHECK-NEXT: [[CALL1:%.*]] = call i32 @callee(), !range !1
+; CHECK-NEXT: [[CALL2:%.*]] = call i32 @callee(), !range !1
+; CHECK-NEXT: [[MULCONV:%.*]] = mul nsw i32 [[CALL1]], [[CALL2]]
+; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[MULCONV]] to i64
+; CHECK-NEXT: ret i64 [[TMP1]]
+;
+ %call1 = call i32 @callee(), !range !1
+ %call2 = call i32 @callee(), !range !1
+ %sext1 = sext i32 %call1 to i64
+ %sext2 = sext i32 %call2 to i64
+ %add = mul i64 %sext1, %sext2
+ ret i64 %add
+}
+
!0 = !{ i32 0, i32 2000 }
+!1 = !{ i32 -2000, i32 0 }
More information about the llvm-commits
mailing list