From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18488 invoked by alias); 31 Aug 2005 17:23:42 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18336 invoked by uid 48); 31 Aug 2005 17:23:30 -0000 Date: Wed, 31 Aug 2005 17:24:00 -0000 From: "vahur dot sinijarv at cydonia dot ee" To: gcc-bugs@gcc.gnu.org Message-ID: <20050831172326.23660.vahur.sinijarv@cydonia.ee> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/23660] New: Moves from general to MMX registers use unnecessary secondary memory X-Bugzilla-Reason: CC X-SW-Source: 2005-08/txt/msg03637.txt.bz2 List-Id: 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