[PATCH] D143283: [AArch64][SVE]: custom lower AVGFloor/AVGCeil.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 05:46:30 PST 2023
sdesmalen added inline comments.
================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:13391
+ if (ISD::isConstantSplatVector(Node.getOperand(1).getNode(), SplatVal))
+ if (SplatVal.isMask() && SplatVal.countPopulation() <
+ Node->getValueType(0).getScalarSizeInBits())
----------------
hassnaa-arm wrote:
> dmgreen wrote:
> > Can it use countTrailingOnes as opposed to countPopulation? Although I think these functions might be better removed and use computeKnownBits checks instead.
> I think using countTrailingOnes is much simpler than computeKnownBits because the operand and its value are already known.
I presume that @dmgreen meant using `computeKnownBits` on `Node` as a whole, not specifically on the splatted value so that you don't need to check for the opcode explicitly.
See for example `checkZExtBool`, where it does:
APInt RequredZero(SizeInBits, 0xFE);
KnownBits Bits = DAG.computeKnownBits(Arg, 4);
bool ZExtBool = (Bits.Zero & RequredZero) == RequredZero;
You can probably do a similar thing for `IsSignExtended`, but then looking at the `Bits.One` instead of `Bits.Zero`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143283/new/
https://reviews.llvm.org/D143283
More information about the llvm-commits
mailing list