[llvm] r361575 - [InstSimplify] add tests for insert-of-extract; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 17:11:24 PDT 2019
Author: spatel
Date: Thu May 23 17:11:23 2019
New Revision: 361575
URL: http://llvm.org/viewvc/llvm-project?rev=361575&view=rev
Log:
[InstSimplify] add tests for insert-of-extract; NFC
Modified:
llvm/trunk/test/Transforms/InstSimplify/insertelement.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/insertelement.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/insertelement.ll?rev=361575&r1=361574&r2=361575&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/insertelement.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/insertelement.ll Thu May 23 17:11:23 2019
@@ -49,3 +49,25 @@ define <4 x i32> @PR1286(<4 x i32> %A) {
%B = insertelement <4 x i32> %A, i32 undef, i32 1
ret <4 x i32> %B
}
+
+define <8 x i8> @extract_insert_same_vec_and_index(<8 x i8> %in) {
+; CHECK-LABEL: @extract_insert_same_vec_and_index(
+; CHECK-NEXT: [[VAL:%.*]] = extractelement <8 x i8> [[IN:%.*]], i32 5
+; CHECK-NEXT: [[VEC:%.*]] = insertelement <8 x i8> [[IN]], i8 [[VAL]], i32 5
+; CHECK-NEXT: ret <8 x i8> [[VEC]]
+;
+ %val = extractelement <8 x i8> %in, i32 5
+ %vec = insertelement <8 x i8> %in, i8 %val, i32 5
+ ret <8 x i8> %vec
+}
+
+define <8 x i8> @extract_insert_same_vec_and_index2(<8 x i8> %in, i32 %index) {
+; CHECK-LABEL: @extract_insert_same_vec_and_index2(
+; CHECK-NEXT: [[VAL:%.*]] = extractelement <8 x i8> [[IN:%.*]], i32 [[INDEX:%.*]]
+; CHECK-NEXT: [[VEC:%.*]] = insertelement <8 x i8> [[IN]], i8 [[VAL]], i32 [[INDEX]]
+; CHECK-NEXT: ret <8 x i8> [[VEC]]
+;
+ %val = extractelement <8 x i8> %in, i32 %index
+ %vec = insertelement <8 x i8> %in, i8 %val, i32 %index
+ ret <8 x i8> %vec
+}
More information about the llvm-commits
mailing list