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

--- Comment #3 from 鲁七 <huiba....@alibaba-inc.com> ---
> Note the 0 there rather than r. r in the input means any register while 0
> means it needs to match the same register as the 0th operand which in this
> case is the output operand.

Thanks for your quick response. Using "0" does resolve the issue, as what "+r"
does.

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))```?

BTW, the "+r" form and "0" form both produce code like this:

...
<+64>:   movq   %r15, %rax
<+67>:   movq   %rax, %r15
vpbroadcastd (%rax), %zmm17
...

This also looks sub-optimal.

Reply via email to