Skip to content

Commit 92f94b7

Browse files
committed
[InstCombine] add tests for shuffle with insertelement operand; NFC
1 parent 3d41a58 commit 92f94b7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,3 +665,55 @@ define <4 x i8> @shuf_identity_padding_wrong_index(<2 x i8> %x, i8 %y) {
665665
%v2 = insertelement <4 x i8> %v1, i8 %y, i32 3
666666
ret <4 x i8> %v2
667667
}
668+
669+
define <4 x float> @insert_undemanded_element_op0(<4 x float> %x, <4 x float> %y) {
670+
; CHECK-LABEL: @insert_undemanded_element_op0(
671+
; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
672+
; CHECK-NEXT: call void @use(<4 x float> [[INS]])
673+
; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[INS]], <4 x float> [[Y:%.*]], <4 x i32> <i32 0, i32 7, i32 1, i32 4>
674+
; CHECK-NEXT: ret <4 x float> [[S]]
675+
;
676+
%ins = insertelement <4 x float> %x, float 42.0, i32 3
677+
call void @use(<4 x float> %ins)
678+
%s = shufflevector <4 x float> %ins, <4 x float> %y, <4 x i32> <i32 0, i32 7, i32 1, i32 4>
679+
ret <4 x float> %s
680+
}
681+
682+
define <4 x float> @insert_undemanded_element_op1(<4 x float> %x, <4 x float> %y) {
683+
; CHECK-LABEL: @insert_undemanded_element_op1(
684+
; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
685+
; CHECK-NEXT: call void @use(<4 x float> [[INS]])
686+
; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[INS]], <4 x i32> <i32 3, i32 2, i32 1, i32 4>
687+
; CHECK-NEXT: ret <4 x float> [[S]]
688+
;
689+
%ins = insertelement <4 x float> %x, float 42.0, i32 3
690+
call void @use(<4 x float> %ins)
691+
%s = shufflevector <4 x float> %y, <4 x float> %ins, <4 x i32> <i32 3, i32 2, i32 1, i32 4>
692+
ret <4 x float> %s
693+
}
694+
695+
define <4 x float> @insert_demanded_element_op0(<4 x float> %x, <4 x float> %y) {
696+
; CHECK-LABEL: @insert_demanded_element_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:%.*]], <4 x i32> <i32 3, i32 2, i32 1, i32 4>
700+
; CHECK-NEXT: ret <4 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, <4 x i32> <i32 3, i32 2, i32 1, i32 4>
705+
ret <4 x float> %s
706+
}
707+
708+
define <4 x float> @insert_demanded_element_op1(<4 x float> %x, <4 x float> %y) {
709+
; CHECK-LABEL: @insert_demanded_element_op1(
710+
; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.300000e+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]], <4 x i32> <i32 0, i32 7, i32 1, i32 4>
713+
; CHECK-NEXT: ret <4 x float> [[S]]
714+
;
715+
%ins = insertelement <4 x float> %x, float 43.0, i32 3
716+
call void @use(<4 x float> %ins)
717+
%s = shufflevector <4 x float> %y, <4 x float> %ins, <4 x i32> <i32 0, i32 7, i32 1, i32 4>
718+
ret <4 x float> %s
719+
}

0 commit comments

Comments
 (0)