diff mbox series

[095/nnn] poly_int: process_alt_operands

Message ID 87efptepcz.fsf@linaro.org
State New
Headers show
Series [095/nnn] poly_int: process_alt_operands | expand

Commit Message

Richard Sandiford Oct. 23, 2017, 5:38 p.m. UTC
This patch makes process_alt_operands check that the mode sizes
are ordered, so that match_reload can validly treat them as subregs
of one another.


2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* lra-constraints.c (process_alt_operands): Reject matched
	operands whose sizes aren't ordered.
	(match_reload): Refer to this check here.

Comments

Jeff Law Nov. 28, 2017, 8:08 a.m. UTC | #1
On 10/23/2017 11:38 AM, Richard Sandiford wrote:
> This patch makes process_alt_operands check that the mode sizes

> are ordered, so that match_reload can validly treat them as subregs

> of one another.

> 

> 

> 2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>

> 	    Alan Hayward  <alan.hayward@arm.com>

> 	    David Sherwood  <david.sherwood@arm.com>

> 

> gcc/

> 	* lra-constraints.c (process_alt_operands): Reject matched

> 	operands whose sizes aren't ordered.

> 	(match_reload): Refer to this check here.

OK.
jeff
diff mbox series

Patch

Index: gcc/lra-constraints.c
===================================================================
--- gcc/lra-constraints.c	2017-10-23 17:20:47.003797985 +0100
+++ gcc/lra-constraints.c	2017-10-23 17:25:42.597708494 +0100
@@ -933,6 +933,8 @@  match_reload (signed char out, signed ch
   push_to_sequence (*before);
   if (inmode != outmode)
     {
+      /* process_alt_operands has already checked that the mode sizes
+	 are ordered.  */
       if (partial_subreg_p (outmode, inmode))
 	{
 	  reg = new_in_reg
@@ -2112,6 +2114,13 @@  process_alt_operands (int only_alternati
 		    len = 0;
 		    lra_assert (nop > m);
 
+		    /* Reject matches if we don't know which operand is
+		       bigger.  This situation would arguably be a bug in
+		       an .md pattern, but could also occur in a user asm.  */
+		    if (!ordered_p (GET_MODE_SIZE (biggest_mode[m]),
+				    GET_MODE_SIZE (biggest_mode[nop])))
+		      break;
+
 		    this_alternative_matches = m;
 		    m_hregno = get_hard_regno (*curr_id->operand_loc[m], false);
 		    /* We are supposed to match a previous operand.