https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120022
Jin Haobo <a1343922569 at outlook dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|WONTFIX |--- Status|RESOLVED |UNCONFIRMED --- Comment #4 from Jin Haobo <a1343922569 at outlook dot com> --- (In reply to Andrew Pinski from comment #1) > Note your inline-asm is still broken. > > asm ( > "xor %[remainder], %[remainder] \n\t" > "div %[divisor] \n\t" > : [quotient] "=a"(result), [remainder] "=&d" (dummyRemainder) > : [dividendLow] "a"(a), [divisor] "rm"(b) > ); > > Is the corrected version. The reason you need an early clobber on remainder > output is because you clobber it before use the input of divisor and divisor > still can be assigned to rdx. Thank you, but the "correct" code still generate suboptimal assembly code for myDivMod1, while Clang is optimal. GCC: https://gcc.godbolt.org/z/cvadddsz3 Clang: https://gcc.godbolt.org/z/fdvaWzGo5 Is this actually a suboptimal assembly, or I miss some subtle detail?