Patchwork patch to build GCC for arm with LRA

login
register
mail settings
Submitter Vladimir Makarov
Date June 27, 2013, 3:55 p.m.
Message ID <51CC6077.6050401@redhat.com>
Download mbox | patch
Permalink /patch/255102/
State New
Headers show

Comments

Vladimir Makarov - June 27, 2013, 3:55 p.m.
The following patch is for building arm GCC with LRA.  I found that
ASHIFTRT and LSHIFTRT are used in address calculation for arm, e.g.


(insn 78 76 79 8 (set (reg/v:SI 153 [ offset ])
        (mem:SI (plus:SI (ashiftrt:SI (reg:SI 151 [ D.6620 ])
                    (const_int 8 [0x8]))
                (reg/f:SI 183 [ MEM[(const void * const *)obj_ptr_5(D)]
])) [5 *_27+0 S4 A32]))
/home/cygnus/vmakarov/build1/trunk5/gcc/libstdc++-v3/libsupc++/tinfo.h:88 197
{*arm_movsi_insn}
     (expr_list:REG_DEAD (reg/f:SI 183 [ MEM[(const void * const
*)obj_ptr_5(D)] ])
        (expr_list:REG_DEAD (reg:SI 151 [ D.6620 ])
            (nil))))


The patch was successfully bootstrapped on arm-hfp.

Richard, is it ok to commit to the trunk?

2013-06-27  Vladimir Makarov  <vmakarov@redhat.com>

        * rtlanal.c (must_be_index_p, set_address_index): Add ASHIFTRT and
        LSHIFTRT.
Richard Sandiford - June 27, 2013, 4:15 p.m.
Vladimir Makarov <vmakarov@redhat.com> writes:
> Richard, is it ok to commit to the trunk?

Looks good to me, but I gave up the right to approve it.  I think you
need ROTATERT too though (see arm_legitimate_index_p).

Also, sorry for the nitpick, but once the full condition overflows one line,
I think each == test should be on its own line.

Thanks,
Richard

Patch

Index: rtlanal.c
===================================================================
--- rtlanal.c	(revision 200174)
+++ rtlanal.c	(working copy)
@@ -5480,7 +5480,8 @@  must_be_base_p (rtx x)
 static bool
 must_be_index_p (rtx x)
 {
-  return GET_CODE (x) == MULT || GET_CODE (x) == ASHIFT;
+  return (GET_CODE (x) == MULT || GET_CODE (x) == ASHIFT
+	  || GET_CODE (x) == ASHIFTRT || GET_CODE (x) == LSHIFTRT);
 }
 
 /* Set the segment part of address INFO to LOC, given that INNER is the
@@ -5519,7 +5520,8 @@  set_address_base (struct address_info *i
 static void
 set_address_index (struct address_info *info, rtx *loc, rtx *inner)
 {
-  if ((GET_CODE (*inner) == MULT || GET_CODE (*inner) == ASHIFT)
+  if ((GET_CODE (*inner) == MULT || GET_CODE (*inner) == ASHIFT
+       || GET_CODE (*inner) == ASHIFTRT || GET_CODE (*inner) == LSHIFTRT)
       && CONSTANT_P (XEXP (*inner, 1)))
     inner = strip_address_mutations (&XEXP (*inner, 0));
   gcc_checking_assert (REG_P (*inner)