public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6859] middle-end/98793 - properly handle BLKmode vectors in vector_element_bits
@ 2021-01-22 14:24 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-01-22 14:24 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4be156d6bef317b8704052f11431457a577ed564
commit r11-6859-g4be156d6bef317b8704052f11431457a577ed564
Author: Richard Biener <rguenther@suse.de>
Date: Fri Jan 22 14:32:39 2021 +0100
middle-end/98793 - properly handle BLKmode vectors in vector_element_bits
The previous change made AVX512 mask vectors correct but disregarded
the possibility of generic (BLKmode) boolean vectors which are exposed
by the frontends already.
2021-01-22 Richard Biener <rguenther@suse.de>
PR middle-end/98793
* tree.c (vector_element_bits): Key single-bit bool vector on
integer mode rather than not vector mode.
* gcc.dg/pr98793.c: New testcase.
Diff:
---
gcc/testsuite/gcc.dg/pr98793.c | 38 ++++++++++++++++++++++++++++++++++++++
gcc/tree.c | 6 +++---
2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/pr98793.c b/gcc/testsuite/gcc.dg/pr98793.c
new file mode 100644
index 00000000000..bb1ae9cc7b1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr98793.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-psabi" } */
+
+typedef unsigned char u8;
+typedef unsigned char __attribute__((__vector_size__ (8))) v64u8;
+typedef unsigned char __attribute__((__vector_size__ (64))) v512u8;
+typedef unsigned long long u64;
+
+u64 gx;
+v512u8 gu;
+v512u8 gv;
+
+v64u8 __attribute__((__noipa__)) foo0 (u8 ax, v512u8 au, u64 ay)
+{
+ u8 lx = ax && (u8) ay;
+ v512u8 lc = 7 <= au;
+ v512u8 ld = (u8) (ay && gx) == gu;
+ v512u8 le = (v512u8) ld + (v512u8) gv;
+ v512u8 lf = le + lc;
+ return (((union
+ {
+ v512u8 a;
+ v64u8 b[8];
+ }) lf).b[3]) + lx;
+}
+
+int
+main (void)
+{
+ v64u8 x = foo0 (2, (v512u8) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15
+ },
+ 2);
+ for (unsigned i = 0; i < sizeof (x); i++)
+ if (x[i] != (i ? 0 : 0xff))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/tree.c b/gcc/tree.c
index 061fe43aa31..87862be9273 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -14028,11 +14028,11 @@ vector_element_bits (const_tree type)
gcc_checking_assert (VECTOR_TYPE_P (type));
if (VECTOR_BOOLEAN_TYPE_P (type))
{
- if (VECTOR_MODE_P (TYPE_MODE (type)))
+ if (SCALAR_INT_MODE_P (TYPE_MODE (type)))
+ return 1;
+ else
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)));
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-22 14:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 14:24 [gcc r11-6859] middle-end/98793 - properly handle BLKmode vectors in vector_element_bits Richard Biener
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).