public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robin Dapp <rdapp.gcc@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: rdapp.gcc@gmail.com, gcc-patches <gcc-patches@gcc.gnu.org>,
	Tamar Christina <Tamar.Christina@arm.com>
Subject: Re: [PATCH] vect: Use statement vectype for conditional mask.
Date: Thu, 16 Nov 2023 23:30:00 +0100	[thread overview]
Message-ID: <c074969c-afb2-42b5-9e96-fec2cb750640@gmail.com> (raw)
In-Reply-To: <CAFiYyc1pz9fTyZSXarCYFz4oNEY0Dd3OxA=wW+LX+MOGrVFT8A@mail.gmail.com>

> For the fortran testcase we don't even run into this but hit an
> internal def and assert on
> 
>       gcc_assert (STMT_VINFO_VEC_STMTS (def_stmt_info).length () == ncopies);
> 
> I think this shows missing handling of .COND_* in the bool pattern recognition
> as we get the 'bool' condition as boolean data vector rather than a mask.  The
> same is true for the testcase with the invariant condition.  This causes us to
> select the wrong vector type here.  The "easiest" might be to look at
> how COND_EXPR is handled in vect_recog_bool_pattern and friends and
> handle .COND_* IFNs the same for the mask operand.

For the first (imagick) testcase adding a bool pattern does not help
because we always pass NULL as vectype to vect_get_vec_defs.
Doing so we will always use get_vectype_for_scalar_type (i.e.
a "full" bool vector) because vectype of the (conditional) stmt
is the lhs type and not the mask's type.
For cond_exprs in vectorizable_condition we directly pass a
comp_vectype instead (truth_type).  Wouldn't that, independently
of the pattern recog, make sense?

Now for the Fortran testcase I'm still a bit lost.  Opposed to
before we now vectorize with a variable VF and hit the problem
in the epilogue with ncopies = 2.

.COND_ADD (_7, __gcov0.__brute_force_MOD_brute_I_lsm.21_67, 1, __gcov0.__brute_force_MOD_brute_I_lsm.21_67);
where
_7 = *_6
which is an internal_def.

I played around with doing it analogously to the COND_EXPR
handling, so creating a COND_ADD (_7 != 0) which will required
several fixups in other places because we're not prepared to
handle that.  In the end it seems to only shift the problem
because we will still need the definition of _7.

I guess you're implying that the definition should have already
been handled by pattern recognition so that at the point when
we need it, it has a related pattern stmt with the proper mask
type?

Regards
 Robin


  reply	other threads:[~2023-11-16 22:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 16:18 Robin Dapp
2023-11-10  9:33 ` Richard Biener
2023-11-16 22:30   ` Robin Dapp [this message]
2023-11-17  8:24     ` Richard Biener
2023-11-17  8:45       ` Robin Dapp
2023-11-17  8:47         ` Richard Biener
2023-11-17 13:04           ` Robin Dapp
2023-12-03 18:32             ` [PATCH] testsuite: Fix up gcc.target/aarch64/pr112406.c for modern C [PR112406] Jakub Jelinek
2023-12-03 18:32               ` Jakub Jelinek
2023-12-03 18:59               ` Richard Biener
2023-11-17 19:20       ` [PATCH] vect: Use statement vectype for conditional mask Robin Dapp
2023-11-20  8:03         ` Richard Biener

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=c074969c-afb2-42b5-9e96-fec2cb750640@gmail.com \
    --to=rdapp.gcc@gmail.com \
    --cc=Tamar.Christina@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.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).