On Mon, Sep 9, 2019 at 6:03 PM Wilco Dijkstra <wilco.dijks...@arm.com> wrote: > > Currently arm_legitimize_address doesn't handle Thumb-2 at all, resulting in > inefficient code. Since Thumb-2 supports similar address offsets use the Arm > legitimization code for Thumb-2 to get significant codesize and performance > gains. SPECINT2006 shows 0.4% gain on Cortex-A57, while SPECFP improves 0.2%. > What were the sort of code size gains ? It did end up piquing my curiosity as to how we missed something so basic. For instance ldr r0, [r0, #-4080] is valid in Arm state but not in Thumb2. Thus if there was an illegitimate address given here, would we end up producing plus (r0, -4080) ? Yeah a simple testcase doesn't work out. Scratching my head a bit , it's late at night.
Orthogonally it looks like you can clean up the MINUS handling here and in legitimate_address_p , I'm not sure what the status of LRA with MINUS is either and thus we should now look to clean this up or look to turn this on and see what happens. However that's a subject of a future patch. > Bootstrap OK, OK for commit? > For the record, bootstrap with Thumb2 presumably and the testruns were clean ? regards Ramana Ramana > ChangeLog: > 2019-09-09 Wilco Dijkstra <wdijk...@arm.com> > > * config/arm/arm.c (arm_legitimize_address): Remove Thumb-2 bailout. > > -- > > diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c > index > a5a6a0fab1b4b7ef07931522e7d47e59842d7f27..2601708e7e0716e4668b79e015e366d2164562fd > 100644 > --- a/gcc/config/arm/arm.c > +++ b/gcc/config/arm/arm.c > @@ -8652,13 +8652,8 @@ arm_legitimize_address (rtx x, rtx orig_x, > machine_mode mode) > return x; > } > > - if (!TARGET_ARM) > - { > - /* TODO: legitimize_address for Thumb2. */ > - if (TARGET_THUMB2) > - return x; > - return thumb_legitimize_address (x, orig_x, mode); > - } > + if (TARGET_THUMB1) > + return thumb_legitimize_address (x, orig_x, mode); > > if (GET_CODE (x) == PLUS) > {