summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-01-30 23:26:17 +0000
committerSanjay Patel <spatel@rotateright.com>2017-01-30 23:26:17 +0000
commitabbb118a78d6d8d31aa0da4fd773cba7f1c69242 (patch)
tree941532d62b73d363841d5666386b7ed699ff664c /llvm/test/Transforms
parentdde94e4c4f373bcd1881086c52091aa9ab9b7e96 (diff)
downloadbcm5719-llvm-abbb118a78d6d8d31aa0da4fd773cba7f1c69242.tar.gz
bcm5719-llvm-abbb118a78d6d8d31aa0da4fd773cba7f1c69242.zip
[InstCombine] add vector test for (X <<nsw C1) >>s C2 --> X <<nsw (C1 - C2); NFC
llvm-svn: 293566
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/shift.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll
index b105c58201e..a5ad0aa4f68 100644
--- a/llvm/test/Transforms/InstCombine/shift.ll
+++ b/llvm/test/Transforms/InstCombine/shift.ll
@@ -987,6 +987,8 @@ define <2 x i32> @test51_no_nuw_splat_vec(<2 x i32> %x) {
ret <2 x i32> %B
}
+; (X <<nsw C1) >>s C2 --> X <<nsw (C1 - C2)
+
define i32 @test52(i32 %x) {
; CHECK-LABEL: @test52(
; CHECK-NEXT: [[B:%.*]] = shl nsw i32 %x, 2
@@ -997,6 +999,19 @@ define i32 @test52(i32 %x) {
ret i32 %B
}
+; (X <<nsw C1) >>s C2 --> X <<nsw (C1 - C2)
+
+define <2 x i32> @test52_splat_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test52_splat_vec(
+; CHECK-NEXT: [[A:%.*]] = shl nsw <2 x i32> %x, <i32 3, i32 3>
+; CHECK-NEXT: [[B:%.*]] = ashr exact <2 x i32> [[A]], <i32 1, i32 1>
+; CHECK-NEXT: ret <2 x i32> [[B]]
+;
+ %A = shl nsw <2 x i32> %x, <i32 3, i32 3>
+ %B = ashr <2 x i32> %A, <i32 1, i32 1>
+ ret <2 x i32> %B
+}
+
; (X <<nuw C1) >>u C2 --> X <<nuw (C1 - C2)
define i32 @test53(i32 %x) {
OpenPOWER on IntegriCloud