[all-commits] [llvm/llvm-project] 564e09: [RISCV] Use bseti for 2048 in RISCVMatInt when Zbs...

Craig Topper via All-commits all-commits at lists.llvm.org
Wed Dec 7 20:17:24 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 564e09c77870425d852f583c5aeb4dec57846ed7
      https://github.com/llvm/llvm-project/commit/564e09c77870425d852f583c5aeb4dec57846ed7
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-12-07 (Wed, 07 Dec 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
    M llvm/test/CodeGen/RISCV/imm.ll
    M llvm/test/MC/RISCV/rv32zbs-aliases-valid.s
    M llvm/test/MC/RISCV/rv64zbs-aliases-valid.s

  Log Message:
  -----------
  [RISCV] Use bseti for 2048 in RISCVMatInt when Zbs is enabled.

2048 requires an LUI and ADDI instruction due to ADDI using a
signed immediate. It can also be done with C.LI+C.SLLI for better
code size.

With Zbs we can use a single BSETI to have an instruction.

Reorder the checks so that BSETI is checked first, with an extra
qualification to prefer a single LUI or ADDI when possible. I'm
continuing to think about other ways to structure this code, but
this works for now.

Fixes PR59362.




More information about the All-commits mailing list