* [PATCH] middle-end/104467 - fix vector extract simplification
@ 2022-02-10 9:50 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-02-10 9:50 UTC (permalink / raw)
To: gcc-patches
This fixes a bogus vector type used for a CTOR build as part of
vector extract simplification. The code failed to consider a
CTOR of vector elements.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
2022-02-10 Richard Biener <rguenther@suse.de>
PR middle-end/104467
* match.pd (vector extract simplification): Multiply the
number of CTOR elements with the number of element elements.
* gcc.dg/torture/pr104467.c: New testcase.
---
gcc/match.pd | 2 +-
gcc/testsuite/gcc.dg/torture/pr104467.c | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr104467.c
diff --git a/gcc/match.pd b/gcc/match.pd
index 4fe590983f3..d9d83591045 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -6943,7 +6943,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
TREE_TYPE (TREE_TYPE (ctor)))
? type
: build_vector_type (TREE_TYPE (TREE_TYPE (ctor)),
- count));
+ count * k));
res = (constant_p ? build_vector_from_ctor (evtype, vals)
: build_constructor (evtype, vals));
}
diff --git a/gcc/testsuite/gcc.dg/torture/pr104467.c b/gcc/testsuite/gcc.dg/torture/pr104467.c
new file mode 100644
index 00000000000..c3bfb60698a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr104467.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mavx" { target x86_64-*-* i?86-*-* } } */
+
+unsigned long __attribute__((__vector_size__ (8 * sizeof (long)))) u;
+signed long __attribute__((__vector_size__ (8 * sizeof (long)))) s;
+
+void
+foo (void)
+{
+ s &= u + (0, 0);
+}
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-10 9:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 9:50 [PATCH] middle-end/104467 - fix vector extract simplification 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).