https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109903
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- That is the inline-asm should be written as: asm ("mrs %[_1], pmccntr_eli0\n" "\tldr x1, [%[_2]]\n" : [_1] "=&r" (v) : [_2] "r" (a) : "memory"); Note since a is memory address you are writing to you should also add the memory clobber to the inline-asm.