public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: patch for PR59535
@ 2014-02-07 18:23 Vladimir Makarov
  2014-02-07 22:07 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Makarov @ 2014-02-07 18:23 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Earnshaw

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

   The following patch improves code size for ARM.  Before the patch 
CSiBE size generated by GCC configured --with-arch=armv7-a 
--with-fpu=vfpv3-d16 --with-float=hard (with -mthumb) was

2414926

After the patch the size is

2396798

For comparison, when the reload pass is used the size is

2400154

The change in arm.h is to prevent reloading sp as an address by LRA. 
Reload has no such problem as it uses legitimate address hook and LRA 
mostly relies on base_reg_class.

Richard, is this part ok to commit to the trunk?

The change in lra-constraints.c is for correct alternative choice in 
move patterns when pseudo is of class of general reg and one alternative 
contains lo regs and another one contains hi regs.

The patch was bootstrapped on x86/x86-64 and arm.

2014-02-07  Vladimir Makarov  <vmakarov@redhat.com>

         PR rtl-optimization/59535
         * lra-constraints.c (process_alt_operands): Encourage alternative
         when unassigned pseudo class is superset of the alternative class.
         * config/arm/arm.h (MODE_BASE_REG_CLASS): Return CORE_REGS for
         Thumb2 for LRA.


[-- Attachment #2: pr59535.patch --]
[-- Type: text/plain, Size: 1604 bytes --]

Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 207562)
+++ lra-constraints.c	(working copy)
@@ -2112,6 +2112,21 @@ process_alt_operands (int only_alternati
 		  goto fail;
 		}
 
+	      /* If not assigned pseudo has a class which a subset of
+		 required reg class, it is a less costly alternative
+		 as the pseudo stil can get a hard reg of necessary
+		 class.  */
+	      if (! no_regs_p && REG_P (op) && hard_regno[nop] < 0
+		  && (cl = get_reg_class (REGNO (op))) != NO_REGS
+		  && ira_class_subset_p[this_alternative][cl])
+		{
+		  if (lra_dump_file != NULL)
+		    fprintf
+		      (lra_dump_file,
+		       "            %d Super set class reg: reject-=3\n", nop);
+		  reject -= 3;
+		}
+
 	      this_alternative_offmemok = offmemok;
 	      if (this_costly_alternative != NO_REGS)
 		{
Index: config/arm/arm.h
===================================================================
--- config/arm/arm.h	(revision 207562)
+++ config/arm/arm.h	(working copy)
@@ -1272,8 +1272,8 @@ enum reg_class
    when addressing quantities in QI or HI mode; if we don't know the
    mode, then we must be conservative.  */
 #define MODE_BASE_REG_CLASS(MODE)					\
-    (TARGET_ARM || (TARGET_THUMB2 && !optimize_size) ? CORE_REGS :      \
-     (((MODE) == SImode) ? BASE_REGS : LO_REGS))
+    (TARGET_ARM || (TARGET_THUMB2 && (!optimize_size || arm_lra_flag))	\
+     ? CORE_REGS : ((MODE) == SImode ? BASE_REGS : LO_REGS))
 
 /* For Thumb we can not support SP+reg addressing, so we return LO_REGS
    instead of BASE_REGS.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: patch for PR59535
  2014-02-07 18:23 RFA: patch for PR59535 Vladimir Makarov
@ 2014-02-07 22:07 ` Jeff Law
  2014-02-10 14:10   ` Richard Earnshaw
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2014-02-07 22:07 UTC (permalink / raw)
  To: Vladimir Makarov, GCC Patches; +Cc: Richard Earnshaw

On 02/07/14 11:20, Vladimir Makarov wrote:
>    The following patch improves code size for ARM.  Before the patch
> CSiBE size generated by GCC configured --with-arch=armv7-a
> --with-fpu=vfpv3-d16 --with-float=hard (with -mthumb) was
>
> 2414926
>
> After the patch the size is
>
> 2396798
>
> For comparison, when the reload pass is used the size is
>
> 2400154
>
> The change in arm.h is to prevent reloading sp as an address by LRA.
> Reload has no such problem as it uses legitimate address hook and LRA
> mostly relies on base_reg_class.
>
> Richard, is this part ok to commit to the trunk?
I think so.  It's fixing a P1 regression, that makes it "in scope" as 
far as I'm concerned.


>
> The change in lra-constraints.c is for correct alternative choice in
> move patterns when pseudo is of class of general reg and one alternative
> contains lo regs and another one contains hi regs.
>
> The patch was bootstrapped on x86/x86-64 and arm.
>
> 2014-02-07  Vladimir Makarov  <vmakarov@redhat.com>
>
>          PR rtl-optimization/59535
>          * lra-constraints.c (process_alt_operands): Encourage alternative
>          when unassigned pseudo class is superset of the alternative class.
>          * config/arm/arm.h (MODE_BASE_REG_CLASS): Return CORE_REGS for
>          Thumb2 for LRA.
Just one nit in the comment in lra-constraints.c
s/stil/still/
Jeff


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: patch for PR59535
  2014-02-07 22:07 ` Jeff Law
@ 2014-02-10 14:10   ` Richard Earnshaw
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Earnshaw @ 2014-02-10 14:10 UTC (permalink / raw)
  To: Jeff Law; +Cc: Vladimir Makarov, GCC Patches

On 07/02/14 22:06, Jeff Law wrote:
> On 02/07/14 11:20, Vladimir Makarov wrote:
>>    The following patch improves code size for ARM.  Before the patch
>> CSiBE size generated by GCC configured --with-arch=armv7-a
>> --with-fpu=vfpv3-d16 --with-float=hard (with -mthumb) was
>>
>> 2414926
>>
>> After the patch the size is
>>
>> 2396798
>>
>> For comparison, when the reload pass is used the size is
>>
>> 2400154
>>
>> The change in arm.h is to prevent reloading sp as an address by LRA.
>> Reload has no such problem as it uses legitimate address hook and LRA
>> mostly relies on base_reg_class.
>>
>> Richard, is this part ok to commit to the trunk?
> I think so.  It's fixing a P1 regression, that makes it "in scope" as 
> far as I'm concerned.
> 

While this is a useful fix for Thumb2 (which had regressed slightly),
the PR is for Thumb1.  I tried this patch when compiling CSiBE with
-mthumb -mcpu=arm7tdmi -Os.  Sadly it made no difference at all to the
numbers there.

So this does not resolve PR59535.

R.

> 
>>
>> The change in lra-constraints.c is for correct alternative choice in
>> move patterns when pseudo is of class of general reg and one alternative
>> contains lo regs and another one contains hi regs.
>>
>> The patch was bootstrapped on x86/x86-64 and arm.
>>
>> 2014-02-07  Vladimir Makarov  <vmakarov@redhat.com>
>>
>>          PR rtl-optimization/59535
>>          * lra-constraints.c (process_alt_operands): Encourage alternative
>>          when unassigned pseudo class is superset of the alternative class.
>>          * config/arm/arm.h (MODE_BASE_REG_CLASS): Return CORE_REGS for
>>          Thumb2 for LRA.
> Just one nit in the comment in lra-constraints.c
> s/stil/still/
> Jeff
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-10 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-07 18:23 RFA: patch for PR59535 Vladimir Makarov
2014-02-07 22:07 ` Jeff Law
2014-02-10 14:10   ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).