summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-11-29 17:21:39 +0000
committerSanjay Patel <spatel@rotateright.com>2017-11-29 17:21:39 +0000
commite0f906c91528ce9e9494c71a2850b4d41ada7d0b (patch)
tree15c6618ebe7b5b0dcb7a305fcd8edc98096a020e /llvm
parent6a00970ade00c596c1f9a3464e0fa0d09d063d61 (diff)
downloadbcm5719-llvm-e0f906c91528ce9e9494c71a2850b4d41ada7d0b.tar.gz
bcm5719-llvm-e0f906c91528ce9e9494c71a2850b4d41ada7d0b.zip
[InstCombine] add tests for select-of-constants; NFC
These are variants of a test that was originally added in: https://reviews.llvm.org/rL75531 ...but removed with: https://reviews.llvm.org/rL159230 llvm-svn: 319327
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/Transforms/InstCombine/zext-bool-add-sub.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/zext-bool-add-sub.ll b/llvm/test/Transforms/InstCombine/zext-bool-add-sub.ll
index 4ee8ee2acd1..5a5b092c4d8 100644
--- a/llvm/test/Transforms/InstCombine/zext-bool-add-sub.ll
+++ b/llvm/test/Transforms/InstCombine/zext-bool-add-sub.ll
@@ -18,6 +18,39 @@ define i32 @a(i1 zeroext %x, i1 zeroext %y) {
ret i32 %add
}
+define i32 @zextsub(i1 %x) {
+; CHECK-LABEL: @zextsub(
+; CHECK-NEXT: [[ZEXT:%.*]] = zext i1 %x to i32
+; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 11, [[ZEXT]]
+; CHECK-NEXT: ret i32 [[SUB]]
+;
+ %zext = zext i1 %x to i32
+ %sub = sub i32 11, %zext
+ ret i32 %sub
+}
+
+define <2 x i32> @zextsub_splat(<2 x i1> %x) {
+; CHECK-LABEL: @zextsub_splat(
+; CHECK-NEXT: [[ZEXT:%.*]] = zext <2 x i1> %x to <2 x i32>
+; CHECK-NEXT: [[SUB:%.*]] = sub nsw <2 x i32> <i32 42, i32 42>, [[ZEXT]]
+; CHECK-NEXT: ret <2 x i32> [[SUB]]
+;
+ %zext = zext <2 x i1> %x to <2 x i32>
+ %sub = sub <2 x i32> <i32 42, i32 42>, %zext
+ ret <2 x i32> %sub
+}
+
+define <2 x i32> @zextsub_vec(<2 x i1> %x) {
+; CHECK-LABEL: @zextsub_vec(
+; CHECK-NEXT: [[ZEXT:%.*]] = zext <2 x i1> %x to <2 x i32>
+; CHECK-NEXT: [[SUB:%.*]] = sub nsw <2 x i32> <i32 11, i32 42>, [[ZEXT]]
+; CHECK-NEXT: ret <2 x i32> [[SUB]]
+;
+ %zext = zext <2 x i1> %x to <2 x i32>
+ %sub = sub <2 x i32> <i32 11, i32 42>, %zext
+ ret <2 x i32> %sub
+}
+
define i32 @PR30273_select(i1 %a, i1 %b) {
; CHECK-LABEL: @PR30273_select(
; CHECK-NEXT: [[ZEXT:%.*]] = zext i1 %a to i32
OpenPOWER on IntegriCloud