[PATCH] D95620: [RISCV] Support scalable-vector integer reduction intrinsics
Fraser Cormack via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 03:16:12 PST 2021
frasercrmck marked 2 inline comments as done.
frasercrmck added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1677
+ MVT M1VT = MVT::getScalableVectorVT(VecEltVT, NumElts);
+ SDValue Splat0 = DAG.getSplatVector(
+ M1VT, DL, DAG.getConstant(0, DL, Subtarget.getXLenVT()));
----------------
frasercrmck wrote:
> craig.topper wrote:
> > craig.topper wrote:
> > > Doesn't this need to be the identify value for the operation not always 0? I think AND would need -1. SMIN would need INT_MAX, SMAX would need INT_MIN, UMAX would need UINT_MAX.
> > > Doesn't this need to be the identify value for the operation not always 0? I think AND would need -1. SMIN would need INT_MAX, SMAX would need INT_MIN, UMAX would need UINT_MAX.
> >
> > Oops UMAX would need 0, UMIN would need UINT_MAX
> Wow, of course they would. Can't believe I missed that. Thanks! Must have been too focused on "add".
Okay that should be that. I had to ensure it's minIntN, maxIntN, maxUIntN for the element type. The splatting still recognises when it's sign-extended so generates e.g. `-1` for the INT_MIN cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95620/new/
https://reviews.llvm.org/D95620
More information about the llvm-commits
mailing list