https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99342
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
Target| |aarch64
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Stewart Hildebrand from comment #4)
> Created attachment 50287 [details]
> Simplified test case
>
> I simplified the test case - hopefully this should make it clearer. This:
>
> asm volatile("\n"
> "ldr x0, %0 \n"
> "ldr x1, %1 \n"
> "ldr x2, %2 \n"
> : // No output operands
> : // Inputs:
> "Q"(s_current->_state.fp), "Ump"(s_current->_state.sp),
> "Ump"(this->_state.fp)
> : // Clobbers:
> // Registers we use here
> "x0", "x1", "x2",
> // Callee-saved registers (general purpose)
> "x19", "x20", "x21", "x22", "x23", "x24",
> "x25", "x26", "x27", "x28",
> // Memory access
> "memory");
>
> Results in:
>
> 118: f9400080 ldr x0, [x4]
> 11c: f9401461 ldr x1, [x3, #40]
> 120: f9400c02 ldr x2, [x0, #24]
you are clobbering x{0,1,2} before the asm finished using its input operands
so you have to use earlyclobbers.