public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1996] Don't use vec_duplicate on vector in CTOR expansion
@ 2021-07-03 11:40 H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2021-07-03 11:40 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:52c3fdf3e4780f75297515d3c2a3dae9b36586ba
commit r12-1996-g52c3fdf3e4780f75297515d3c2a3dae9b36586ba
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Jul 2 10:03:48 2021 -0700
Don't use vec_duplicate on vector in CTOR expansion
Since vec_duplicate only works on scalar, don't use it on vector in
store constructor expansion.
gcc/
PR middle-end/101294
* expr.c (store_constructor): Don't use vec_duplicate on vector.
gcc/testsuite/
PR middle-end/101294
* gcc.dg/pr101294.c: New test.
Diff:
---
gcc/expr.c | 3 ++-
gcc/testsuite/gcc.dg/pr101294.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/gcc/expr.c b/gcc/expr.c
index 025033c9ecf..bd85bbfdd6f 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7078,7 +7078,8 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size,
&& eltmode == GET_MODE_INNER (mode)
&& ((icode = optab_handler (vec_duplicate_optab, mode))
!= CODE_FOR_nothing)
- && (elt = uniform_vector_p (exp)))
+ && (elt = uniform_vector_p (exp))
+ && !VECTOR_TYPE_P (TREE_TYPE (elt)))
{
class expand_operand ops[2];
create_output_operand (&ops[0], target, mode);
diff --git a/gcc/testsuite/gcc.dg/pr101294.c b/gcc/testsuite/gcc.dg/pr101294.c
new file mode 100644
index 00000000000..ca59b35f4be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101294.c
@@ -0,0 +1,15 @@
+/* PR middle-end/101294 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+/* { dg-additional-options "-mavx" { target avx } } */
+
+typedef __attribute__((__vector_size__ (sizeof (unsigned long long)))) unsigned long long U;
+typedef __attribute__((__vector_size__ (4 * sizeof (unsigned long long)))) unsigned long long V;
+
+extern U x;
+
+void
+foo (void)
+{
+ x = __builtin_shufflevector ((U){}, (V){}, 3);
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-03 11:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-03 11:40 [gcc r12-1996] Don't use vec_duplicate on vector in CTOR expansion H.J. Lu
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).