public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vahur dot sinijarv at cydonia dot ee" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/23660] New: Moves from general to MMX registers use unnecessary secondary memory
Date: Wed, 31 Aug 2005 17:24:00 -0000	[thread overview]
Message-ID: <20050831172326.23660.vahur.sinijarv@cydonia.ee> (raw)

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


             reply	other threads:[~2005-08-31 17:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-31 17:24 vahur dot sinijarv at cydonia dot ee [this message]
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

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=20050831172326.23660.vahur.sinijarv@cydonia.ee \
    --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).