[PATCH] D146494: [X86] Combine constant vector inputs for FMA
Evgenii Kudriashov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 19:11:04 PDT 2023
e-kud marked 8 inline comments as done.
e-kud added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:54178
+ if (auto *Cst = dyn_cast<ConstantFPSDNode>(op)) {
+ if (Cst->isNegative())
+ return SDValue();
----------------
goldstein.w.n wrote:
> e-kud wrote:
> > RKSimon wrote:
> > > Couldn't both V and NV have negative values now that they aren't splats?
> > It seems to me that they can't. If `V` is `<x0, x1, ..., xn>` then `NV` is `<-x0, -x1, ..., -xn>`. So, `V` and `NV` always have elements of different sign. The corner case is `V` consisting only of `undef`s. But original and negated versions of such vector are the same. So, everything should be handled well.
> But couldn't both `V` and `NV` contain some negative and some positive values?
The idea here is to prefer a vector that has the first negative operand. We don't care about other operands. A negative value can be only in `V` or `NV` not in both.
But here is a pitfall that instead of FP value we may meet undef, That's why we iterate over operands until the first non-undef value is met. `V` and `NV` have undefs on same places.
So, `V` and `NV` may contain both negative and positive values but we consider only the first non-undef operand.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146494/new/
https://reviews.llvm.org/D146494
More information about the llvm-commits
mailing list