On Sun, Jul 9, 2023 at 11:24 PM jacob navia <ja...@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