diff mbox

Fix PR55876 - Make generation of paradoxical subreg in widen_operand more robust

Message ID 50F3C179.1030705@mentor.com
State New
Headers show

Commit Message

Tom de Vries Jan. 14, 2013, 8:27 a.m. UTC
On 07/01/13 18:48, Richard Henderson wrote:
> On 01/07/2013 02:16 AM, Tom de Vries wrote:
>> -  /* If MODE is no wider than a single word, we return a paradoxical
>> -     SUBREG.  */
>> +  /* If MODE is no wider than a single word, we return a
>> +     lowpart or paradoxical SUBREG.  */
>>    if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
>> -    return gen_rtx_SUBREG (mode, force_reg (GET_MODE (op), op), 0);
>> +    {
>> +      if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (op)))
>> +       return gen_lowpart_SUBREG (mode, op);
>> +      else
>> +       return gen_rtx_SUBREG (mode, force_reg (GET_MODE (op), op), 0);
>> +    }
> 
> Is there any good reason we're using gen_rtx_SUBREG directly here?
> Seems like this sort of logic would be present in plain gen_lowpart,
> generating the paradoxical subreg that we want.
> 

Ah, didn't realize that. Attached patch uses gen_lowpart.

Bootstrapped and reg-tested on x86_64.

Build and reg-tested on mips64, -mabi=n32 and -mabi=64.

OK for trunk?

Thanks,
- Tom

2013-01-14  Tom de Vries  <tom@codesourcery.com>

	PR target/55876
	* optabs.c (widen_operand): Use gen_lowpart instead of gen_rtx_SUBREG.
	Update comment.

Comments

Richard Henderson Jan. 15, 2013, 5:11 p.m. UTC | #1
On 01/14/2013 12:27 AM, Tom de Vries wrote:
> 2013-01-14  Tom de Vries<tom@codesourcery.com>
>
> 	PR target/55876
> 	* optabs.c (widen_operand): Use gen_lowpart instead of gen_rtx_SUBREG.
> 	Update comment.

Ok.


r~
diff mbox

Patch

Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c (revision 194898)
+++ gcc/optabs.c (working copy)
@@ -327,10 +327,10 @@  widen_operand (rtx op, enum machine_mode
 	  && SUBREG_PROMOTED_UNSIGNED_P (op) == unsignedp))
     return convert_modes (mode, oldmode, op, unsignedp);
 
-  /* If MODE is no wider than a single word, we return a paradoxical
+  /* If MODE is no wider than a single word, we return a lowpart or paradoxical
      SUBREG.  */
   if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
-    return gen_rtx_SUBREG (mode, force_reg (GET_MODE (op), op), 0);
+    return gen_lowpart (mode, force_reg (GET_MODE (op), op));
 
   /* Otherwise, get an object of MODE, clobber it, and set the low-order
      part to OP.  */