[PATCH] D96210: [TargetLowering][RISCV][AArch64][PowerPC] Enable BuildUDIV/BuildSDIV on illegal types before type legalization if we can find a larger legal type that supports MUL.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 10:08:07 PST 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:5187
+          DAG.getConstant(EltBits, dl,
+                          getShiftAmountTy(MulVT, DAG.getDataLayout())));
+      return DAG.getNode(ISD::TRUNCATE, dl, VT, Y);
----------------
RKSimon wrote:
> craig.topper wrote:
> > RKSimon wrote:
> > > Pre-legalization shift amount is always nasty - is there any chance that this can be out of range?
> > MulVT here is a legal type so the shift should be legal. So I think the target better be returning a shift amount type that should cover all possible amounts.
> Would getShiftAmountConstant be safer?
It's shorter. I don't think its safer though. It just chooses between getScalarShiftAmountTy and PointerTy. It doesn't check that the constant fits.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96210/new/

https://reviews.llvm.org/D96210



More information about the llvm-commits mailing list