[PATCH] D128572: [LoongArch] Add codegen support for division operations

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 24 20:37:42 PDT 2022


SixWeining created this revision.
SixWeining added reviewers: xen0n, MaskRay, xry111.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
SixWeining requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

These operations include sdiv/udiv/srem/urem.

As the ISA [https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_div_wudu_mod_wudu]
described, when the divisor is 0, the result can be any value, but no
exception will be triggered. Like what gcc does, we by default emit code
that checks divide-by-zero after the division or modulus instruction.
And this check can be disabled by passing the `-loongarch-no-check-zero-division`
option to llc.

Depends on D128433 <https://reviews.llvm.org/D128433>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128572

Files:
  llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
  llvm/lib/Target/LoongArch/LoongArchISelLowering.h
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
  llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
  llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128572.439948.patch
Type: text/x-patch
Size: 26788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220625/68cf24bf/attachment.bin>


More information about the llvm-commits mailing list