Skip to content

Commit 93bd696

Browse files
committed
[VectorCombine] add test to check for iterative improvements; NFC
1 parent 3d49d1c commit 93bd696

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

llvm/test/Transforms/VectorCombine/X86/insert-binop.ll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ define <2 x i64> @ins1_ins1_xor(i64 %x, i64 %y) {
4848
ret <2 x i64> %r
4949
}
5050

51+
define <2 x i64> @ins1_ins1_iterate(i64 %w, i64 %x, i64 %y, i64 %z) {
52+
; CHECK-LABEL: @ins1_ins1_iterate(
53+
; CHECK-NEXT: [[S0_SCALAR:%.*]] = sub i64 [[W:%.*]], [[X:%.*]]
54+
; CHECK-NEXT: [[S0:%.*]] = insertelement <2 x i64> undef, i64 [[S0_SCALAR]], i64 1
55+
; CHECK-NEXT: [[I2:%.*]] = insertelement <2 x i64> undef, i64 [[Y:%.*]], i32 1
56+
; CHECK-NEXT: [[S1:%.*]] = or <2 x i64> [[S0]], [[I2]]
57+
; CHECK-NEXT: [[I3:%.*]] = insertelement <2 x i64> undef, i64 [[Z:%.*]], i32 1
58+
; CHECK-NEXT: [[S2:%.*]] = shl <2 x i64> [[I3]], [[S1]]
59+
; CHECK-NEXT: ret <2 x i64> [[S2]]
60+
;
61+
%i0 = insertelement <2 x i64> undef, i64 %w, i64 1
62+
%i1 = insertelement <2 x i64> undef, i64 %x, i32 1
63+
%s0 = sub <2 x i64> %i0, %i1
64+
%i2 = insertelement <2 x i64> undef, i64 %y, i32 1
65+
%s1 = or <2 x i64> %s0, %i2
66+
%i3 = insertelement <2 x i64> undef, i64 %z, i32 1
67+
%s2 = shl <2 x i64> %i3, %s1
68+
ret <2 x i64> %s2
69+
}
70+
5171
; The inserts are free, but it's still better to scalarize.
5272

5373
define <2 x double> @ins0_ins0_fadd(double %x, double %y) {

0 commit comments

Comments
 (0)