[PATCH] riscv: asm: use .insn for making custom instructioons

Ben Dooks ben.dooks at codethink.co.uk
Thu Oct 23 10:06:40 PDT 2025


On 17/10/2025 19:25, Paul Walmsley wrote:
> Hi Ben,
> 
> On Fri, 17 Oct 2025, Ben Dooks wrote:
> 
>> Using .word breaks with big endian builds, making something which
>> is not a valid or worse an instruction or pair that does something
>> which is not intended.
>>
>> It would seem sensible to add an ASM_INSN() wrapper for anyone to
>> use for hand assembly of instructions.
> 
> Looking at the GNU as documentation for RISC-V:
> 
>    https://sourceware.org/binutils/docs/as/RISC_002dV_002dDirectives.html
> 
> it seems that RISC-V .insn supports several argument formats that .4byte
> wouldn't.  So it seems this is only applicable for opcodes specified as
> hex bytes?  Might be worth adding that to the macro name in some form.

Changed it to ASM_INSN_I


> Also, looks like this is missing the opcodes added in commit
> 1d4ce63e338fc.  If you update this one, could you please add those as
> well?

I'll go change those too.

Thank you for the review.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html



More information about the linux-riscv mailing list