[SLP][NFC] Pre-commit test showing vectorization preventing FMA
authorWilliam Schmidt <william.schmidt@intel.com>
Wed, 18 May 2022 20:51:47 +0000 (13:51 -0700)
committerWilliam Schmidt <william.schmidt@intel.com>
Thu, 19 May 2022 13:57:24 +0000 (06:57 -0700)
commitd633dbd195732fe2e343297c37afcb2c3be71d14
tree93bfac3a4c6e9a83d49aefa14f7fd6846b31b5bf
parent068f14f1e4ec69d218df544487f9420f2b3ab29b
[SLP][NFC] Pre-commit test showing vectorization preventing FMA

When we generate a horizontal reduction of floating adds fed by a vectorized
tree rooted at floating multiplies, we should account for the cost of no
longer being able to generate scalar FMAs.  Similarly, if we vectorize a
list of floating multiplies that each feeds a single floating add, we should
again account for this cost.

The first test was reduced from a case where the vectorizable tree looked
barely profitable (cost -1) with a horizontal reduction, but produced
substantially worse code than allowing the FMAs to be generated.  The second
test was derived from the first: we again generate a horizontal reduction
here, but even if the horizontal reduction is forced to be unprofitable, we
try to vectorize the multiplies.  I have follow-up patches to address these
issues.

Differential Revision: https://reviews.llvm.org/D124867
llvm/test/Transforms/SLPVectorizer/X86/slp-fma-loss.ll [new file with mode: 0644]