[PATCH] D99479: [RISCV] Add custom type legalization to form MULHSU when possible.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 28 17:20:33 PDT 2021


craig.topper created this revision.
craig.topper added reviewers: asb, luismarques, frasercrmck.
Herald added subscribers: StephenFan, vkmr, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, JDevlieghere, simoncook, johnrusso, rbar, hiraditya.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

There's no target independent ISD opcode for MULHSU, so custom
legalize 2*XLen multiplies ourselves. We have to be a little
careful to prefer MULHU or MULHSU.

I thought about doing this in isel by pattern matching the
(add (mul X, (srai Y, XLen-1)), (mulhu X, Y)) pattern. I decided
against this because the add might become part of a chain of adds.
I don't trust DAG combine not to reassociate with other adds making
it difficult to find both pieces again.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99479

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/lib/Target/RISCV/RISCVInstrInfoM.td
  llvm/test/CodeGen/RISCV/mul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99479.333750.patch
Type: text/x-patch
Size: 5803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210329/56886ef6/attachment.bin>


More information about the llvm-commits mailing list