From: Sanjay Patel Date: Tue, 12 May 2020 16:48:51 +0000 (-0400) Subject: [VectorCombine] add test to check for iterative improvements; NFC X-Git-Tag: llvmorg-12-init~6270 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93bd696347aa6348af8d2b042910d5e9226cfbd8;p=platform%2Fupstream%2Fllvm.git [VectorCombine] add test to check for iterative improvements; NFC --- diff --git a/llvm/test/Transforms/VectorCombine/X86/insert-binop.ll b/llvm/test/Transforms/VectorCombine/X86/insert-binop.ll index 5773db3..17b3086 100644 --- a/llvm/test/Transforms/VectorCombine/X86/insert-binop.ll +++ b/llvm/test/Transforms/VectorCombine/X86/insert-binop.ll @@ -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) {