[llvm] r315681 - [InstCombine] add tests for boolean extend + add; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 13 07:09:45 PDT 2017
Author: spatel
Date: Fri Oct 13 07:09:45 2017
New Revision: 315681
URL: http://llvm.org/viewvc/llvm-project?rev=315681&view=rev
Log:
[InstCombine] add tests for boolean extend + add; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/zext-bool-add-sub.ll
Modified: llvm/trunk/test/Transforms/InstCombine/zext-bool-add-sub.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/zext-bool-add-sub.ll?rev=315681&r1=315680&r2=315681&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/zext-bool-add-sub.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/zext-bool-add-sub.ll Fri Oct 13 07:09:45 2017
@@ -61,3 +61,35 @@ define i32 @PR30273_three_bools(i1 %x, i
ret i32 %sel2
}
+define i32 @zext_add_scalar(i1 %x) {
+; CHECK-LABEL: @zext_add_scalar(
+; CHECK-NEXT: [[ADD:%.*]] = select i1 %x, i32 43, i32 42
+; CHECK-NEXT: ret i32 [[ADD]]
+;
+ %zext = zext i1 %x to i32
+ %add = add i32 %zext, 42
+ ret i32 %add
+}
+
+define <2 x i32> @zext_add_vec_splat(<2 x i1> %x) {
+; CHECK-LABEL: @zext_add_vec_splat(
+; CHECK-NEXT: [[ZEXT:%.*]] = zext <2 x i1> %x to <2 x i32>
+; CHECK-NEXT: [[ADD:%.*]] = or <2 x i32> [[ZEXT]], <i32 42, i32 42>
+; CHECK-NEXT: ret <2 x i32> [[ADD]]
+;
+ %zext = zext <2 x i1> %x to <2 x i32>
+ %add = add <2 x i32> %zext, <i32 42, i32 42>
+ ret <2 x i32> %add
+}
+
+define <2 x i32> @zext_add_vec(<2 x i1> %x) {
+; CHECK-LABEL: @zext_add_vec(
+; CHECK-NEXT: [[ZEXT:%.*]] = zext <2 x i1> %x to <2 x i32>
+; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw <2 x i32> [[ZEXT]], <i32 42, i32 23>
+; CHECK-NEXT: ret <2 x i32> [[ADD]]
+;
+ %zext = zext <2 x i1> %x to <2 x i32>
+ %add = add <2 x i32> %zext, <i32 42, i32 23>
+ ret <2 x i32> %add
+}
+
More information about the llvm-commits
mailing list