[all-commits] [llvm/llvm-project] 2ad2c5: [RISCV] Add -mattr=+c command lines to add-before-...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Jul 20 09:23:36 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ad2c5d457bb625d93d9b9bf9c6d8bc7396334da
      https://github.com/llvm/llvm-project/commit/2ad2c5d457bb625d93d9b9bf9c6d8bc7396334da
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-07-20 (Tue, 20 Jul 2021)

  Changed paths:
    M llvm/test/CodeGen/RISCV/add-before-shl.ll

  Log Message:
  -----------
  [RISCV] Add -mattr=+c command lines to add-before-shl.ll to prepare for D105417. NFC


  Commit: 81efb825703c16ae659f3e17834ab011d06926e3
      https://github.com/llvm/llvm-project/commit/81efb825703c16ae659f3e17834ab011d06926e3
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-07-20 (Tue, 20 Jul 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.h
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/add-before-shl.ll
    M llvm/test/CodeGen/RISCV/double-mem.ll
    M llvm/test/CodeGen/RISCV/float-mem.ll
    M llvm/test/CodeGen/RISCV/half-mem.ll
    M llvm/test/CodeGen/RISCV/imm.ll
    M llvm/test/CodeGen/RISCV/rv64-large-stack.ll
    M llvm/test/CodeGen/RISCV/rv64zbp.ll
    M llvm/test/CodeGen/RISCV/rvv/constant-folding.ll
    M llvm/test/CodeGen/RISCV/urem-lkk.ll
    M llvm/test/MC/RISCV/rv64i-aliases-valid.s

  Log Message:
  -----------
  [RISCV] Teach RISCVMatInt about cases where it can use LUI+SLLI to replace LUI+ADDI+SLLI for large constants.

If we need to shift left anyway we might be able to take advantage
of LUI implicitly shifting its immediate left by 12 to cover part
of the shift. This allows us to use more bits of the LUI immediate
to avoid an ADDI.

isDesirableToCommuteWithShift now considers compressed instruction
opportunities when deciding if commuting should be allowed.

I believe this is the same or similar to one of the optimizations
from D79492.

Reviewed By: luismarques, arcbbb

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


Compare: https://github.com/llvm/llvm-project/compare/5b899c22f3d2...81efb825703c


More information about the All-commits mailing list