[PATCH] D117210: [CodeGen] Support folds of not(cmp(cc, ...)) -> cmp(!cc, ...) for scalable vectors
Fraser Cormack via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 18 08:07:23 PST 2022
frasercrmck added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:3175
+ isa<ConstantSDNode>(N->getOperand(0))) {
+ CVal = cast<ConstantSDNode>(N->getOperand(0))->getAPIntValue();
} else {
----------------
david-arm wrote:
> frasercrmck wrote:
> > I think we have to support the truncating case as with `BUILD_VECTOR` above, don't we?
> Hmm, I looked at the definition of SPLAT_VECTOR and you're right - the operand is allowed to be wider than the vector element type of the result. I hadn't realised that :(. The only problem is that I have absolutely no idea how to write a test case for this using IR! I'm not sure if there is a way to create a splat (using SPLAT_VECTOR) in IR that is truncating. Unless you know of any RISCV examples where this would happen?
Hmm, it would definitely happen during legalization as we only have either i32 (RV32) or i64 (RV64) as legal integer types, so most splats, really, like `<vscale x 1 x i8>` with a constant integer. But you'd need to be calling this during/after legalization. So no I'm not sure it's testable, per se. What you've got looks right, though?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117210/new/
https://reviews.llvm.org/D117210
More information about the llvm-commits
mailing list