public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Tiny asm (continued)
@ 2023-07-10  6:23 jacob navia
  2023-07-10  6:26 ` Andrew Pinski
  0 siblings, 1 reply; 2+ messages in thread
From: jacob navia @ 2023-07-10  6:23 UTC (permalink / raw)
  To: gcc

Hi
The assembler checks at each instruction if the instruction is within the selected subset of risc-v extensions or not. I do not quite understand why this check is done here.

I suppose that gcc, before emitting any instruction does this check too, somewhere. Because if an instruction is emitted to the assembler and the assembler rejects it, there is no way to pass that information back to the compiler, and emitting an obscure error message about some instruction not being legal will not help the user at all that probably doesn’t know any assembler language.

I would like to drop this test in tiny-asm, but I am not 100% sure that it is really redundant. The checks are expensive to do, and they are done at EACH instruction...

In the other hand, if the assembler doesn’t catch a faulty instruction, the user will know that at runtime (maybe) with an illegal instruction exception or similar… That would make bugs very difficult to find.

Question then: can the assembler assume that gcc emits correct instructions?

Thanks in advance for your attention.

Jacob

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tiny asm (continued)
  2023-07-10  6:23 Tiny asm (continued) jacob navia
@ 2023-07-10  6:26 ` Andrew Pinski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Pinski @ 2023-07-10  6:26 UTC (permalink / raw)
  To: jacob navia; +Cc: gcc

On Sun, Jul 9, 2023 at 11:24 PM jacob navia <jacob@jacob.remcomp.fr> wrote:
>
> Hi
> The assembler checks at each instruction if the instruction is within the selected subset of risc-v extensions or not. I do not quite understand why this check is done here.
>
> I suppose that gcc, before emitting any instruction does this check too, somewhere. Because if an instruction is emitted to the assembler and the assembler rejects it, there is no way to pass that information back to the compiler, and emitting an obscure error message about some instruction not being legal will not help the user at all that probably doesn’t know any assembler language.
>
> I would like to drop this test in tiny-asm, but I am not 100% sure that it is really redundant. The checks are expensive to do, and they are done at EACH instruction...
>
> In the other hand, if the assembler doesn’t catch a faulty instruction, the user will know that at runtime (maybe) with an illegal instruction exception or similar… That would make bugs very difficult to find.
>
> Question then: can the assembler assume that gcc emits correct instructions?

Two things, inline-asm and hand written assembly code.

>
> Thanks in advance for your attention.
>
> Jacob

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-10  6:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-10  6:23 Tiny asm (continued) jacob navia
2023-07-10  6:26 ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).