https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120433

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
           Keywords|                            |inline-asm
             Status|WAITING                     |RESOLVED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What are you trying to implement?
inline-asm to an system call?
Or something else?

If then this is the correct inline-asm for what you want:
```
__attribute__((noinline)) uint32_t a0_in_asm() {
register uint32_t a0 asm("a0");
    asm volatile (
        "lui a0, 0xFFFF\n"
        "slli a0, a0, 0x4\n"
        "addi a0, a0, 0x231\n"
        "ecall\n" :"=&r"(a0) : : "memory"
    );
  return a0;
}
```

Anything else is undefined as you don't specify the return value of a0_in_asm
and you don't specify that a0 usage will change the register, etc.

Reply via email to