[Bug inline-asm/94113] Apparently incorrect register allocation in inline asm when using CMOV.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94113 --- Comment #4 from Paul --- That worked. Thank you for the explanation!
[Bug inline-asm/94113] Apparently incorrect register allocation in inline asm when using CMOV.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94113 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Andrew Pinski --- You need an early clobber: __asm__ volatile("movl %3, %0;\n\t" \ "cmpl $0, %1;\n\t" \ "cmovne %2, %0;\n\t" \ : "=&r"(final_result) \ : "r"(cond), "r"(if_true), "r"(if_false) \ : "cc" \ ); Otherwise GCC thinks 0th operand and the second operand can be in the same register. With the early clobber it basically says the 0th operand cannot be the same register as the other ones.
[Bug inline-asm/94113] Apparently incorrect register allocation in inline asm when using CMOV.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94113 --- Comment #2 from Paul --- Created attachment 48003 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48003&action=edit The assembly output.
[Bug inline-asm/94113] Apparently incorrect register allocation in inline asm when using CMOV.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94113 --- Comment #1 from Paul --- Created attachment 48002 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48002&action=edit The original C file.