https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116576
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |roger at nextmovesoftware dot
com
Ever confirmed|0 |1
Last reconfirmed| |2024-09-09
--- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> ---
The constant ~0 can be materialized on x86 in only three bytes using either of
the sequences "push -1; pop rax" (i.e. 6a ff 58) or "stc; sbb ax,ax" (i.e. f9
19 c0), both of which could theoretically be fused/optimized/avoid dependencies
on modern hardware. With -Oz, GCC mainline and clang currently use the first
sequence.
But you're absolutely right that following this by a logical shift can be used
to materialize INT64_MAX (and other constants) in fewer bytes than the standard
movabs when its safe to clobber the flags.