public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Froyd <froydnj@codesourcery.com>
To: "H.J. Lu" <hjl@lucon.org>
Cc: Uros Bizjak <ubizjak@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>, 	Jan Hubicka <jh@suse.cz>
Subject: Re: [PATCH,i386] fix PR 11001
Date: Fri, 12 Oct 2007 17:13:00 -0000	[thread overview]
Message-ID: <20071012171321.GF11809@codesourcery.com> (raw)
In-Reply-To: <20071012164026.GA1318@lucon.org>

On Fri, Oct 12, 2007 at 09:40:27AM -0700, H.J. Lu wrote:
> On Fri, Oct 12, 2007 at 09:12:47AM -0700, Nathan Froyd wrote:
> > +      /* Can't use this if the user has appropriated eax, ecx, or edi.  */
> > +      if (global_regs[0] || global_regs[2] || global_regs[5])
> > +        return false;
> > +
>
> Can you use/add AX_REG, CX_REG, DI_REG, SI_REG instead using 0, 2,                                       
> 4, 5?

Sure.  Patch below.  OK to commit if it passes bootstrap/testing?

-Nathan

2007-10-12  Nathan Froyd  <froydnj@codesourcery.com>

	* config/i386/i386.md (SI_REG, DI_REG): New constants.
	(strmov): Use defined constants.
	(cmpstrnsi): Likewise.
	* config/i386/i386.c (decide_alg): Use defined constants.
	(ix86_expand_strlen): Likewise.

Index: i386.c
===================================================================
--- i386.c	(revision 129265)
+++ i386.c	(working copy)
@@ -15060,8 +15060,8 @@ decide_alg (HOST_WIDE_INT count, HOST_WI
      additionally, memset wants eax and memcpy wants esi.  Don't
      consider such algorithms if the user has appropriated those
      registers for their own purposes.	*/
-  bool rep_prefix_usable = !(global_regs[2] || global_regs[5]
-                             || (memset ? global_regs[0] : global_regs[4]));
+  bool rep_prefix_usable = !(global_regs[CX_REG] || global_regs[DI_REG]
+                             || (memset ? global_regs[AX_REG] : global_regs[SI_REG]));
 
 #define ALG_USABLE_P(alg) (rep_prefix_usable			\
 			   || (alg != rep_prefix_1_byte		\
@@ -16022,7 +16022,7 @@ ix86_expand_strlen (rtx out, rtx src, rt
       rtx unspec;
 
       /* Can't use this if the user has appropriated eax, ecx, or edi.  */
-      if (global_regs[0] || global_regs[2] || global_regs[5])
+      if (global_regs[AX_REG] || global_regs[CX_REG] || global_regs[DI_REG])
         return false;
 
       scratch2 = gen_reg_rtx (Pmode);
Index: i386.md
===================================================================
--- i386.md	(revision 129265)
+++ i386.md	(working copy)
@@ -222,6 +222,8 @@ (define_constants
   [(AX_REG			 0)
    (DX_REG			 1)
    (CX_REG			 2)
+   (SI_REG			 4)
+   (DI_REG			 5)
    (BP_REG			 6)
    (SP_REG			 7)
    (FLAGS_REG			17)
@@ -18704,7 +18706,7 @@ (define_expand "strmov"
 
   /* Can't use this if the user has appropriated esi or edi.  */
   if ((TARGET_SINGLE_STRINGOP || optimize_size)
-      && !(global_regs[4] || global_regs[5]))
+      && !(global_regs[SI_REG] || global_regs[DI_REG]))
     {
       emit_insn (gen_strmov_singleop (operands[0], operands[1],
 				      operands[2], operands[3],
@@ -19190,7 +19192,7 @@ (define_expand "cmpstrnsi"
   rtx addr1, addr2, out, outlow, count, countreg, align;
 
   /* Can't use this if the user has appropriated esi or edi.  */
-  if (global_regs[4] || global_regs[5])
+  if (global_regs[SI_REG] || global_regs[DI_REG])
     FAIL;
 
   out = operands[0];

  reply	other threads:[~2007-10-12 17:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04  6:34 Uros Bizjak
2007-10-04 20:55 ` Nathan Froyd
2007-10-05  5:59   ` Uros Bizjak
2007-10-12 16:13     ` Nathan Froyd
2007-10-12 16:40       ` H.J. Lu
2007-10-12 17:13         ` Nathan Froyd [this message]
2007-10-12 17:28           ` Uros Bizjak
2007-10-12 19:34           ` H.J. Lu
2007-10-12 19:40             ` Nathan Froyd
  -- strict thread matches above, loose matches on Subject: below --
2007-10-12 17:26 Uros Bizjak
2007-10-03 15:01 Nathan Froyd

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=20071012171321.GF11809@codesourcery.com \
    --to=froydnj@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl@lucon.org \
    --cc=jh@suse.cz \
    --cc=ubizjak@gmail.com \
    /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).