This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix LRA subreg calculation for big-endian targets


Richard Sandiford <richard.sandiford@linaro.org> writes:
> Segher Boessenkool <segher@kernel.crashing.org> writes:
>> Hi!
>>
>> On Fri, Jan 26, 2018 at 01:25:51PM +0000, Richard Sandiford wrote:
>>>  	  if (SCALAR_INT_MODE_P (inmode))
>>>  	    new_out_reg = gen_lowpart_SUBREG (outmode, reg);
>>>  	  else
>>> -	    new_out_reg = gen_rtx_SUBREG (outmode, reg, 0);
>>> +	    {
>>> +	      poly_uint64 offset = subreg_lowpart_offset (outmode, inmode);
>>> +	      new_out_reg = gen_rtx_SUBREG (outmode, reg, offset);
>>> +	    }
>>
>> Is this now not exactly the same as the SCALAR_INT_MODE_P case?  The mode
>> of "reg" is inmode, after all?
>
> Bah, yes.  Don't know how I missed that. :-(  I think I must have
> been reading it as SCALAR_INT_P, and thinking this was some weird
> VOIDmode thing.
>
> Will fix.

Like so.  Tested as before.  OK to install?

Thanks,
Richard


2018-02-02  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* lra-constraints.c (match_reload): Unconditionally use
	gen_lowpart_SUBREG, rather than selecting between that
	and equivalent gen_rtx_SUBREG code.

Index: gcc/lra-constraints.c
===================================================================
--- gcc/lra-constraints.c	2018-01-31 14:14:16.701405568 +0000
+++ gcc/lra-constraints.c	2018-02-02 14:14:50.701951577 +0000
@@ -942,13 +942,7 @@ match_reload (signed char out, signed ch
 	  reg = new_in_reg
 	    = lra_create_new_reg_with_unique_value (inmode, in_rtx,
 						    goal_class, "");
-	  if (SCALAR_INT_MODE_P (inmode))
-	    new_out_reg = gen_lowpart_SUBREG (outmode, reg);
-	  else
-	    {
-	      poly_uint64 offset = subreg_lowpart_offset (outmode, inmode);
-	      new_out_reg = gen_rtx_SUBREG (outmode, reg, offset);
-	    }
+	  new_out_reg = gen_lowpart_SUBREG (outmode, reg);
 	  LRA_SUBREG_P (new_out_reg) = 1;
 	  /* If the input reg is dying here, we can use the same hard
 	     register for REG and IN_RTX.  We do it only for original
@@ -965,13 +959,7 @@ match_reload (signed char out, signed ch
 	  reg = new_out_reg
 	    = lra_create_new_reg_with_unique_value (outmode, out_rtx,
 						    goal_class, "");
-	  if (SCALAR_INT_MODE_P (outmode))
-	    new_in_reg = gen_lowpart_SUBREG (inmode, reg);
-	  else
-	    {
-	      poly_uint64 offset = subreg_lowpart_offset (inmode, outmode);
-	      new_in_reg = gen_rtx_SUBREG (inmode, reg, offset);
-	    }
+	  new_in_reg = gen_lowpart_SUBREG (inmode, reg);
 	  /* NEW_IN_REG is non-paradoxical subreg.  We don't want
 	     NEW_OUT_REG living above.  We add clobber clause for
 	     this.  This is just a temporary clobber.  We can remove


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]