From: Richard Biener <richard.guenther@gmail.com>
To: Andrew Pinski <apinski@marvell.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix PR 110554: vec lowering introduces scalar signed-boolean:32 comparisons
Date: Thu, 6 Jul 2023 08:08:23 +0200 [thread overview]
Message-ID: <CAFiYyc3kU4VCAStsDZfOB-uqeeeqGTvDcKWrQdXzo+z0vccXPA@mail.gmail.com> (raw)
In-Reply-To: <20230705170136.581584-1-apinski@marvell.com>
On Wed, Jul 5, 2023 at 7:02 PM Andrew Pinski via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> So the problem is vector generic decided to do comparisons in signed-boolean:32
> types but the rest of the middle-end was not ready for that. Since we are building
> the comparison which will feed into a cond_expr here, using boolean_type_node is
> better and also correct. The rest of the compiler thinks the ranges for
> comparison is always [0,1] too.
>
> Note this code does not currently lowers bigger vector sizes into smaller
> vector sizes so using boolean_type_node here is better.
>
> OK? bootstrapped and tested on x86_64-linux-gnu with no regressions.
OK.
> gcc/ChangeLog:
>
> PR middle-end/110554
> * tree-vect-generic.cc (expand_vector_condition): For comparisons,
> just build using boolean_type_node instead of the cond_type.
> For non-comparisons/non-scalar-bitmask, build a ` != 0` gimple
> that will feed into the COND_EXPR.
> ---
> gcc/tree-vect-generic.cc | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
> index df04a0db68d..a7e6cb87a5e 100644
> --- a/gcc/tree-vect-generic.cc
> +++ b/gcc/tree-vect-generic.cc
> @@ -1121,7 +1121,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names)
> comp_width, comp_index);
> tree aa2 = tree_vec_extract (gsi, comp_inner_type, a2,
> comp_width, comp_index);
> - aa = gimplify_build2 (gsi, code, cond_type, aa1, aa2);
> + aa = gimplify_build2 (gsi, code, boolean_type_node, aa1, aa2);
> }
> else if (a_is_scalar_bitmask)
> {
> @@ -1132,7 +1132,11 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names)
> build_zero_cst (TREE_TYPE (a)));
> }
> else
> - aa = tree_vec_extract (gsi, cond_type, a, comp_width, comp_index);
> + {
> + result = tree_vec_extract (gsi, cond_type, a, comp_width, comp_index);
> + aa = gimplify_build2 (gsi, NE_EXPR, boolean_type_node, result,
> + build_zero_cst (cond_type));
> + }
> result = gimplify_build3 (gsi, COND_EXPR, inner_type, aa, bb, cc);
> if (!CONSTANT_CLASS_P (result))
> constant_p = false;
> --
> 2.31.1
>
prev parent reply other threads:[~2023-07-06 6:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 17:01 Andrew Pinski
2023-07-06 6:08 ` Richard Biener [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=CAFiYyc3kU4VCAStsDZfOB-uqeeeqGTvDcKWrQdXzo+z0vccXPA@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=apinski@marvell.com \
--cc=gcc-patches@gcc.gnu.org \
/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).