public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] IRA: Fix % constraint modifier handling on disabled alternatives.
@ 2015-12-14 13:06 Andreas Krebbel
  2015-12-15 13:11 ` Bernd Schmidt
  2015-12-17 19:43 ` Vladimir Makarov
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Krebbel @ 2015-12-14 13:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: vmakarov

Hi,

the constraint modifier % applies to all the alternatives of a pattern
and hence is mostly added to the first constraint of an operand.  IRA
currently ignores it if the alternative with the % gets disabled by
using the `enabled' attribute or if it is not among the preferred
alternatives.

Fixed with the attached patch by moving the % check to the first loop
which walks unconditionally over all the constraints.

Ok for mainline?

Bye,

-Andreas-

gcc/ChangeLog:

2015-12-14  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* ira.c (ira_setup_alts): Move the scan for commutative modifier
	to the first loop to make it work even with disabled alternatives.

diff --git a/gcc/ira.c b/gcc/ira.c
index 97edf8c..9824e4a 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1800,7 +1800,13 @@ ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts)
 	    {
 	      insn_constraints[nop * recog_data.n_alternatives + nalt] = p;
 	      while (*p && *p != ',')
-		p++;
+		{
+		  /* We only support one commutative marker, the first
+		     one.  We already set commutative above.  */
+		  if (*p == '%' && commutative < 0)
+		    commutative = nop;
+		  p++;
+		}
 	      if (*p)
 		p++;
 	    }
@@ -1831,11 +1837,7 @@ ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts)
 		    break;
 		  
 		  case '%':
-		    /* We only support one commutative marker, the
-		       first one.  We already set commutative
-		       above.  */
-		    if (commutative < 0)
-		      commutative = nop;
+		    /* The commutative modifier is handled above.  */
 		    break;
 
 		  case '0':  case '1':  case '2':  case '3':  case '4':

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

* Re: [PATCH] IRA: Fix % constraint modifier handling on disabled alternatives.
  2015-12-14 13:06 [PATCH] IRA: Fix % constraint modifier handling on disabled alternatives Andreas Krebbel
@ 2015-12-15 13:11 ` Bernd Schmidt
  2015-12-17 19:43 ` Vladimir Makarov
  1 sibling, 0 replies; 3+ messages in thread
From: Bernd Schmidt @ 2015-12-15 13:11 UTC (permalink / raw)
  To: Andreas Krebbel, gcc-patches; +Cc: vmakarov

On 12/14/2015 02:05 PM, Andreas Krebbel wrote:
> the constraint modifier % applies to all the alternatives of a pattern
> and hence is mostly added to the first constraint of an operand.  IRA
> currently ignores it if the alternative with the % gets disabled by
> using the `enabled' attribute or if it is not among the preferred
> alternatives.
>
> Fixed with the attached patch by moving the % check to the first loop
> which walks unconditionally over all the constraints.
>
> Ok for mainline?

Ok assuming normal testing was done.


Bernd

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

* Re: [PATCH] IRA: Fix % constraint modifier handling on disabled alternatives.
  2015-12-14 13:06 [PATCH] IRA: Fix % constraint modifier handling on disabled alternatives Andreas Krebbel
  2015-12-15 13:11 ` Bernd Schmidt
@ 2015-12-17 19:43 ` Vladimir Makarov
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2015-12-17 19:43 UTC (permalink / raw)
  To: Andreas Krebbel, gcc-patches

On 12/14/2015 08:05 AM, Andreas Krebbel wrote:
> Hi,
>
> the constraint modifier % applies to all the alternatives of a pattern
> and hence is mostly added to the first constraint of an operand.  IRA
> currently ignores it if the alternative with the % gets disabled by
> using the `enabled' attribute or if it is not among the preferred
> alternatives.
>
> Fixed with the attached patch by moving the % check to the first loop
> which walks unconditionally over all the constraints.
>
> Ok for mainline?
>
>
Yes, Andreas.

Thanks for working on this issue.

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

end of thread, other threads:[~2015-12-17 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 13:06 [PATCH] IRA: Fix % constraint modifier handling on disabled alternatives Andreas Krebbel
2015-12-15 13:11 ` Bernd Schmidt
2015-12-17 19:43 ` Vladimir Makarov

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