Skip to content

RISC-V assembler should accept compressed shift hints with 0 immediates #150304

@Timmmm

Description

@Timmmm

Currently if you try to assemble any of these instructions Clang will complain:

asm.s:49864:13: error: immediate must be an integer in the range [1, 63]
c.srli x14, 0x0
            ^
asm.s:50440:12: error: immediate must be an integer in the range [1, 63]
c.srai x9, 0x0
           ^
asm.s:188:12: error: immediate must be an integer in the range [1, 63]
c.slli x1, 0x0
           ^

These compressed shift instructions with a 0 immediate are HINTs, but I don't think that means you shouldn't be allowed to assemble them. You can assemble c.nop hints for example c.nop 1.

There probably isn't a practical use for this yet seeing as no meaning has been assigned to these hints (they are designated for custom use), but it would be nice if there was some valid syntax for representing them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions