[all-commits] [llvm/llvm-project] 2b2b84: [RISCV] For rv32, accept constants like 0xfffff800...

Craig Topper via All-commits all-commits at lists.llvm.org
Fri Feb 17 10:54:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b2b8409e6848361577be404bd0ae47a097f0e0c
      https://github.com/llvm/llvm-project/commit/2b2b8409e6848361577be404bd0ae47a097f0e0c
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
    M llvm/test/MC/RISCV/rv32c-only-valid.s
    A llvm/test/MC/RISCV/rv32i-only-valid.s
    A llvm/test/MC/RISCV/rvv/rv32-immediate.s

  Log Message:
  -----------
  [RISCV] For rv32, accept constants like 0xfffff800 as a valid simm12.

Internally we store constants in int64_t after parsing, but this is
kind of an implementation detail. If we only supported rv32, we might
have chosen int32_t.

For rv32, I think it makes sense to accept the constants that we
would accept if int32_t was the internal type. In fact we already
do this for the `li` alias. This patch extends this to sign
extended constants for other instructions.

This matches the GNU assembler. The difference between LLVM and gcc
was previously noted here. https://github.com/riscv-non-isa/riscv-asm-manual/pull/71

Reviewed By: reames

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




More information about the All-commits mailing list