public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>
To: richard.sandiford <richard.sandiford@arm.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	 rguenther <rguenther@suse.de>,  linkw <linkw@linux.ibm.com>
Subject: Re: Re: [PATCH] VECT: Change flow of decrement IV
Date: Tue, 30 May 2023 19:36:28 +0800	[thread overview]
Message-ID: <BA06748B70B6FC07+20230530193628082710370@rivai.ai> (raw)
In-Reply-To: <mptedmy838e.fsf@arm.com>

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

Before this patch:
foo:
ble a2,zero,.L5
csrr a3,vlenb
srli a4,a3,2
.L3:
minu a5,a2,a4
vsetvli zero,a5,e32,m1,ta,ma
vle32.v v2,0(a1)
vle32.v v1,0(a0)
vsetvli t1,zero,e32,m1,ta,ma
vadd.vv v1,v1,v2
vsetvli zero,a5,e32,m1,ta,ma
vse32.v v1,0(a0)
add a1,a1,a3
add a0,a0,a3
      sub   a2,a2,a5
bne a2,zero,.L3
.L5:
ret

After this patch:

foo:
ble a2,zero,.L5
csrr a3,vlenb
srli a4,a3,2
neg a7,a4   -->>>additional instruction
.L3:
minu a5,a2,a4
vsetvli zero,a5,e32,m1,ta,ma
vle32.v v2,0(a1)
vle32.v v1,0(a0)
vsetvli t1,zero,e32,m1,ta,ma
mv a6,a2  -->>>additional instruction
vadd.vv v1,v1,v2
vsetvli zero,a5,e32,m1,ta,ma
vse32.v v1,0(a0)
add a1,a1,a3
add a0,a0,a3
add a2,a2,a7
bgtu a6,a4,.L3
.L5:
ret

There is 1 more instruction in preheader and 1 more instruction in loop.
But I think it's OK for RVV since we will definitely be using SELECT_VL so this issue will gone.
As long as this flow is better to power (SCEV)。



juzhe.zhong@rivai.ai
 
From: Richard Sandiford
Date: 2023-05-30 19:31
To: juzhe.zhong
CC: gcc-patches; rguenther; linkw
Subject: Re: [PATCH] VECT: Change flow of decrement IV
juzhe.zhong@rivai.ai writes:
> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> Follow Richi's suggestion, I change current decrement IV flow from:
>
> do {
>    remain -= MIN (vf, remain);
> } while (remain != 0);
>
> into:
>
> do {
>    old_remain = remain;
>    len = MIN (vf, remain);
>    remain -= vf;
> } while (old_remain >= vf);
>
> to enhance SCEV.
>
> ALL tests (decrement IV) of RVV are passed.
 
How does it affect RVV code quality?  I thought you specifically chose
the previous approach because code quality was better that way.
 
Richard
 

  reply	other threads:[~2023-05-30 11:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 11:28 juzhe.zhong
2023-05-30 11:31 ` Richard Sandiford
2023-05-30 11:36   ` juzhe.zhong [this message]
2023-05-30 11:41     ` Richard Sandiford
     [not found]     ` <5C7770CA9FB40F7E+8BE427DD-97DA-4B93-A73A-8CDD1D92089B@rivai.ai>
2023-05-30 12:01       ` Richard Sandiford
     [not found]     ` <685EE879E20B3272+6338EB42-0A9D-4147-993D-99DC8FF7C832@rivai.ai>
2023-05-30 12:33       ` Richard Biener
2023-05-30 12:37         ` 钟居哲
     [not found]           ` <FA43CAC5-BCCE-42AF-8A6B-E69F1A496F5C@suse.de>
2023-05-30 22:51             ` 钟居哲
2023-05-30 14:13         ` 钟居哲
2023-05-30 14:47         ` 钟居哲
2023-05-30 15:05         ` 钟居哲
2023-05-31  1:42           ` juzhe.zhong
2023-05-31  6:41             ` Richard Biener
2023-05-31  6:50               ` juzhe.zhong
2023-05-31  7:38                 ` Kewen.Lin
2023-05-31  7:50                   ` juzhe.zhong
2023-05-31  7:28               ` Richard Sandiford
2023-05-31  7:36                 ` juzhe.zhong
2023-05-31  8:44                   ` Richard Biener
2023-05-31  7:38                 ` Richard Biener
2023-05-31  7:49                   ` juzhe.zhong
2023-05-31  9:01                   ` Richard Sandiford
2023-05-31  9:30                     ` juzhe.zhong
2023-05-31 10:53                       ` Richard Biener
2023-05-31 12:16                         ` 钟居哲
2023-05-30 11:38   ` juzhe.zhong

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=BA06748B70B6FC07+20230530193628082710370@rivai.ai \
    --to=juzhe.zhong@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=rguenther@suse.de \
    --cc=richard.sandiford@arm.com \
    /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).