From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19964 invoked by alias); 6 Aug 2009 10:47:19 -0000 Received: (qmail 19930 invoked by uid 48); 6 Aug 2009 10:47:08 -0000 Date: Thu, 06 Aug 2009 10:47:00 -0000 Message-ID: <20090806104708.19929.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/40983] The scheduler incorrectly swaps MMX and floating point instructions In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ubizjak at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-08/txt/msg00616.txt.bz2 ------- Comment #3 from ubizjak at gmail dot com 2009-08-06 10:47 ------- Hm, we can fix this by teaching scheduler that every access to %mm registers clobbers FP state. Since scheduler already depend all x87 instructions on Top-Of-Stack (TOS) register, we can perhaps extend this requirement for all instructions that use %mm reg. Something like the proof-of-concept patch bellow: --cut here-- Index: sched-deps.c =================================================================== --- sched-deps.c (revision 150503) +++ sched-deps.c (working copy) @@ -1898,7 +1898,12 @@ sched_analyze_reg (deps, FIRST_STACK_REG, mode, code, insn); sched_analyze_reg (deps, FIRST_STACK_REG, mode, USE, insn); } + +#ifdef FIRST_MMX_REG + if (regno >= FIRST_MMX_REG && regno <= LAST_MMX_REG) + sched_analyze_reg (deps, FIRST_STACK_REG, VOIDmode, CLOBBER, insn); #endif +#endif } else if (MEM_P (dest)) { @@ -2044,7 +2049,12 @@ sched_analyze_reg (deps, FIRST_STACK_REG, mode, USE, insn); sched_analyze_reg (deps, FIRST_STACK_REG, mode, SET, insn); } + +#ifdef FIRST_MMX_REG + if (regno >= FIRST_MMX_REG && regno <= LAST_MMX_REG) + sched_analyze_reg (deps, FIRST_STACK_REG, VOIDmode, CLOBBER, insn); #endif +#endif if (cslr_p && sched_deps_info->finish_rhs) sched_deps_info->finish_rhs (); --cut here-- Otherwise, you can just add "asm volatile ("")" as a scheduling barrier. -- ubizjak at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-08-06 10:47:08 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40983