[all-commits] [llvm/llvm-project] f2bbb4: [GISel][RISCV] Legalize `G_{U|S}DIVREM` (#93067)

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Wed May 22 10:27:10 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f2bbb4cb3e211de82987b280aa98565bd3ff6ce7
      https://github.com/llvm/llvm-project/commit/f2bbb4cb3e211de82987b280aa98565bd3ff6ce7
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2024-05-23 (Thu, 23 May 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
    M llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-div-rv32.mir
    M llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-div-rv64.mir

  Log Message:
  -----------
  [GISel][RISCV] Legalize `G_{U|S}DIVREM` (#93067)

This patch expands `G_{U|S}DIVREM` into `G_{U|S}DIV + G_{U|S}REM`.
`G_{U|S}DIVREM` is generated by the following fold:

https://github.com/llvm/llvm-project/blob/4ea21a0261cd8599a9ffa15f5c554ab0d4bbbe27/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp#L1410-L1471

It always folds `div + rem` pairs into `divrem` during pre-legalization.
I tried to change `isLegalOrBeforeLegalizer` to `isLegal`, but it
produced worse codegen on AArch64.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list