public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,rs6000] disable mfcr pattern for TARGET_ISEL
@ 2010-07-20 20:45 Nathan Froyd
  2010-07-21 15:32 ` David Edelsohn
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Froyd @ 2010-07-20 20:45 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc

mfcr can be a slow instruction, particular for multiple-issue
processors, where it requires serializing the instruction stream to
ensure that CR has been properly updated.  The primary pattern where
mfcr occurs deals with moving an individual bit from CR to a GPR.  This
pattern not only uses mfcr, but also binds the mfcr and accompanying
rlwinm together instead of permitting them to be scheduled separately.

On TARGET_ISEL processors, however, we can improve the matter somewhat
by using isel instead of mfcr.  With isel, there's no need to
synchronize on CR as a whole, just an individual field.  The
instructions that load zero and one can also be scheduled separately
from the isel itself.  The patch below enables this improvement by
turning off the aforementioned mfcr/rlwinm pattern for TARGET_ISEL
processors.

The patch could be improved; there's a TARGET_POWERPC64 pattern that's
identical save for the modes of registers slightly further on in the
file.  I don't have a power7 system to test the equivalent 64-bit path
on, but if somebody was willing to test on such a system for me, I could
tweak the patch accordingly.  (Such a tweaked patch could also use mode
iterators, which would be an improvement.)

Tested with cross to powerpc-eabispe.  OK to commit?

-Nathan

	* config/rs6000/rs6000.md (define_insn ""): Enable only for
	!TARGET_ISEL targets.

Index: config/rs6000/rs6000.md
===================================================================
--- config/rs6000/rs6000.md	(revision 162348)
+++ config/rs6000/rs6000.md	(working copy)
@@ -13052,7 +13052,7 @@ (define_insn ""
 	(match_operator:SI 1 "scc_comparison_operator"
 			   [(match_operand 2 "cc_reg_operand" "y")
 			    (const_int 0)]))]
-  ""
+  "!TARGET_ISEL"
   "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
   [(set (attr "type")
      (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-26 16:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-20 20:45 [PATCH,rs6000] disable mfcr pattern for TARGET_ISEL Nathan Froyd
2010-07-21 15:32 ` David Edelsohn
2010-07-21 15:51   ` Nathan Froyd
2010-07-21 16:34     ` David Edelsohn
2010-07-21 16:49       ` Nathan Froyd
     [not found]         ` <AANLkTikqRe1aGizRF4tJhL+roXnQzWa8bu1B2X44ERra@mail.gmail.com>
2010-07-26 17:14           ` Nathan Froyd

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