public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tbptbp at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/46198] New: movd xmm, r (xmm -> GPR) may hit the stack
Date: Wed, 27 Oct 2010 15:00:00 -0000	[thread overview]
Message-ID: <bug-46198-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: movd xmm, r (xmm -> GPR) may hit the stack
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tbptbp@gmail.com
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Under somewhat elusive (target) conditions...
$ cat movd.c
#include <emmintrin.h>
int foo(__m128i x) { return _mm_cvtsi128_si32(x); }
$ gcc -O3 movd.c -S -o -
foo:
.LFB521:
    .cfi_startproc
    movd    %xmm0, -12(%rsp)
    movl    -12(%rsp), %eax
    ret
$ gcc -Os movd.c -S -o -
foo:
.LFB514:
    .cfi_startproc
    movd    %xmm0, -12(%rsp)
    movl    -12(%rsp), %eax
    ret
$ gcc -O3 -march=native movd.c -S -o -
foo:
.LFB521:
    .cfi_startproc
    movd    %xmm0, %eax
    ret

... movd may or may not pay a trip to the stack, apparently depending on some
target cpu+SSE level condition (here native is a corei7).
I can't see any good reason for that (and certainly not for size).

Known to happen from gcc 4.4.4 to 
$ /usr/local/gcc-4.6-20101026/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.6-20101026/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.6-20101026/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-4.6.0
--enable-languages=c,c++ --enable-threads=posix --disable-nls
--with-system-zlib --disable-bootstrap --enable-mpfr --enable-gold --enable-lto
--with-ppl --with-cloog --with-arch=native --enable-checking=release
Thread model: posix
gcc version 4.6.0 20101026 (experimental) (GCC)


             reply	other threads:[~2010-10-27 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 15:00 tbptbp at gmail dot com [this message]
2010-10-27 18:00 ` [Bug target/46198] " ubizjak at gmail dot com
2010-10-27 18:10 ` tbptbp at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-46198-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).