public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: chenglulu <chenglulu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, gcc-patches@gcc.gnu.org
Cc: i@xen0n.name, xuchenghua@loongson.cn, c@jia.je
Subject: Re: [PATCH 2/3] LoongArch: Fix instruction costs [PR112936]
Date: Thu, 14 Dec 2023 09:16:40 +0800	[thread overview]
Message-ID: <81b9ace4-e097-c165-fd13-caa55ad8544e@loongson.cn> (raw)
In-Reply-To: <6a871d273f9365d1600d3dae6b5227405d19b1d2.camel@xry111.site>


在 2023/12/13 下午9:20, Xi Ruoyao 写道:
> On Wed, 2023-12-13 at 20:22 +0800, chenglulu wrote:
>
> 在 2023/12/10 上午1:03, Xi Ruoyao 写道:
> 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.
> ---
>     gcc/config/loongarch/loongarch-def.cc         | 39 ++++++++++---------
>     gcc/config/loongarch/loongarch.cc             | 22 +++++------
>     .../loongarch/mul-const-reduction.c           | 11 ++++++
>     3 files changed, 43 insertions(+), 29 deletions(-)
>     create mode 100644 gcc/testsuite/gcc.target/loongarch/mul-const-reduction.c
>
> Well, I'm curious about how the value of this cost is obtained.
>
> I just make a loop containing 1000 mul.w instructions, then run the loop
> 1000000 times and compare the time usage with running another loop
> containing 1000 addi.w instructions iterated 1000000 times too.
> Likewise for other instructions...
>
Ok. I need to do a performance comparison of the spec here. Probably 
tomorrow the results will be available.

Thanks!



  reply	other threads:[~2023-12-14  1:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-09 17:03 [PATCH 0/3] LoongArch: Fix instruction costs Xi Ruoyao
2023-12-09 17:03 ` [PATCH 1/3] LoongArch: Include rtl.h for COSTS_N_INSNS instead of hard coding our own Xi Ruoyao
2023-12-13 12:57   ` chenglulu
2023-12-09 17:03 ` [PATCH 2/3] LoongArch: Fix instruction costs [PR112936] Xi Ruoyao
2023-12-13 12:22   ` chenglulu
2023-12-13 13:20     ` Xi Ruoyao
2023-12-14  1:16       ` chenglulu [this message]
2023-12-15  7:56         ` chenglulu
2023-12-17  3:02           ` chenglulu
2023-12-09 17:03 ` [PATCH 3/3] LoongArch: Add alslsi3_extend Xi Ruoyao
2023-12-13 12:58   ` chenglulu
2023-12-17 15:22 ` Pushed: [PATCH 0/3] LoongArch: Fix instruction costs Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81b9ace4-e097-c165-fd13-caa55ad8544e@loongson.cn \
    --to=chenglulu@loongson.cn \
    --cc=c@jia.je \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=i@xen0n.name \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).