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

Craig Topper via All-commits all-commits at lists.llvm.org
Sat Oct 22 23:47:58 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6a7b47820904c5e69cc4f133d382c74a87c44e8
      https://github.com/llvm/llvm-project/commit/f6a7b47820904c5e69cc4f133d382c74a87c44e8
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-10-22 (Sat, 22 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