Skip to content

Commit

Permalink
[VectorCombine] add test to check for iterative improvements; NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
rotateright committed May 12, 2020
1 parent 3d49d1c commit 93bd696
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions llvm/test/Transforms/VectorCombine/X86/insert-binop.ll
Expand Up @@ -48,6 +48,26 @@ define <2 x i64> @ins1_ins1_xor(i64 %x, i64 %y) {
ret <2 x i64> %r
}

define <2 x i64> @ins1_ins1_iterate(i64 %w, i64 %x, i64 %y, i64 %z) {
; CHECK-LABEL: @ins1_ins1_iterate(
; CHECK-NEXT: [[S0_SCALAR:%.*]] = sub i64 [[W:%.*]], [[X:%.*]]
; CHECK-NEXT: [[S0:%.*]] = insertelement <2 x i64> undef, i64 [[S0_SCALAR]], i64 1
; CHECK-NEXT: [[I2:%.*]] = insertelement <2 x i64> undef, i64 [[Y:%.*]], i32 1
; CHECK-NEXT: [[S1:%.*]] = or <2 x i64> [[S0]], [[I2]]
; CHECK-NEXT: [[I3:%.*]] = insertelement <2 x i64> undef, i64 [[Z:%.*]], i32 1
; CHECK-NEXT: [[S2:%.*]] = shl <2 x i64> [[I3]], [[S1]]
; CHECK-NEXT: ret <2 x i64> [[S2]]
;
%i0 = insertelement <2 x i64> undef, i64 %w, i64 1
%i1 = insertelement <2 x i64> undef, i64 %x, i32 1
%s0 = sub <2 x i64> %i0, %i1
%i2 = insertelement <2 x i64> undef, i64 %y, i32 1
%s1 = or <2 x i64> %s0, %i2
%i3 = insertelement <2 x i64> undef, i64 %z, i32 1
%s2 = shl <2 x i64> %i3, %s1
ret <2 x i64> %s2
}

; The inserts are free, but it's still better to scalarize.

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

0 comments on commit 93bd696

Please sign in to comment.