[PATCH] D135991: [AArch64] Fix cost model for `udiv` instruction when one of the operands is a uniform constant

Zain Jaffal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 07:07:08 PST 2022


zjaffal marked 2 inline comments as done.
zjaffal added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:2117
+            InstructionCost DivCost = BaseT::getArithmeticInstrCost(
+                Instruction::UDiv, Ty->getScalarType(), CostKind, Op1Info,
+                Op2Info);
----------------
dmgreen wrote:
> zjaffal wrote:
> > dmgreen wrote:
> > > Should UDiv be Opcode, to handle SDiv a little better?
> > Do you mean using `ISD::UDiv` instead of `Instruction::UDiv`. 
> > I tried that but it get the following error if I do that 
> > ```
> > Assertion failed: (ISD && "Invalid opcode"), function getArithmeticInstrCost, file BasicTTIImpl.h, line 834.
> > ```
> > We can do the following instead 
> > ```
> > int Opcdoe = (ISD == ISD::UDIV) ? Instruction::UDiv : Instruction::SDiv;
> > ```
> I just meant the variable/argument `Opcode` - as far as I understand it could be UDiv or SDiv here.
We can do the following then
```
int Opcdoe = (ISD == ISD::UDIV) ? Instruction::UDiv : Instruction::SDiv;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135991



More information about the llvm-commits mailing list