[all-commits] [llvm/llvm-project] d29215: [LoongArch] Add codegen support for division opera...

Lu Weining via All-commits all-commits at lists.llvm.org
Wed Jul 6 02:56:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d29215790f0ff1ef9772c38ffe59e42fa9450db0
      https://github.com/llvm/llvm-project/commit/d29215790f0ff1ef9772c38ffe59e42fa9450db0
  Author: Weining Lu <luweining at loongson.cn>
  Date:   2022-07-06 (Wed, 06 Jul 2022)

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

  Log Message:
  -----------
  [LoongArch] Add codegen support for division operations

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. Unlike gcc, which by default emit code
that checks divide-by-zero after the division or modulus instruction,
we only emit this check when the `-loongarch-check-zero-division`
option is passed.

Differential Revision: https://reviews.llvm.org/D128572




More information about the All-commits mailing list