[llvm] 3ba090e - [InstSimplify][test] add test for extract of splat; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 24 10:15:09 PDT 2021
Author: Sanjay Patel
Date: 2021-06-24T13:13:35-04:00
New Revision: 3ba090e5f69ae7bd6548dfdb4b7124d0470cfd48
URL: https://github.com/llvm/llvm-project/commit/3ba090e5f69ae7bd6548dfdb4b7124d0470cfd48
DIFF: https://github.com/llvm/llvm-project/commit/3ba090e5f69ae7bd6548dfdb4b7124d0470cfd48.diff
LOG: [InstSimplify][test] add test for extract of splat; NFC
This is shown in:
https://llvm.org/PR50817
Added:
Modified:
llvm/test/Transforms/InstSimplify/extract-element.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/extract-element.ll b/llvm/test/Transforms/InstSimplify/extract-element.ll
index 3a9abf63b09d..8259598a3ea5 100644
--- a/llvm/test/Transforms/InstSimplify/extract-element.ll
+++ b/llvm/test/Transforms/InstSimplify/extract-element.ll
@@ -27,7 +27,6 @@ define i129 @vec_extract_out_of_bounds2(<3 x i129> %a) {
ret i129 %E1
}
-
define i129 @vec_extract_undef_index(<3 x i129> %a) {
; CHECK-LABEL: @vec_extract_undef_index(
; CHECK-NEXT: ret i129 poison
@@ -36,7 +35,6 @@ define i129 @vec_extract_undef_index(<3 x i129> %a) {
ret i129 %E1
}
-
define i129 @vec_extract_poison_index(<3 x i129> %a) {
; CHECK-LABEL: @vec_extract_poison_index(
; CHECK-NEXT: ret i129 poison
@@ -45,7 +43,6 @@ define i129 @vec_extract_poison_index(<3 x i129> %a) {
ret i129 %E1
}
-
define i129 @vec_extract_in_bounds(<3 x i129> %a) {
; CHECK-LABEL: @vec_extract_in_bounds(
; CHECK-NEXT: [[E1:%.*]] = extractelement <3 x i129> [[A:%.*]], i129 2
@@ -63,3 +60,15 @@ define float @extract_element_splat_constant_vector_variable_index(i32 %y) {
ret float %r
}
+define i32 @extractelement_splat_variable_index(i32 %v, i32 %index) {
+; CHECK-LABEL: @extractelement_splat_variable_index(
+; CHECK-NEXT: [[IN:%.*]] = insertelement <3 x i32> poison, i32 [[V:%.*]], i32 0
+; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <3 x i32> [[IN]], <3 x i32> poison, <3 x i32> zeroinitializer
+; CHECK-NEXT: [[R:%.*]] = extractelement <3 x i32> [[SPLAT]], i32 [[INDEX:%.*]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %in = insertelement <3 x i32> poison, i32 %v, i32 0
+ %splat = shufflevector <3 x i32> %in, <3 x i32> poison, <3 x i32> zeroinitializer
+ %r = extractelement <3 x i32> %splat, i32 %index
+ ret i32 %r
+}
More information about the llvm-commits
mailing list