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