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

--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Harald van Dijk from comment #9)
> (In reply to H.J. Lu from comment #2)
> > We shouldn't transform "mov $-1,reg" to "push $-1; pop reg".
> > We should transform "mov $-1,reg" to "or $-1,reg" instead.
> 
> Is that really an improvement? For 32-bit registers, sure, it's fine, but
> for 64-bit registers this increases code size, does it not? orq $-1, %rax is
> four bytes, when pushq $-1; popq %rax is only three.

By default, GCC optimizes for performance.  "mov $-1,reg" is write.  Other
encodings are write after read and maybe more. If you want the smallest code
size, please use -Oz.

Reply via email to