https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100697
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a scheduling interacting with the register allocator.
the "mov w0, 0" is moved before the load/stores and that clobbers x0.
Using -fno-schedule-insns, we get:
adrp x1, top
add x1, x1, :lo12:top
ldr d1, [x1, x0, lsl 3]
fadd d1, d1, d0
str d1, [x1, x0, lsl 3]
mov w0, 0
ret
Which shows this is exactly the scheduler before register allocator which is
causing it.