public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM] Fix costing of sign-extending load in rtx costs
@ 2016-04-27 14:13 Kyrill Tkachov
  2016-05-11  9:00 ` Kyrill Tkachov
  2016-05-19 13:51 ` Ramana Radhakrishnan
  0 siblings, 2 replies; 4+ messages in thread
From: Kyrill Tkachov @ 2016-04-27 14:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

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

Hi all,

Another costs issue that came out of the investigation for PR 65932 is that
sign-extending loads get a higher cost than they should in the arm backend.
The problem is that when handling a sign-extend of a MEM we add the cost
of the load_sign_extend cost field and then recursively add the cost of the inner MEM
rtx, which is bogus. This will end up adding an extra load cost on it.

The solution in this patch is to just remove that recursive step.
With this patch from various CSE dumps I see much more sane costs assign to these
expressions (such as 12 instead of 32 or higher).

Bootstrapped and tested on arm-none-linux-gnueabihf.

Ok for trunk?

Thanks,
Kyrill

2016-04-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/arm/arm.c (arm_new_rtx_costs, SIGN_EXTEND case):
     Don't add cost of inner memory when handling sign-extended
     loads.

[-- Attachment #2: arm-ldsh-cost.patch --]
[-- Type: text/x-patch, Size: 520 bytes --]

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 7781b4b449ed48a8d902802d8e6a5c8e1ae7793f..7f2babe7339de3586de190bbe2cf8112919dd96f 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -10911,8 +10911,6 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
       if ((arm_arch4 || GET_MODE (XEXP (x, 0)) == SImode)
 	  && MEM_P (XEXP (x, 0)))
 	{
-	  *cost = rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
-
 	  if (mode == DImode)
 	    *cost += COSTS_N_INSNS (1);
 

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

* Re: [PATCH][ARM] Fix costing of sign-extending load in rtx costs
  2016-04-27 14:13 [PATCH][ARM] Fix costing of sign-extending load in rtx costs Kyrill Tkachov
@ 2016-05-11  9:00 ` Kyrill Tkachov
  2016-05-19 13:26   ` Kyrill Tkachov
  2016-05-19 13:51 ` Ramana Radhakrishnan
  1 sibling, 1 reply; 4+ messages in thread
From: Kyrill Tkachov @ 2016-05-11  9:00 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

Ping.
https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01655.html

Thanks,
Kyrill

On 27/04/16 15:13, Kyrill Tkachov wrote:
> Hi all,
>
> Another costs issue that came out of the investigation for PR 65932 is that
> sign-extending loads get a higher cost than they should in the arm backend.
> The problem is that when handling a sign-extend of a MEM we add the cost
> of the load_sign_extend cost field and then recursively add the cost of the inner MEM
> rtx, which is bogus. This will end up adding an extra load cost on it.
>
> The solution in this patch is to just remove that recursive step.
> With this patch from various CSE dumps I see much more sane costs assign to these
> expressions (such as 12 instead of 32 or higher).
>
> Bootstrapped and tested on arm-none-linux-gnueabihf.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
> 2016-04-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * config/arm/arm.c (arm_new_rtx_costs, SIGN_EXTEND case):
>     Don't add cost of inner memory when handling sign-extended
>     loads.

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

* Re: [PATCH][ARM] Fix costing of sign-extending load in rtx costs
  2016-05-11  9:00 ` Kyrill Tkachov
@ 2016-05-19 13:26   ` Kyrill Tkachov
  0 siblings, 0 replies; 4+ messages in thread
From: Kyrill Tkachov @ 2016-05-19 13:26 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

Ping.
Thanks,
Kyrill

On 11/05/16 10:00, Kyrill Tkachov wrote:
> Ping.
> https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01655.html
>
> Thanks,
> Kyrill
>
> On 27/04/16 15:13, Kyrill Tkachov wrote:
>> Hi all,
>>
>> Another costs issue that came out of the investigation for PR 65932 is that
>> sign-extending loads get a higher cost than they should in the arm backend.
>> The problem is that when handling a sign-extend of a MEM we add the cost
>> of the load_sign_extend cost field and then recursively add the cost of the inner MEM
>> rtx, which is bogus. This will end up adding an extra load cost on it.
>>
>> The solution in this patch is to just remove that recursive step.
>> With this patch from various CSE dumps I see much more sane costs assign to these
>> expressions (such as 12 instead of 32 or higher).
>>
>> Bootstrapped and tested on arm-none-linux-gnueabihf.
>>
>> Ok for trunk?
>>
>> Thanks,
>> Kyrill
>>
>> 2016-04-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>     * config/arm/arm.c (arm_new_rtx_costs, SIGN_EXTEND case):
>>     Don't add cost of inner memory when handling sign-extended
>>     loads.
>

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

* Re: [PATCH][ARM] Fix costing of sign-extending load in rtx costs
  2016-04-27 14:13 [PATCH][ARM] Fix costing of sign-extending load in rtx costs Kyrill Tkachov
  2016-05-11  9:00 ` Kyrill Tkachov
@ 2016-05-19 13:51 ` Ramana Radhakrishnan
  1 sibling, 0 replies; 4+ messages in thread
From: Ramana Radhakrishnan @ 2016-05-19 13:51 UTC (permalink / raw)
  To: Kyrill Tkachov, GCC Patches; +Cc: Richard Earnshaw

On 27/04/16 15:13, Kyrill Tkachov wrote:
> Hi all,
> 
> Another costs issue that came out of the investigation for PR 65932 is that
> sign-extending loads get a higher cost than they should in the arm backend.
> The problem is that when handling a sign-extend of a MEM we add the cost
> of the load_sign_extend cost field and then recursively add the cost of the inner MEM
> rtx, which is bogus. This will end up adding an extra load cost on it.
> 
> The solution in this patch is to just remove that recursive step.
> With this patch from various CSE dumps I see much more sane costs assign to these
> expressions (such as 12 instead of 32 or higher).
> 
> Bootstrapped and tested on arm-none-linux-gnueabihf.
> 
> Ok for trunk?
> 
> Thanks,
> Kyrill
> 
> 2016-04-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>     * config/arm/arm.c (arm_new_rtx_costs, SIGN_EXTEND case):
>     Don't add cost of inner memory when handling sign-extended
>     loads.


Ok ... it took me a while to work out that this was sane.


regards
Ramana



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

end of thread, other threads:[~2016-05-19 13:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 14:13 [PATCH][ARM] Fix costing of sign-extending load in rtx costs Kyrill Tkachov
2016-05-11  9:00 ` Kyrill Tkachov
2016-05-19 13:26   ` Kyrill Tkachov
2016-05-19 13:51 ` Ramana Radhakrishnan

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).