[all-commits] [llvm/llvm-project] d4facd: [TargetLowering][RISCV][X86] Support even divisors...

Craig Topper via All-commits all-commits at lists.llvm.org
Mon Oct 10 11:02:45 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4facda414b6b9b8b1a34bc7e6b7c15172775318
      https://github.com/llvm/llvm-project/commit/d4facda414b6b9b8b1a34bc7e6b7c15172775318
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-10-10 (Mon, 10 Oct 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/RISCV/split-udiv-by-constant.ll
    M llvm/test/CodeGen/RISCV/split-urem-by-constant.ll
    M llvm/test/CodeGen/X86/divide-by-constant.ll
    M llvm/test/CodeGen/X86/divmod128.ll

  Log Message:
  -----------
  [TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.

If the divisor is even, we can first shift the dividend and divisor
right by the number of trailing zeros. Now the divisor is odd and we
can do the original algorithm to calculate a remainder. Then we shift
that remainder left by the number of trailing zeros and add the bits
that were shifted out of the dividend.

Reviewed By: RKSimon

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




More information about the All-commits mailing list