From: Richard Biener <rguenther@suse.de>
To: Robin Dapp <rdapp.gcc@gmail.com>
Cc: "juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>,
gcc-patches <gcc-patches@gcc.gnu.org>,
"richard.sandiford" <richard.sandiford@arm.com>,
krebbel <krebbel@linux.ibm.com>, uweigand <uweigand@de.ibm.com>,
linkw@linux.ibm.com
Subject: Re: [PATCH V2] VECT: Support LEN_MASK_ LOAD/STORE to support flow control for length loop control
Date: Thu, 15 Jun 2023 11:12:25 +0000 (UTC) [thread overview]
Message-ID: <nycvar.YFH.7.77.849.2306151107000.4723@jbgna.fhfr.qr> (raw)
In-Reply-To: <aeb767ab-a095-061e-9e0b-e4414694d9b6@gmail.com>
On Thu, 15 Jun 2023, Robin Dapp wrote:
> > the minus in 'operand 2 - operand 3' should be a plus if the
> > bias is really zero or -1. I suppose
>
> Yes, that somehow got lost from when the bias was still +1. Maybe
> Juzhe can fix this in the course of his patch.
>
> > that's quite conservative. I think you can do better when the
> > loads are aligned, reading an extra byte when ignoring the bias
> > is OK and you at least know the very first element is used.
> > For stores you would need to emit compare&jump for all but
> > the first store of a group though ...
>
> The implementation is a first shot and yes we could do a bit
> better but limiting to a single rgroup is IMHO the more severe
> restriction. The pattern wasn't hit very often across SPEC
> either way. I think overall proper masking is more important for
> fixed-length vectors while length control might be more useful
> for variable-length vectors. Just my gut feeling though, you're
> the expert there.
>
> > That said, I'm still not seeing where you actually apply the bias.
>
> We do
>
> +
> + int partial_load_bias = LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo);
> + if (partial_load_bias != 0)
> + {
> + tree adjusted_len = rgc->bias_adjusted_ctrl;
> + gassign *minus = gimple_build_assign (adjusted_len, PLUS_EXPR,
> + rgc->controls[0],
> + build_int_cst
> + (TREE_TYPE (rgc->controls[0]),
> + partial_load_bias));
> + gimple_seq_add_stmt (header_seq, minus);
> + }
> +
>
> as well as
>
> + if (use_bias_adjusted_len)
> + {
> + gcc_assert (i == 0);
> + tree adjusted_len =
> + make_temp_ssa_name (len_type, NULL, "adjusted_loop_len");
> + SSA_NAME_DEF_STMT (adjusted_len) = gimple_build_nop ();
> + rgl->bias_adjusted_ctrl = adjusted_len;
> + }
Ah, OK. It's a bit odd to have predicates on define_expand. The
define_expand pattern is expected to only match either literal 0
or literal -1 (and consistently so for all len_ optabs) and thus
operand 2, the length, needs to be adjusted by the middle-end
to match up with the pattern supplied operand 3.
Richard.
next prev parent reply other threads:[~2023-06-15 11:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 4:14 juzhe.zhong
2023-06-15 8:06 ` Richard Biener
2023-06-15 8:47 ` juzhe.zhong
2023-06-15 8:58 ` Robin Dapp
2023-06-15 9:01 ` juzhe.zhong
2023-06-15 9:15 ` Richard Biener
2023-06-15 9:18 ` Robin Dapp
2023-06-15 9:20 ` Robin Dapp
2023-06-15 9:52 ` Richard Biener
2023-06-15 10:08 ` juzhe.zhong
2023-06-15 10:10 ` Robin Dapp
2023-06-15 11:12 ` Richard Biener [this message]
[not found] ` <2023061516473052116877@rivai.ai>
2023-06-15 8:56 ` 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=nycvar.YFH.7.77.849.2306151107000.4723@jbgna.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=juzhe.zhong@rivai.ai \
--cc=krebbel@linux.ibm.com \
--cc=linkw@linux.ibm.com \
--cc=rdapp.gcc@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=uweigand@de.ibm.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).