* [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants.
@ 2020-08-27 16:42 Roger Sayle
2020-08-27 18:15 ` Jeff Law
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Roger Sayle @ 2020-08-27 16:42 UTC (permalink / raw)
To: 'GCC Patches'; +Cc: 'John David Anglin', 'Jeff Law'
[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]
Hi Dave (and Jeff),
For your consideration, here's a patch that should fix the recent regression
of gcc.dg/tree-ssa/slrt-13.c on hppa targets.
This patch provides more accurate rtx_costs estimates for shifts by
integer constants (which are cheaper than by a register amount).
Fine tuning these is sufficient to have simple-ssa-strength-reduce
prefer multiplications by four, over multiplications by five.
Technically only the ASHIFT is required to fix the regression, but for
symmetry
I've added the appropriate PA-RISC values for all three shift types (in
SImode).
I've also checked that this doesn't reintroduce PR middle-end/87256.
I was wondering whether you could please "put this in the queue", and
reconfirm that PR middle-end/87256 remains resolved?
2020-08-27 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]:
Provide accurate costs for shifts of integer constants.
Many thanks in advance (and my apologies for the inconvenience),
Roger
--
Roger Sayle
NextMove Software
Cambridge, UK
[-- Attachment #2: patchh4.txt --]
[-- Type: text/plain, Size: 1285 bytes --]
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index cb88852..a9223ab 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -1642,6 +1642,14 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code,
else
*total = COSTS_N_INSNS (18);
}
+ else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
+ {
+ if (TARGET_64BIT)
+ *total = COSTS_N_INSNS (2);
+ else
+ *total = COSTS_N_INSNS (1);
+ return true;
+ }
else if (TARGET_64BIT)
*total = COSTS_N_INSNS (4);
else
@@ -1665,6 +1673,14 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code,
else
*total = COSTS_N_INSNS (19);
}
+ else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
+ {
+ if (TARGET_64BIT)
+ *total = COSTS_N_INSNS (2);
+ else
+ *total = COSTS_N_INSNS (1);
+ return true;
+ }
else if (TARGET_64BIT)
*total = COSTS_N_INSNS (4);
else
@@ -1688,6 +1704,11 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code,
else
*total = COSTS_N_INSNS (15);
}
+ else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
+ {
+ *total = COSTS_N_INSNS (1);
+ return true;
+ }
else if (TARGET_64BIT)
*total = COSTS_N_INSNS (3);
else
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants.
2020-08-27 16:42 [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants Roger Sayle
@ 2020-08-27 18:15 ` Jeff Law
2020-08-27 18:58 ` John David Anglin
2020-09-01 23:53 ` John David Anglin
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2020-08-27 18:15 UTC (permalink / raw)
To: Roger Sayle, 'GCC Patches'; +Cc: 'John David Anglin'
On Thu, 2020-08-27 at 17:42 +0100, Roger Sayle wrote:
> Hi Dave (and Jeff),
> For your consideration, here's a patch that should fix the recent regression
> of gcc.dg/tree-ssa/slrt-13.c on hppa targets.
>
> This patch provides more accurate rtx_costs estimates for shifts by
> integer constants (which are cheaper than by a register amount).
> Fine tuning these is sufficient to have simple-ssa-strength-reduce
> prefer multiplications by four, over multiplications by five.
>
> Technically only the ASHIFT is required to fix the regression, but for
> symmetry
> I've added the appropriate PA-RISC values for all three shift types (in
> SImode).
> I've also checked that this doesn't reintroduce PR middle-end/87256.
>
> I was wondering whether you could please "put this in the queue", and
> reconfirm that PR middle-end/87256 remains resolved?
>
>
> 2020-08-27 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> * config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]:
> Provide accurate costs for shifts of integer constants.
Spinning in the tester. Figure results about this time tomorrow:
http://3.14.90.209:8080/job/hppa-linux-gnu/944/console
>
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants.
2020-08-27 16:42 [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants Roger Sayle
2020-08-27 18:15 ` Jeff Law
@ 2020-08-27 18:58 ` John David Anglin
2020-09-01 23:53 ` John David Anglin
2 siblings, 0 replies; 4+ messages in thread
From: John David Anglin @ 2020-08-27 18:58 UTC (permalink / raw)
To: Roger Sayle, 'GCC Patches'
Hi Roger,
On 2020-08-27 12:42 p.m., Roger Sayle wrote:
> I was wondering whether you could please "put this in the queue", and
> reconfirm that PR middle-end/87256 remains resolved?
>
>
> 2020-08-27 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> * config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]:
> Provide accurate costs for shifts of integer constants.
Will test.
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants.
2020-08-27 16:42 [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants Roger Sayle
2020-08-27 18:15 ` Jeff Law
2020-08-27 18:58 ` John David Anglin
@ 2020-09-01 23:53 ` John David Anglin
2 siblings, 0 replies; 4+ messages in thread
From: John David Anglin @ 2020-09-01 23:53 UTC (permalink / raw)
To: Roger Sayle, 'GCC Patches'
Hi Roger,
This change is fine. PR middle-end/87256 remains resolved.
I'll have to tweak the shadd-2 test again. The number of sh*add instructions dropped
to three but the total number of instruction dropped by one.
Thanks,
Dave
On 2020-08-27 12:42 p.m., Roger Sayle wrote:
> Hi Dave (and Jeff),
> For your consideration, here's a patch that should fix the recent regression
> of gcc.dg/tree-ssa/slrt-13.c on hppa targets.
>
> This patch provides more accurate rtx_costs estimates for shifts by
> integer constants (which are cheaper than by a register amount).
> Fine tuning these is sufficient to have simple-ssa-strength-reduce
> prefer multiplications by four, over multiplications by five.
>
> Technically only the ASHIFT is required to fix the regression, but for
> symmetry
> I've added the appropriate PA-RISC values for all three shift types (in
> SImode).
> I've also checked that this doesn't reintroduce PR middle-end/87256.
>
> I was wondering whether you could please "put this in the queue", and
> reconfirm that PR middle-end/87256 remains resolved?
>
>
> 2020-08-27 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> * config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]:
> Provide accurate costs for shifts of integer constants.
>
> Many thanks in advance (and my apologies for the inconvenience),
> Roger
> --
> Roger Sayle
> NextMove Software
> Cambridge, UK
>
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-01 23:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 16:42 [PATCH] hppa: Improve hppa_rtx_costs for shifts by constants Roger Sayle
2020-08-27 18:15 ` Jeff Law
2020-08-27 18:58 ` John David Anglin
2020-09-01 23:53 ` John David Anglin
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).