[PATCH] D116886: [M68k][WIP] Make mul x -1 with neg x in instruction selection

Douglas Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 9 03:57:56 PST 2022


dougpuob created this revision.
Herald added a subscriber: hiraditya.
dougpuob requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch is trying to fix issue 48588(https://github.com/llvm/llvm-project/issues/48588)

I found the results of Instruction Selection between SelectionDAG and FastISEL for the `%mul = mul i32 %A, 4294967295`:
(seldag-isel) mul --> sub --> SUB32dp
(fast-isel)   mul --> sub --> NEG32d

My change to fix this issue by overriding a virtual function M68kDAGToDAGISel::IsProfitableToFold(). Return `false` when it was trying to match with SUB, then it will match wiht NEG.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116886

Files:
  llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp
  llvm/test/CodeGen/M68k/Arith/imul-neg.ll
  llvm/test/CodeGen/M68k/Arith/sub-with-overflow.ll
  llvm/test/CodeGen/M68k/Control/cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116886.398413.patch
Type: text/x-patch
Size: 4483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220109/a1edfd43/attachment.bin>


More information about the llvm-commits mailing list