Skip to content

Commit 22ae8da

Browse files
committedOct 1, 2018
[InstCombine] add more insert-extract tests for D52439; NFC
The first attempt at this transform: rL343407 ...was reverted: rL343458 ...because it did not handle the case where we bitcast to FP. The patch was already limited to avoid the case where we bitcast from FP, but we might want to transform that too. llvm-svn: 343480
1 parent 94c5064 commit 22ae8da

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
 

‎llvm/test/Transforms/InstCombine/extractelement.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,29 @@ define i8 @bitcasted_inselt_wide_source_uses(i32 %x) {
139139
ret i8 %r
140140
}
141141

142+
define float @bitcasted_inselt_to_FP(i64 %x) {
143+
; ANY-LABEL: @bitcasted_inselt_to_FP(
144+
; ANY-NEXT: [[I:%.*]] = insertelement <2 x i64> undef, i64 [[X:%.*]], i32 0
145+
; ANY-NEXT: [[B:%.*]] = bitcast <2 x i64> [[I]] to <4 x float>
146+
; ANY-NEXT: [[R:%.*]] = extractelement <4 x float> [[B]], i32 1
147+
; ANY-NEXT: ret float [[R]]
148+
;
149+
%i = insertelement <2 x i64> undef, i64 %x, i32 0
150+
%b = bitcast <2 x i64> %i to <4 x float>
151+
%r = extractelement <4 x float> %b, i32 1
152+
ret float %r
153+
}
154+
155+
define i32 @bitcasted_inselt_from_FP(double %x) {
156+
; ANY-LABEL: @bitcasted_inselt_from_FP(
157+
; ANY-NEXT: [[I:%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
158+
; ANY-NEXT: [[B:%.*]] = bitcast <2 x double> [[I]] to <4 x i32>
159+
; ANY-NEXT: [[R:%.*]] = extractelement <4 x i32> [[B]], i32 1
160+
; ANY-NEXT: ret i32 [[R]]
161+
;
162+
%i = insertelement <2 x double> undef, double %x, i32 0
163+
%b = bitcast <2 x double> %i to <4 x i32>
164+
%r = extractelement <4 x i32> %b, i32 1
165+
ret i32 %r
166+
}
167+

0 commit comments

Comments
 (0)
Please sign in to comment.