public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/40983] The scheduler incorrectly swaps MMX and floating point instructions
Date: Thu, 06 Aug 2009 10:47:00 -0000	[thread overview]
Message-ID: <20090806104708.19929.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40983-1600@http.gcc.gnu.org/bugzilla/>



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


  parent reply	other threads:[~2009-08-06 10:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06  4:11 [Bug target/40983] New: " mikulas at artax dot karlin dot mff dot cuni dot cz
2009-08-06  4:12 ` [Bug target/40983] " mikulas at artax dot karlin dot mff dot cuni dot cz
2009-08-06  4:15 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-08-06 10:47 ` ubizjak at gmail dot com [this message]
2009-08-23 19:19 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-10-16 19:46 ` sezeroz at gmail dot com
2009-11-11 23:06 ` mikulas at artax dot karlin dot mff dot cuni dot cz

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=20090806104708.19929.qmail@sourceware.org \
    --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).