https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120284
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Huiba Li from comment #3) > And actually, I don't need the input register to be the same as the output > register. All I need here is making x both input and output to the assembly. > So in theory, should it also be OK to write ```asm volatile("" : "=r"(x) : > "r"(x))```? In that case you need to use "movq %1, %0" in the asm to actually copy the value, because the constraints don't guarantee it is the same register, it can very well be a different one. By using "0" or "+r" you require that the input and output use the same register and so don't need to copy anything.