public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/60778] New: shift not folded into shift on x86-64
@ 2014-04-07 16:01 sunfish at mozilla dot com
  2014-04-08  8:51 ` [Bug target/60778] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sunfish at mozilla dot com @ 2014-04-07 16:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60778

            Bug ID: 60778
           Summary: shift not folded into shift on x86-64
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sunfish at mozilla dot com

On this C code:

double mem[4096];
double foo(long x) {
  return mem[x>>3];
}

GCC emits this x86-64 code:

        sarq    $3, %rdi
        movsd   mem(,%rdi,8), %xmm0

The following x86-64 code would be preferrable:

        andq    $-8, %rdi
        movsd   mem(%rdi), %xmm0

since it has smaller code size, and avoids using a scaled index which costs an
extra micro-op on some microarchitectures.

The same situation arrises on 32-bit x86 also.

This was observed on all GCC versions currently on the GCC Explorer website
[0], with the latest at this time being 4.9.0 20130909.

[0] http://gcc.godbolt.org/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-27  8:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-07 16:01 [Bug target/60778] New: shift not folded into shift on x86-64 sunfish at mozilla dot com
2014-04-08  8:51 ` [Bug target/60778] " rguenth at gcc dot gnu.org
2021-09-26 21:43 ` pinskia at gcc dot gnu.org
2021-09-27  7:46 ` ubizjak at gmail dot com
2021-09-27  7:59 ` jakub at gcc dot gnu.org
2021-09-27  8:22 ` ubizjak at gmail 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).