Skip to content

Commit dba637d

Browse files
committed
add test for extract from an index greater than the vector width of the destination
1 parent 2883558 commit dba637d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

llvm/test/Transforms/VectorCombine/X86/extract-fneg-insert.ll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,20 @@ define <2 x double> @ext1_v2f64_ins0(<2 x double> %x, <2 x double> %y) {
240240
ret <2 x double> %r
241241
}
242242

243+
; Negative test - extract from an index greater than the vector width of the destination
244+
define <2 x double> @ext3_v4f64v2f64(<4 x double> %x, <2 x double> %y) {
245+
; CHECK-LABEL: @ext3_v4f64v2f64(
246+
; CHECK-NEXT: [[E:%.*]] = extractelement <4 x double> [[X:%.*]], i32 3
247+
; CHECK-NEXT: [[N:%.*]] = fneg nsz double [[E]]
248+
; CHECK-NEXT: [[R:%.*]] = insertelement <2 x double> [[Y:%.*]], double [[N]], i32 1
249+
; CHECK-NEXT: ret <2 x double> [[R]]
250+
;
251+
%e = extractelement <4 x double> %x, i32 3
252+
%n = fneg nsz double %e
253+
%r = insertelement <2 x double> %y, double %n, i32 1
254+
ret <2 x double> %r
255+
}
256+
243257
define <4 x double> @ext1_v2f64v4f64_ins0(<2 x double> %x, <4 x double> %y) {
244258
; CHECK-LABEL: @ext1_v2f64v4f64_ins0(
245259
; CHECK-NEXT: [[E:%.*]] = extractelement <2 x double> [[X:%.*]], i32 1

0 commit comments

Comments
 (0)