Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/test/MC/RISCV/rv32c-valid.s
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ c.sub a4, a5
# CHECK-ASM: encoding: [0x01,0x00]
# CHECK-NO-EXT: error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
c.nop
# CHECK-ASM: c.addi zero, 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec says "C.ADDI is only valid when rd≠x0 and imm≠0".

Copy link
Collaborator Author

@topperc topperc Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, but this syntax is supported by binutils. We have internal tests from our hardware validation team that uses this syntax.

The isa-manual used to say "C.NOP is encoded as c.addi x0, 0 and so expands to addi x0, x0, 0. Breakpoint Instruction." but it was changed 6 years ago. riscv/riscv-isa-manual#248

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, but this syntax is supported by binutils.

Make sense to me.

# CHECK-OBJ: c.nop
# CHECK-ASM: encoding: [0x01,0x00]
# CHECK-NO-EXT: error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
c.addi x0, 0
# CHECK-ASM-AND-OBJ: c.ebreak
# CHECK-ASM: encoding: [0x02,0x90]
# CHECK-NO-EXT: error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
Expand Down
Loading