public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95834] New: x86 immediates --- some redundant
@ 2020-06-23  8:49 zero at smallinteger dot com
  0 siblings, 0 replies; only message in thread
From: zero at smallinteger dot com @ 2020-06-23  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95834
           Summary: x86 immediates --- some redundant
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zero at smallinteger dot com
  Target Milestone: ---

Created attachment 48774
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48774&action=edit
sample code

In some cases, literals could be synthesized with simple instructions instead
of loading them from scratch.  Consider the case of foo(), with 4 literals that
can be obtained by shifting the first one: gcc emit 5 eight-byte literals
instead.

In some other cases, the same literals are loaded.  Consider the case of baz(),
where 6 is loaded twice in consecutive instructions when an instruction reorder
could eliminate one of the literals.

The Intel optimization manual suggests not to have many instructions that load
literals in a row due to decreased code density, more difficulty to cache the
decoded instructions due to lack of space, and because shorter instruction
encodings are better.

Verified with gcc 9.3.0 and gcc 10.x (at godbolt), with -O3.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-23  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23  8:49 [Bug target/95834] New: x86 immediates --- some redundant zero at smallinteger dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).