diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2020-09-02 09:30:50 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2020-09-02 09:30:50 +0100 |
commit | 6640a5b9e7c6f66a7d0c3de1bf01f24c3b20b692 (patch) | |
tree | bc49b2b1fc7da16c317860a58d25e1efb7544f2f | |
parent | 7047a8bab6e41fe9f5dbb29ca170ce416e08dd11 (diff) | |
download | gcc-6640a5b9e7c6f66a7d0c3de1bf01f24c3b20b692.zip gcc-6640a5b9e7c6f66a7d0c3de1bf01f24c3b20b692.tar.gz gcc-6640a5b9e7c6f66a7d0c3de1bf01f24c3b20b692.tar.bz2 |
hppa: Improve hppa_rtx_costs for shifts by constants.
This patch provides more accurate rtx_costs estimates for shifts by
integer constants (which are cheaper than by a register amount).
2020-09-02 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.
-rw-r--r-- | gcc/config/pa/pa.c | 21 |
1 files changed, 21 insertions, 0 deletions
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 |