summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-08-29 15:34:19 +0000
committerSanjay Patel <spatel@rotateright.com>2018-08-29 15:34:19 +0000
commit3abd9f6bdce8f9f9eabe1a7097902bb22b5ceaaf (patch)
tree49ae7f175837483e5e5cc860b925fb92712dfccf
parentdc7f04bcea8c150e34f07702d570cc203473ab47 (diff)
downloadbcm5719-llvm-3abd9f6bdce8f9f9eabe1a7097902bb22b5ceaaf.tar.gz
bcm5719-llvm-3abd9f6bdce8f9f9eabe1a7097902bb22b5ceaaf.zip
[InstCombine] add test for vector demanded elements + shrinking; NFC
llvm-svn: 340933
-rw-r--r--llvm/test/Transforms/InstCombine/shuffle-select-narrow.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shuffle-select-narrow.ll b/llvm/test/Transforms/InstCombine/shuffle-select-narrow.ll
index 38974e2ec6e..51473b2b9e1 100644
--- a/llvm/test/Transforms/InstCombine/shuffle-select-narrow.ll
+++ b/llvm/test/Transforms/InstCombine/shuffle-select-narrow.ll
@@ -16,6 +16,21 @@ define <2 x i8> @narrow_shuffle_of_select(<2 x i1> %cmp, <4 x i8> %x, <4 x i8> %
ret <2 x i8> %r
}
+; TODO: The 1st shuffle is not extending with undefs, but demanded elements should correct that.
+
+define <2 x i8> @narrow_shuffle_of_select_overspecified_extend(<2 x i1> %cmp, <4 x i8> %x, <4 x i8> %y) {
+; CHECK-LABEL: @narrow_shuffle_of_select_overspecified_extend(
+; CHECK-NEXT: [[WIDECMP:%.*]] = shufflevector <2 x i1> [[CMP:%.*]], <2 x i1> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+; CHECK-NEXT: [[WIDESEL:%.*]] = select <4 x i1> [[WIDECMP]], <4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]]
+; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i8> [[WIDESEL]], <4 x i8> undef, <2 x i32> <i32 0, i32 1>
+; CHECK-NEXT: ret <2 x i8> [[R]]
+;
+ %widecmp = shufflevector <2 x i1> %cmp, <2 x i1> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+ %widesel = select <4 x i1> %widecmp, <4 x i8> %x, <4 x i8> %y
+ %r = shufflevector <4 x i8> %widesel, <4 x i8> undef, <2 x i32> <i32 0, i32 1>
+ ret <2 x i8> %r
+}
+
; TODO: Verify that undef elements are acceptable for identity shuffle mask. Also check FP types.
define <3 x float> @narrow_shuffle_of_select_undefs(<3 x i1> %cmp, <4 x float> %x, <4 x float> %y) {
OpenPOWER on IntegriCloud