[0/3] LoongArch: Fix instruction costs

Message ID 20231209170347.12601-2-xry111@xry111.site
Headers
Series LoongArch: Fix instruction costs |

Message

Xi Ruoyao Dec. 9, 2023, 5:03 p.m. UTC
  Update LoongArch instruction costs based on the micro-benchmark results
on LA464 and LA664.  In particular, this allows generating alsl/slli or
alsl/slli + add pairs for multiplying some constants as on LA464/LA664
a mul instruction is 4x slower than alsl, slli, or add instructions.

Bootstrapped and regtested on loongarch64-linux-gnu.  Ok for trunk?

Xi Ruoyao (3):
  LoongArch: Include rtl.h for COSTS_N_INSNS instead of hard coding our
    own
  LoongArch: Fix instruction costs [PR112936]
  LoongArch: Add alslsi3_extend

 gcc/config/loongarch/loongarch-def.cc         | 42 ++++++++++---------
 gcc/config/loongarch/loongarch.cc             | 22 +++++-----
 gcc/config/loongarch/loongarch.md             | 12 ++++++
 .../loongarch/mul-const-reduction.c           | 11 +++++
 4 files changed, 56 insertions(+), 31 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/mul-const-reduction.c
  

Comments

Xi Ruoyao Dec. 17, 2023, 3:22 p.m. UTC | #1
On Sun, 2023-12-10 at 01:03 +0800, Xi Ruoyao wrote:
> Update LoongArch instruction costs based on the micro-benchmark results
> on LA464 and LA664.  In particular, this allows generating alsl/slli or
> alsl/slli + add pairs for multiplying some constants as on LA464/LA664
> a mul instruction is 4x slower than alsl, slli, or add instructions.
> 
> Bootstrapped and regtested on loongarch64-linux-gnu.  Ok for trunk?
> 
> Xi Ruoyao (3):
>   LoongArch: Include rtl.h for COSTS_N_INSNS instead of hard coding our
>     own
>   LoongArch: Fix instruction costs [PR112936]
>   LoongArch: Add alslsi3_extend
> 
>  gcc/config/loongarch/loongarch-def.cc         | 42 ++++++++++---------
>  gcc/config/loongarch/loongarch.cc             | 22 +++++-----
>  gcc/config/loongarch/loongarch.md             | 12 ++++++
>  .../loongarch/mul-const-reduction.c           | 11 +++++
>  4 files changed, 56 insertions(+), 31 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/mul-const-reduction.c

Pushed to r14-664{1,2,3} as all 3 patches are approved.