public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/34256]  New: mmx and movd/movq on x86_64
@ 2007-11-28  1:15 dean at arctic dot org
  2007-11-28  1:44 ` [Bug target/34256] " dean at arctic dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dean at arctic dot org @ 2007-11-28  1:15 UTC (permalink / raw)
  To: gcc-bugs

gcc seems allergic to movq in the context of mmx:

% cat movq.c
#include <inttypes.h>
#include <mmintrin.h>

__m64 x;
__m64 y;

uint64_t foo(__m64 m) {
  return _mm_cvtm64_si64(_mm_add_pi32(x, y));
}
% gcc -g -O3 -Wall -std=gnu99   -c -o movq.o movq.c
% objdump -dr movq.o

movq.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <foo>:
   0:   48 8b 05 00 00 00 00    mov    0(%rip),%rax        # 7 <foo+0x7>
                        3: R_X86_64_PC32        x+0xfffffffffffffffc
   7:   48 89 44 24 f8          mov    %rax,0xfffffffffffffff8(%rsp)
   c:   0f 6f 44 24 f8          movq   0xfffffffffffffff8(%rsp),%mm0
  11:   0f fe 05 00 00 00 00    paddd  0(%rip),%mm0        # 18 <foo+0x18>
                        14: R_X86_64_PC32       y+0xfffffffffffffffc
  18:   0f 7f 44 24 f8          movq   %mm0,0xfffffffffffffff8(%rsp)
  1d:   48 8b 44 24 f8          mov    0xfffffffffffffff8(%rsp),%rax
  22:   c3                      retq

the load of x should use "movq m64,mm".  this is true in i386 targets as well.

the transfer of %mm0 to %rax has the option of "movq %mm0,%rax" on x86_64, but
should possibly be passed through memory depending on -mtune= settings:

for intel core2 always use movq directly between the registers, no matter which
direction.

for AMD k8 family 15 always pass through mem

for AMD k8 family 16+, for gpr->xmm/mmx pass through memory and for xmm/mmx ->
gpr always use movd/movq direct between the registers.

-dean

p.s. gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --prefix=/home/odo/gcc --disable-multilib
--disable-biarch x86_64-unknown-linux-gnu --enable-languages=c
Thread model: posix
gcc version 4.3.0 20071128 (experimental) (GCC)


-- 
           Summary: mmx and movd/movq on x86_64
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dean at arctic dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

end of thread, other threads:[~2008-12-13 19:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-28  1:15 [Bug target/34256] New: mmx and movd/movq on x86_64 dean at arctic dot org
2007-11-28  1:44 ` [Bug target/34256] " dean at arctic dot org
2007-11-28 12:45 ` ubizjak at gmail dot com
2007-11-28 12:46 ` ubizjak at gmail dot com
2007-12-10  8:40 ` ubizjak at gmail dot com
2008-02-23 15:25 ` uros at gcc dot gnu dot org
2008-11-16  0:09 ` howarth at nitro dot med dot uc dot edu
2008-11-16  0:10 ` howarth at nitro dot med dot uc dot edu
2008-11-17  0:36 ` howarth at nitro dot med dot uc dot edu
2008-11-17  0:39 ` howarth at nitro dot med dot uc dot edu
2008-12-13 18:39 ` howarth at nitro dot med dot uc dot edu
2008-12-13 19:30 ` 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).