Skip to content

Commit 7457fe3

Browse files
committed
[InstCombine][NFC] Precommit new tests
1 parent c87a4a4 commit 7457fe3

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,32 @@ define <4 x float> @insert_undemanded_element_op1(<4 x float> %x, <4 x float> %y
692692
ret <4 x float> %s
693693
}
694694

695+
define <5 x float> @insert_undemanded_element_unequal_length_op0(<4 x float> %x, <4 x float> %y) {
696+
; CHECK-LABEL: @insert_undemanded_element_unequal_length_op0(
697+
; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
698+
; CHECK-NEXT: call void @use(<4 x float> [[INS]])
699+
; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[INS]], <4 x float> [[Y:%.*]], <5 x i32> <i32 undef, i32 0, i32 7, i32 1, i32 4>
700+
; CHECK-NEXT: ret <5 x float> [[S]]
701+
;
702+
%ins = insertelement <4 x float> %x, float 42.0, i32 3
703+
call void @use(<4 x float> %ins)
704+
%s = shufflevector <4 x float> %ins, <4 x float> %y, <5 x i32> <i32 undef, i32 0, i32 7, i32 1, i32 4>
705+
ret <5 x float> %s
706+
}
707+
708+
define <5 x float> @insert_undemanded_element_unequal_length_op1(<4 x float> %x, <4 x float> %y) {
709+
; CHECK-LABEL: @insert_undemanded_element_unequal_length_op1(
710+
; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
711+
; CHECK-NEXT: call void @use(<4 x float> [[INS]])
712+
; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[INS]], <5 x i32> <i32 undef, i32 3, i32 2, i32 1, i32 4>
713+
; CHECK-NEXT: ret <5 x float> [[S]]
714+
;
715+
%ins = insertelement <4 x float> %x, float 42.0, i32 3
716+
call void @use(<4 x float> %ins)
717+
%s = shufflevector <4 x float> %y, <4 x float> %ins, <5 x i32> <i32 undef, i32 3, i32 2, i32 1, i32 4>
718+
ret <5 x float> %s
719+
}
720+
695721
; Negative test - shuffle chooses the inserted constant.
696722

697723
define <4 x float> @insert_demanded_element_op0(<4 x float> %x, <4 x float> %y) {
@@ -722,6 +748,36 @@ define <4 x float> @insert_demanded_element_op1(<4 x float> %x, <4 x float> %y)
722748
ret <4 x float> %s
723749
}
724750

751+
; Negative test - shuffle chooses the inserted constant.
752+
753+
define <5 x float> @insert_demanded_element_unequal_length_op0(<4 x float> %x, <4 x float> %y) {
754+
; CHECK-LABEL: @insert_demanded_element_unequal_length_op0(
755+
; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
756+
; CHECK-NEXT: call void @use(<4 x float> [[INS]])
757+
; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[INS]], <4 x float> [[Y:%.*]], <5 x i32> <i32 undef, i32 3, i32 2, i32 1, i32 4>
758+
; CHECK-NEXT: ret <5 x float> [[S]]
759+
;
760+
%ins = insertelement <4 x float> %x, float 42.0, i32 3
761+
call void @use(<4 x float> %ins)
762+
%s = shufflevector <4 x float> %ins, <4 x float> %y, <5 x i32> <i32 undef, i32 3, i32 2, i32 1, i32 4>
763+
ret <5 x float> %s
764+
}
765+
766+
; Negative test - shuffle chooses the inserted constant.
767+
768+
define <5 x float> @insert_demanded_element_unequal_length_op1(<4 x float> %x, <4 x float> %y) {
769+
; CHECK-LABEL: @insert_demanded_element_unequal_length_op1(
770+
; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.300000e+01, i32 3
771+
; CHECK-NEXT: call void @use(<4 x float> [[INS]])
772+
; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[INS]], <5 x i32> <i32 undef, i32 0, i32 7, i32 1, i32 4>
773+
; CHECK-NEXT: ret <5 x float> [[S]]
774+
;
775+
%ins = insertelement <4 x float> %x, float 43.0, i32 3
776+
call void @use(<4 x float> %ins)
777+
%s = shufflevector <4 x float> %y, <4 x float> %ins, <5 x i32> <i32 undef, i32 0, i32 7, i32 1, i32 4>
778+
ret <5 x float> %s
779+
}
780+
725781
define <4 x float> @splat_constant(<4 x float> %x) {
726782
; CHECK-LABEL: @splat_constant(
727783
; CHECK-NEXT: [[INS3:%.*]] = insertelement <4 x float> [[X:%.*]], float 3.000000e+00, i32 3

0 commit comments

Comments
 (0)