From: Juergen Christ <jchrist@linux.ibm.com>
To: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org, krebbel@linux.ibm.com
Subject: Re: [PATCH] s390x: Optimize vector permute with constant indexes
Date: Tue, 9 Apr 2024 16:29:45 +0200 [thread overview]
Message-ID: <ZhVQ2eIWuTwN4aBq@li-3a824ecc-34fe-11b2-a85c-eae455c7d911.ibm.com> (raw)
In-Reply-To: <ZhUPhPQzn-zSjDCO@li-819a89cc-2401-11b2-a85c-cca1ce6aa768.ibm.com>
Am Tue, Apr 09, 2024 at 11:51:00AM +0200 schrieb Stefan Schulze Frielinghaus:
> > +static bool expand_perm_as_replicate (const struct expand_vec_perm_d &d)
> ^~~~~~~~~~~~~~~~~~~~~~~~
> Function names start on a new line.
Fixed
> > +{
> > + unsigned char i;
> > + unsigned char elem;
> > + rtx base = d.op0;
> > + rtx insn;
> > + /* Needed to silence maybe-uninitialized warning. */
> > + gcc_assert(d.nelt > 0);
> ~~~~~~~~~~^~~~~~~~~~~~
> Between function name and open bracket whitespace is missing.
Fixed.
> Curiously enough, the error is about d which is a reference and cannot
> be null. If you are eager you could reduce this and open a PR.
>
> s390.cc:17935:8: warning: ‘d’ may be used uninitialized [-Wmaybe-uninitialized]
> 17935 | elem = d.perm[0];
> | ~~~~~^~~~~~~~~~~
Weirdly enough it is not `d`, but `d.perm[0]` that seems to be the
problem. But I did not reduce this. As the assertion suggests, it is
known that all elements in d.perm in the range [0,d.nelts) are
initialized. I would like to defer that to a time when I (hopefully)
have some more spare time.
> > + if (expand_perm_as_replicate(d))
> ~~~~~~~~~~~~~~~~~~~~~~~~^~~
> Between function name and open bracket whitespace is missing.
Fixed
> > diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-expand-replicate.c b/gcc/testsuite/gcc.target/s390/vector/vec-expand-replicate.c
> > new file mode 100644
> > index 000000000000..27563a00f22b
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/s390/vector/vec-expand-replicate.c
> > @@ -0,0 +1,30 @@
> > +/* Check that the vectorize_vec_perm_const expander correctly deals with
> > + replication. Extracted from spec "nab". */
> > +
> > +/* { dg-do compile } */
> > +/* { dg-options "-O3 -mzarch -march=z13 -fvect-cost-model=unlimited" } */
> > +
> > +
> > +#define REAL_T double
> > +typedef REAL_T MATRIX_T[ 4 ][ 4 ];
> > +
> > +int concat_mat_i, concat_mat_j;
> > +static void concat_mat(MATRIX_T m1, MATRIX_T, MATRIX_T m3);
> > +MATRIX_T *rot4p() {
> > + MATRIX_T mat3, mat4;
> > + static MATRIX_T mat5;
> > + concat_mat(mat4, mat3, mat5);
> > +}
> > +void concat_mat(MATRIX_T m1, MATRIX_T, MATRIX_T m3) {
> > + int k;
> > + for (;; concat_mat_i++) {
> > + concat_mat_j = 0;
> > + for (; 4; concat_mat_j++) {
> > + k = 0;
> > + for (; k < 4; k++)
> > + m3[concat_mat_i][concat_mat_j] += m1[concat_mat_i][k];
> > + }
>
> Just nitpicking, if we could come up with a test case which does not
> involve integer overflows due to non-terminating loops, I would prefer
> that.
Well, I have a version without integer overflows, but it still has
non-terminating loops...
Will send a v2,
Juergen
prev parent reply other threads:[~2024-04-09 14:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 7:56 Juergen Christ
2024-04-09 9:51 ` Stefan Schulze Frielinghaus
2024-04-09 14:29 ` Juergen Christ [this message]
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=ZhVQ2eIWuTwN4aBq@li-3a824ecc-34fe-11b2-a85c-eae455c7d911.ibm.com \
--to=jchrist@linux.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=krebbel@linux.ibm.com \
--cc=stefansf@linux.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).