[PATCH] D42834: [RISCV] Implement c.lui immedate operand constraint

Ana Pazos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 15:01:04 PST 2018


apazos added a comment.

Hi Alex, I think you are right, the crashes were due to c.addi and c.addi16sp, which Shiva fixed in separate patch. I tested both patches together tough.

I think what broke was the assembler step when we were hand-modifying the test case to run on qemu to find out the offending instructions.

GCC assembler rejected:
echo 'c.lui x8, 32' |riscv32-unknown-linux-gnu-as  -o sai -c -mabi=ilp32 -march=rv32gc
{standard input}: Assembler messages:
{standard input}:1: Error: illegal operands `c.lui x8,32'

while LLVM is accepting it:
echo 'c.lui x8, 32' |llvm-mc -triple=riscv32 -mattr=+c --show-encoding

  .text
  c.lui   s0, 32                  # encoding: [0x01,0x74]

which is fixed with this patch:

echo 'c.lui x8, 32' |llvm-mc -triple=riscv32 -mattr=+c --show-encoding

  .text

<stdin>:1:11: error: immediate must be in [0xfffe0, 0xfffff] or [1, 31]
c.lui x8, 32


Repository:
  rL LLVM

https://reviews.llvm.org/D42834





More information about the llvm-commits mailing list