[Bug target/112936] LoongArch: Wrong instruction costs

2023-12-17 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112936

Xi Ruoyao  changed:

   What|Removed |Added

   Target Milestone|--- |14.0
 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Xi Ruoyao  ---
Fixed for 14.

[Bug target/112936] LoongArch: Wrong instruction costs

2023-12-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112936

--- Comment #3 from GCC Commits  ---
The master branch has been updated by Xi Ruoyao :

https://gcc.gnu.org/g:50b3f596bd943ec6110c1987f14e5497ce39622f

commit r14-6642-g50b3f596bd943ec6110c1987f14e5497ce39622f
Author: Xi Ruoyao 
Date:   Sat Dec 9 17:41:32 2023 +0800

LoongArch: Fix instruction costs [PR112936]

Replace the instruction costs in loongarch_rtx_cost_data constructor
based on micro-benchmark results on LA464 and LA664.

This allows optimizations like "x * 17" to alsl, and "x * 68" to alsl
and slli.

gcc/ChangeLog:

PR target/112936
* config/loongarch/loongarch-def.cc
(loongarch_rtx_cost_data::loongarch_rtx_cost_data): Update
instruction costs per micro-benchmark results.
(loongarch_rtx_cost_optimize_size): Set all instruction costs
to (COSTS_N_INSNS (1) + 1).
* config/loongarch/loongarch.cc (loongarch_rtx_costs): Remove
special case for multiplication when optimizing for size.
Adjust division cost when TARGET_64BIT && !TARGET_DIV32.
Account the extra cost when TARGET_CHECK_ZERO_DIV and
optimizing for speed.

gcc/testsuite/ChangeLog

PR target/112936
* gcc.target/loongarch/mul-const-reduction.c: New test.

[Bug target/112936] LoongArch: Wrong instruction costs

2023-12-09 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112936

--- Comment #2 from Xi Ruoyao  ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-December/640012.html

[Bug target/112936] LoongArch: Wrong instruction costs

2023-12-09 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112936

Xi Ruoyao  changed:

   What|Removed |Added

   Keywords||patch
URL||https://gcc.gnu.org/piperma
   ||il/gcc-patches/2023-Decembe
   ||r/640012.html
 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |xry111 at gcc dot 
gnu.org

[Bug target/112936] LoongArch: Wrong instruction costs

2023-12-09 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112936

Xi Ruoyao  changed:

   What|Removed |Added

   Last reconfirmed||2023-12-09
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #1 from Xi Ruoyao  ---
Self-confirming as the original performance issue is from Jia Jie and the cost
model issue was isolated by Andrew.