[PATCH] D124293: [SLP][NFC] Pre-commit test showing deficiency in current roots selection algorithm
Valeriy Dmitriev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 12:55:07 PDT 2022
vdmitrie created this revision.
vdmitrie added reviewers: vporpo, RKSimon, ABataev.
Herald added a project: All.
vdmitrie requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The test case to show not quite optimal SLP vectorization.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124293
Files:
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
Index: llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
@@ -0,0 +1,59 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -slp-vectorizer -mattr=+avx2 -S | FileCheck %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define double @foo(double %a, double %b, double %c, double %d) local_unnamed_addr #0 {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> poison, double [[A:%.*]], i32 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x double> [[TMP1]], double [[B:%.*]], i32 1
+; CHECK-NEXT: [[TMP3:%.*]] = fdiv fast <2 x double> [[TMP2]], <double 7.000000e+00, double 5.000000e+00>
+; CHECK-NEXT: [[TMP4:%.*]] = extractelement <2 x double> [[TMP3]], i32 1
+; CHECK-NEXT: [[I11:%.*]] = fmul fast double [[TMP4]], undef
+; CHECK-NEXT: [[TMP5:%.*]] = fmul fast <2 x double> [[TMP3]], <double 3.000000e+00, double undef>
+; CHECK-NEXT: [[TMP6:%.*]] = fmul fast <2 x double> undef, [[TMP5]]
+; CHECK-NEXT: [[TMP7:%.*]] = fsub fast <2 x double> undef, [[TMP5]]
+; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <2 x double> [[TMP6]], <2 x double> [[TMP7]], <2 x i32> <i32 0, i32 3>
+; CHECK-NEXT: [[TMP9:%.*]] = insertelement <2 x double> <double undef, double poison>, double [[I11]], i32 1
+; CHECK-NEXT: [[TMP10:%.*]] = fsub fast <2 x double> [[TMP8]], [[TMP9]]
+; CHECK-NEXT: [[TMP11:%.*]] = fmul fast <2 x double> [[TMP8]], [[TMP9]]
+; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <2 x double> [[TMP10]], <2 x double> [[TMP11]], <2 x i32> <i32 0, i32 3>
+; CHECK-NEXT: [[TMP13:%.*]] = fmul fast <2 x double> [[TMP12]], <double 4.000000e+00, double 1.100000e+01>
+; CHECK-NEXT: [[TMP14:%.*]] = fsub fast <2 x double> [[TMP12]], <double 4.000000e+00, double 1.100000e+01>
+; CHECK-NEXT: [[TMP15:%.*]] = shufflevector <2 x double> [[TMP13]], <2 x double> [[TMP14]], <2 x i32> <i32 0, i32 3>
+; CHECK-NEXT: [[TMP16:%.*]] = fdiv fast <2 x double> [[TMP15]], <double 1.400000e+00, double 1.200000e+01>
+; CHECK-NEXT: [[TMP17:%.*]] = fmul fast <2 x double> [[TMP15]], <double 1.400000e+00, double 1.200000e+01>
+; CHECK-NEXT: [[TMP18:%.*]] = shufflevector <2 x double> [[TMP16]], <2 x double> [[TMP17]], <2 x i32> <i32 0, i32 3>
+; CHECK-NEXT: [[TMP19:%.*]] = fadd fast <2 x double> [[TMP18]], <double undef, double 1.400000e+00>
+; CHECK-NEXT: [[TMP20:%.*]] = fdiv fast <2 x double> [[TMP18]], <double undef, double 1.400000e+00>
+; CHECK-NEXT: [[TMP21:%.*]] = shufflevector <2 x double> [[TMP19]], <2 x double> [[TMP20]], <2 x i32> <i32 0, i32 3>
+; CHECK-NEXT: [[TMP22:%.*]] = extractelement <2 x double> [[TMP21]], i32 0
+; CHECK-NEXT: [[TMP23:%.*]] = extractelement <2 x double> [[TMP21]], i32 1
+; CHECK-NEXT: [[I16:%.*]] = fadd fast double [[TMP22]], [[TMP23]]
+; CHECK-NEXT: [[I17:%.*]] = fadd fast double [[I16]], [[C:%.*]]
+; CHECK-NEXT: [[I18:%.*]] = fadd fast double [[I17]], [[D:%.*]]
+; CHECK-NEXT: ret double [[I18]]
+;
+ %i01 = fdiv fast double %a, 7.0
+ %i02 = fmul fast double %i01, 3.0
+ %i03 = fmul fast double undef, %i02
+ %i04 = fsub fast double %i03, undef
+ %i05 = fmul fast double %i04, 4.0
+ %i06 = fdiv fast double %i05, 1.4
+ %i07 = fadd fast double undef, %i06
+ %i08 = fdiv fast double %b, 5.0
+ %i09 = fmul fast double %i08, undef
+ %i10 = fsub fast double undef, %i09
+ %i11 = fmul fast double %i08, undef
+ %i12 = fmul fast double %i10, %i11
+ %i13 = fsub fast double %i12, 11.0
+ %i14 = fmul fast double %i13, 12.0
+ %i15 = fdiv fast double %i14, 1.4
+ %i16 = fadd fast double %i07, %i15
+ %i17 = fadd fast double %i16, %c
+ %i18 = fadd fast double %i17, %d
+ ret double %i18
+}
+
+attributes #0 = { "unsafe-fp-math"="true" }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124293.424585.patch
Type: text/x-patch
Size: 3976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220422/60ddf998/attachment.bin>
More information about the llvm-commits
mailing list