public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/23660] New: Moves from general to MMX registers use unnecessary secondary memory
@ 2005-08-31 17:24 vahur dot sinijarv at cydonia dot ee
  2005-08-31 17:28 ` [Bug target/23660] " vahur dot sinijarv at cydonia dot ee
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vahur dot sinijarv at cydonia dot ee @ 2005-08-31 17:24 UTC (permalink / raw)
  To: gcc-bugs

I was recompiling my MMX code on GCC 4 and was surprised to see that none of 
the moves from general regs to MMX (and other way around) were happening 
directly but through intermediate memory location and I could not find a 
combination of optimization options which would disable this behaviour.

I tried to find out what is causing this and this is what I found:

gcc/config/i386/i386.c:
int ix86_secondary_memory_needed (enum reg_class class1, enum reg_class 
class2, enum machine_mode mode, int strict)
...

/* ??? This is a lie. We do have moves between mmx/general, and for mmx/sse2.
But by saying we need secondary memory we discourage the register allocator
from using the mmx registers unless needed. */

if (MMX_CLASS_P (class1) != MMX_CLASS_P (class2)) return true;
... 

If I comment out that "if" line, mmx register assignments from general 
registers will work.
Should the requirement of using secondary memory to move MMX registers between 
general regs be relaxed ?
I do not see the point why one should discourage the register allocator from 
using mmx registers, move through memory is clearly inefficent and enlarges 
resulting code (if the function containing moves is inlined in several places, 
even more so).
I'll attach my source and assembly output from GCC 4.1.0 (30.08.2005 CVS HEAD) 
vs GCC 3.4.4, these are short.

-- 
           Summary: Moves from general to MMX registers use unnecessary
                    secondary memory
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vahur dot sinijarv at cydonia dot ee
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


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

* [Bug target/23660] Moves from general to MMX registers use unnecessary secondary memory
  2005-08-31 17:24 [Bug target/23660] New: Moves from general to MMX registers use unnecessary secondary memory vahur dot sinijarv at cydonia dot ee
@ 2005-08-31 17:28 ` vahur dot sinijarv at cydonia dot ee
  2005-08-31 17:42 ` vahur dot sinijarv at cydonia dot ee
  2005-08-31 19:22 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: vahur dot sinijarv at cydonia dot ee @ 2005-08-31 17:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From vahur dot sinijarv at cydonia dot ee  2005-08-31 17:24 -------
Created an attachment (id=9637)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9637&action=view)
Preprocessed source


-- 


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


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

* [Bug target/23660] Moves from general to MMX registers use unnecessary secondary memory
  2005-08-31 17:24 [Bug target/23660] New: Moves from general to MMX registers use unnecessary secondary memory vahur dot sinijarv at cydonia dot ee
  2005-08-31 17:28 ` [Bug target/23660] " vahur dot sinijarv at cydonia dot ee
@ 2005-08-31 17:42 ` vahur dot sinijarv at cydonia dot ee
  2005-08-31 19:22 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: vahur dot sinijarv at cydonia dot ee @ 2005-08-31 17:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From vahur dot sinijarv at cydonia dot ee  2005-08-31 17:34 -------
Created an attachment (id=9638)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9638&action=view)
4.1.0 vs 3.4.4


-- 


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


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

* [Bug target/23660] Moves from general to MMX registers use unnecessary secondary memory
  2005-08-31 17:24 [Bug target/23660] New: Moves from general to MMX registers use unnecessary secondary memory vahur dot sinijarv at cydonia dot ee
  2005-08-31 17:28 ` [Bug target/23660] " vahur dot sinijarv at cydonia dot ee
  2005-08-31 17:42 ` vahur dot sinijarv at cydonia dot ee
@ 2005-08-31 19:22 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-31 19:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-31 19:18 -------
The issue is more complicated than you think. 

This is a dup of bug 22076 which has about the same code and issue.

*** This bug has been marked as a duplicate of 22076 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-08-31 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-31 17:24 [Bug target/23660] New: Moves from general to MMX registers use unnecessary secondary memory vahur dot sinijarv at cydonia dot ee
2005-08-31 17:28 ` [Bug target/23660] " vahur dot sinijarv at cydonia dot ee
2005-08-31 17:42 ` vahur dot sinijarv at cydonia dot ee
2005-08-31 19:22 ` pinskia at gcc dot gnu dot org

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).