public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43215]  New: x86-64: Nonstandard instruction "movd %xmm0, %rax"
@ 2010-03-01  2:22 richardpku at gmail dot com
  2010-03-01  9:56 ` [Bug target/43215] " ubizjak at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: richardpku at gmail dot com @ 2010-03-01  2:22 UTC (permalink / raw)
  To: gcc-bugs

#include <stdint.h>
uint64_t extract_double (double x)
{
    union {
        double dbl;
        uint64_t u;
    } t;
    t.dbl = x;
    return t.u;
}

Compile this function with "x86_64-pc-linux-gnu-gcc -O2 -march=core2 -S a.c",
and we get the following assembly codes:

extract_double:
.LFB0:
    .cfi_startproc
    movd    %xmm0, %rax
    ret

The instruction "movd %xmm0, %rax" is nonstandard. Movd should be replaced by
movq.

(GNU assembler silently accepts it as if it were "movq %xmm0, %rax", so it
probably has caused no practical problems.)


-- 
           Summary: x86-64: Nonstandard instruction "movd %xmm0, %rax"
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: richardpku at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
@ 2010-03-01  9:56 ` ubizjak at gmail dot com
  2010-03-01 13:31 ` hjl dot tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2010-03-01  9:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ubizjak at gmail dot com  2010-03-01 09:56 -------
Indeed.

Following patch fixes the problem:

Index: i386.md
===================================================================
--- i386.md     (revision 157132)
+++ i386.md     (working copy)
@@ -3245,7 +3245,7 @@

     case 9:
     case 10:
-    return "%vmovd\t{%1, %0|%0, %1}";
+    return "%vmovq\t{%1, %0|%0, %1}";

     default:
       gcc_unreachable();


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-03-01 09:56:03
               date|                            |
   Target Milestone|---                         |4.3.5


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
  2010-03-01  9:56 ` [Bug target/43215] " ubizjak at gmail dot com
@ 2010-03-01 13:31 ` hjl dot tools at gmail dot com
  2010-03-01 14:56 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-01 13:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-03-01 13:31 -------
This is done on purpose to provide backward compatibility
since vmovq isn't in original x86-64 spec and older assemblers
don't support it. From i386-opc.tbl in binutils:

// These really shouldn't allow for Reg64 (movq is the right mnemonic for
// copying between Reg64/Mem64 and RegXMM/RegMMX, as is mandated by Intel's
// spec). AMD's spec, having been in existence for much longer, failed to
// recognize that and specified movd for 32- and 64-bit operations.

// vmovd really shouldn't allow for 64bit operand (vmovq is the right
// mnemonic for copying between Reg64/Mem64 and RegXMM, as is mandated
// by Intel AVX spec).  To avoid extra template in gcc x86 backend and
// support assembler for AMD64, we accept 64bit operand on vmovd so
// that we can use one template for both SSE and AVX instructions.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |WONTFIX


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
  2010-03-01  9:56 ` [Bug target/43215] " ubizjak at gmail dot com
  2010-03-01 13:31 ` hjl dot tools at gmail dot com
@ 2010-03-01 14:56 ` rguenth at gcc dot gnu dot org
  2010-03-01 15:42 ` hjl dot tools at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-01 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-03-01 14:55 -------
I fail to see why binutils accepting both version should be a reason to
not fix gcc.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
                   ` (2 preceding siblings ...)
  2010-03-01 14:56 ` rguenth at gcc dot gnu dot org
@ 2010-03-01 15:42 ` hjl dot tools at gmail dot com
  2010-03-01 20:30 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-01 15:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl dot tools at gmail dot com  2010-03-01 15:42 -------
(In reply to comment #3)
> I fail to see why binutils accepting both version should be a reason to
> not fix gcc.
> 

What is the minimum binutils required by gcc? Does it support movq?


-- 


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
                   ` (3 preceding siblings ...)
  2010-03-01 15:42 ` hjl dot tools at gmail dot com
@ 2010-03-01 20:30 ` ubizjak at gmail dot com
  2010-03-01 20:36 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2010-03-01 20:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ubizjak at gmail dot com  2010-03-01 20:30 -------
(In reply to comment #4)

> What is the minimum binutils required by gcc? Does it support movq?

install.texi says that i?86-linux-gnu requires 2.13.1.

Since you are listed as x86 binutils maintainer, I would expect that you can
provide the information if it includes correct movq support.


-- 


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
                   ` (4 preceding siblings ...)
  2010-03-01 20:30 ` ubizjak at gmail dot com
@ 2010-03-01 20:36 ` ubizjak at gmail dot com
  2010-03-01 23:16 ` hjl dot tools at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2010-03-01 20:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ubizjak at gmail dot com  2010-03-01 20:36 -------
(In reply to comment #5)

> install.texi says that i?86-linux-gnu requires 2.13.1.

binutils-2.13.1.tar.bz2           07-Nov-2002 23:45  9.5M  
binutils-2.13.1.tar.gz            07-Nov-2002 23:45   12M  

IMNSHO, I really can't see the reason why we should support *eight* years old
toolchain part with a new compiler.  Does it even build with gcc-4.5?


-- 


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
                   ` (5 preceding siblings ...)
  2010-03-01 20:36 ` ubizjak at gmail dot com
@ 2010-03-01 23:16 ` hjl dot tools at gmail dot com
  2010-03-01 23:18 ` hjl dot tools at gmail dot com
  2010-05-03  9:01 ` ubizjak at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-01 23:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl dot tools at gmail dot com  2010-03-01 23:16 -------
(In reply to comment #5)
> (In reply to comment #4)
> 
> > What is the minimum binutils required by gcc? Does it support movq?
> 
> install.texi says that i?86-linux-gnu requires 2.13.1.
> 
> Since you are listed as x86 binutils maintainer, I would expect that you can
> provide the information if it includes correct movq support.

"movq" was added by

http://sourceware.org/ml/binutils/2005-07/msg00134.html

in binutils-2.17.


-- 


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
                   ` (6 preceding siblings ...)
  2010-03-01 23:16 ` hjl dot tools at gmail dot com
@ 2010-03-01 23:18 ` hjl dot tools at gmail dot com
  2010-05-03  9:01 ` ubizjak at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-01 23:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl dot tools at gmail dot com  2010-03-01 23:18 -------
(In reply to comment #6)
> (In reply to comment #5)
> 
> > install.texi says that i?86-linux-gnu requires 2.13.1.
> 
> binutils-2.13.1.tar.bz2           07-Nov-2002 23:45  9.5M  
> binutils-2.13.1.tar.gz            07-Nov-2002 23:45   12M  
> 
> IMNSHO, I really can't see the reason why we should support *eight* years old
> toolchain part with a new compiler.  Does it even build with gcc-4.5?
> 

It may be a good idea by itself. However, since AMD64 uses movd instead
of movq, some non-GNU assemblers may not support movq. Why change it
when nothing is broken?


-- 


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


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

* [Bug target/43215] x86-64: Nonstandard instruction "movd %xmm0, %rax"
  2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
                   ` (7 preceding siblings ...)
  2010-03-01 23:18 ` hjl dot tools at gmail dot com
@ 2010-05-03  9:01 ` ubizjak at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2010-05-03  9:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from ubizjak at gmail dot com  2010-05-03 09:01 -------
(In reply to comment #8)

> It may be a good idea by itself. However, since AMD64 uses movd instead
> of movq, some non-GNU assemblers may not support movq. Why change it
> when nothing is broken?

Indeed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX


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


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

end of thread, other threads:[~2010-05-03  9:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-01  2:22 [Bug target/43215] New: x86-64: Nonstandard instruction "movd %xmm0, %rax" richardpku at gmail dot com
2010-03-01  9:56 ` [Bug target/43215] " ubizjak at gmail dot com
2010-03-01 13:31 ` hjl dot tools at gmail dot com
2010-03-01 14:56 ` rguenth at gcc dot gnu dot org
2010-03-01 15:42 ` hjl dot tools at gmail dot com
2010-03-01 20:30 ` ubizjak at gmail dot com
2010-03-01 20:36 ` ubizjak at gmail dot com
2010-03-01 23:16 ` hjl dot tools at gmail dot com
2010-03-01 23:18 ` hjl dot tools at gmail dot com
2010-05-03  9:01 ` 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).