llvm.org GIT mirror llvm / d095a2f
[InstSimplify] add tests for insert-of-extract; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361575 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 3 months ago
1 changed file(s) with 22 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4848 %B = insertelement <4 x i32> %A, i32 undef, i32 1
4949 ret <4 x i32> %B
5050 }
51
52 define <8 x i8> @extract_insert_same_vec_and_index(<8 x i8> %in) {
53 ; CHECK-LABEL: @extract_insert_same_vec_and_index(
54 ; CHECK-NEXT: [[VAL:%.*]] = extractelement <8 x i8> [[IN:%.*]], i32 5
55 ; CHECK-NEXT: [[VEC:%.*]] = insertelement <8 x i8> [[IN]], i8 [[VAL]], i32 5
56 ; CHECK-NEXT: ret <8 x i8> [[VEC]]
57 ;
58 %val = extractelement <8 x i8> %in, i32 5
59 %vec = insertelement <8 x i8> %in, i8 %val, i32 5
60 ret <8 x i8> %vec
61 }
62
63 define <8 x i8> @extract_insert_same_vec_and_index2(<8 x i8> %in, i32 %index) {
64 ; CHECK-LABEL: @extract_insert_same_vec_and_index2(
65 ; CHECK-NEXT: [[VAL:%.*]] = extractelement <8 x i8> [[IN:%.*]], i32 [[INDEX:%.*]]
66 ; CHECK-NEXT: [[VEC:%.*]] = insertelement <8 x i8> [[IN]], i8 [[VAL]], i32 [[INDEX]]
67 ; CHECK-NEXT: ret <8 x i8> [[VEC]]
68 ;
69 %val = extractelement <8 x i8> %in, i32 %index
70 %vec = insertelement <8 x i8> %in, i8 %val, i32 %index
71 ret <8 x i8> %vec
72 }