From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/98381 - fix live bool vector extract
Date: Tue, 5 Jan 2021 15:54:35 +0100 (CET) [thread overview]
Message-ID: <nycvar.YFH.7.76.2101051554150.905@elmra.sevgm.obk> (raw)
This fixes extraction of live bool vector results for the case of
integer mode vectors.
Bootstrapped and tested on x86_64-unknown-linux-gnu (and i386.exp with
SDE), pushed.
2021-01-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/98381
* tree.c (vector_element_bits): Properly compute bool vector
element size.
* tree-vect-loop.c (vectorizable_live_operation): Properly
compute the last lane bit offset.
---
gcc/tree-vect-loop.c | 5 ++---
gcc/tree.c | 9 +++++++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 830531f48b8..965cc164f6e 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -8494,7 +8494,7 @@ vectorizable_live_operation (vec_info *vinfo,
{
loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo);
imm_use_iterator imm_iter;
- tree lhs, lhs_type, bitsize, vec_bitsize;
+ tree lhs, lhs_type, bitsize;
tree vectype = (slp_node
? SLP_TREE_VECTYPE (slp_node)
: STMT_VINFO_VECTYPE (stmt_info));
@@ -8637,7 +8637,6 @@ vectorizable_live_operation (vec_info *vinfo,
lhs_type = TREE_TYPE (lhs);
bitsize = vector_element_bits_tree (vectype);
- vec_bitsize = TYPE_SIZE (vectype);
/* Get the vectorized lhs of STMT and the lane to use (counted in bits). */
tree vec_lhs, bitstart;
@@ -8661,7 +8660,7 @@ vectorizable_live_operation (vec_info *vinfo,
vec_lhs = gimple_get_lhs (vec_stmt);
/* Get the last lane in the vector. */
- bitstart = int_const_binop (MINUS_EXPR, vec_bitsize, bitsize);
+ bitstart = int_const_binop (MULT_EXPR, bitsize, bitsize_int (nunits - 1));
}
if (loop_vinfo)
diff --git a/gcc/tree.c b/gcc/tree.c
index 421a2b4bc02..e0a1d512019 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -14021,8 +14021,13 @@ vector_element_bits (const_tree type)
{
gcc_checking_assert (VECTOR_TYPE_P (type));
if (VECTOR_BOOLEAN_TYPE_P (type))
- return vector_element_size (tree_to_poly_uint64 (TYPE_SIZE (type)),
- TYPE_VECTOR_SUBPARTS (type));
+ {
+ if (VECTOR_MODE_P (TYPE_MODE (type)))
+ return vector_element_size (tree_to_poly_uint64 (TYPE_SIZE (type)),
+ TYPE_VECTOR_SUBPARTS (type));
+ else
+ return 1;
+ }
return tree_to_uhwi (TYPE_SIZE (TREE_TYPE (type)));
}
--
2.26.2
reply other threads:[~2021-01-05 14:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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.76.2101051554150.905@elmra.sevgm.obk \
--to=rguenther@suse.de \
--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).