Patchwork Split constants in lower-subreg

login
register
mail settings
Submitter Bernd Schmidt
Date July 7, 2010, 12:42 p.m.
Message ID <4C347625.5060104@codesourcery.com>
Download mbox | patch
Permalink /patch/58115/
State New
Headers show

Comments

Bernd Schmidt - July 7, 2010, 12:42 p.m.
I noticed that sometimes DImode registers weren't being eliminated in
the lower-subreg pass when there were simple move-constant insns such as
 (set (reg:DI x) (const_int 0))

This patch seems to cure it.  Bootstrapped and regression tested on
i686-linux.  Ok?


Bernd
* lower-subreg.c (simple_move_operand): Accept constants.
	(simple_move): Get mode from destination, not source.
Jeff Law - July 7, 2010, 3:36 p.m.
On 07/07/10 06:42, Bernd Schmidt wrote:
> I noticed that sometimes DImode registers weren't being eliminated in
> the lower-subreg pass when there were simple move-constant insns such as
>   (set (reg:DI x) (const_int 0))
>
> This patch seems to cure it.  Bootstrapped and regression tested on
> i686-linux.  Ok?
>    
OK.
Jeff

Patch

Index: lower-subreg.c
===================================================================
--- lower-subreg.c	(revision 161824)
+++ lower-subreg.c	(working copy)
@@ -76,7 +76,7 @@  simple_move_operand (rtx x)
   if (GET_CODE (x) == SUBREG)
     x = SUBREG_REG (x);
 
-  if (!OBJECT_P (x))
+  if (!OBJECT_P (x) && !CONSTANT_P (x))
     return false;
 
   if (GET_CODE (x) == LABEL_REF
@@ -131,7 +131,7 @@  simple_move (rtx insn)
      registers.  That means that we can't decompose if this is a
      non-integer mode for which there is no integer mode of the same
      size.  */
-  mode = GET_MODE (SET_SRC (set));
+  mode = GET_MODE (SET_DEST (set));
   if (!SCALAR_INT_MODE_P (mode)
       && (mode_for_size (GET_MODE_SIZE (mode) * BITS_PER_UNIT, MODE_INT, 0)
 	  == BLKmode))