[all-commits] [llvm/llvm-project] f7b096: [RISCV] Add more div by constant test cases.

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Dec 28 19:01:25 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7b096d754d6424f825d7e08af04b7ade985c77b
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-12-28 (Tue, 28 Dec 2021)

  Changed paths:
    A llvm/test/CodeGen/RISCV/div-by-constant.ll

  Log Message:
  [RISCV] Add more div by constant test cases.

Some constants require more instructions than others. This adds
additional test for each variation. UDIV has 2 variations, SDIV has
4 variations.

Some of these sequence may have gotten worse on RV32 when we started
doing the div by constant optimization before type legalization. We
materialized a smaller constant, but we require more instructions
to emulate 8 or 16 bit right shifts. This was hidden by the lack
of test coverage.

I've also added Zba and Zbb test cases to show the affect of sext.b,
sext.h, zext.h, and zext.w on some of the shifts. In some cases
we end up generating more code after the multiply because we use
a zext.h+srli and sext.h+srai where without Zbb we share a slli
between a srli and srai.

More information about the All-commits mailing list