tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] asm syntax of riscv64-asm.c


From: Ekaitz Zarraga
Subject: Re: [Tinycc-devel] asm syntax of riscv64-asm.c
Date: Sat, 17 Aug 2024 19:07:43 +0200


Hi,

On 2024-08-17 18:49, noneofyourbusiness wrote:
> Ekaitz Zarraga <ekaitz@elenq.tech> wrote:
>> ```
>> ld rd, rs, offset
>> ```
>>
>> It even had the input registers inverted in the store instruction. I
>> converted it to:
> I don't see what is wrong with this,
>   ld rd, rs, offset
> closely follows the layout of the encoding:
>   I-Type:
>    imm[11:0] | rs1 | funct3 | rd | opcode
> yes, it's antisymmetric, but I think the other way around (offset, rs, rd ld) is even more inconvenient.

The only wrong thing is that people don't expect this assembler and I don't know if it makes any sense to invent our own assembler and make existing programs impossible to build using TinyCC. With the current TinyCC and the changes we introduced we can build Musl and GCC 4.6.4.

>> ```
>> ld rd, offset(rs)
>> ```
>>
>> As it should be.
> I'd simply consider this a pseudoinstruction.

Well, we can implement the other thing internally and translate from this system to the other.

>> all the structure of the assembler is designed for the old (and
>> non-standard) syntax. It needs more work.
> Can you point me to the standard on RISC-V assembly syntax?
> I could find ratified specs for instructions, not asm syntax.

I'm not 100% sure if there's a document for it.
This is something:
https://github.com/riscv-non-isa/riscv-asm-manual/blob/main/riscv-asm.md

The RISC-V people implemented their designs for GCC and Binutils and left those as a reference. We should follow what those do:
https://sourceware.org/binutils/docs/as/RISC_002dV_002dFormats.html

Best,
Ekaitz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]