[llvm] 93bd696 - [VectorCombine] add test to check for iterative improvements; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue May 12 09:50:10 PDT 2020
Author: Sanjay Patel
Date: 2020-05-12T12:49:25-04:00
New Revision: 93bd696347aa6348af8d2b042910d5e9226cfbd8
URL: https://github.com/llvm/llvm-project/commit/93bd696347aa6348af8d2b042910d5e9226cfbd8
DIFF: https://github.com/llvm/llvm-project/commit/93bd696347aa6348af8d2b042910d5e9226cfbd8.diff
LOG: [VectorCombine] add test to check for iterative improvements; NFC
Added:
Modified:
llvm/test/Transforms/VectorCombine/X86/insert-binop.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/VectorCombine/X86/insert-binop.ll b/llvm/test/Transforms/VectorCombine/X86/insert-binop.ll
index 5773db3399a4..17b30862f617 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) {
More information about the llvm-commits
mailing list