]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/116258 - do not lower PAREN_EXPR of vectors
authorRichard Biener <rguenther@suse.de>
Wed, 7 Aug 2024 11:54:53 +0000 (13:54 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 7 Aug 2024 12:44:32 +0000 (14:44 +0200)
The following avoids lowering of PAREN_EXPR of vectors as unsupported
to scalars.  Instead PAREN_EXPR is like a plain move or a VIEW_CONVERT.

PR tree-optimization/116258
* tree-vect-generic.cc (expand_vector_operations_1): Do not
lower PAREN_EXPR.

* gcc.target/i386/pr116258.c: New testcase.

gcc/testsuite/gcc.target/i386/pr116258.c [new file with mode: 0644]
gcc/tree-vect-generic.cc

diff --git a/gcc/testsuite/gcc.target/i386/pr116258.c b/gcc/testsuite/gcc.target/i386/pr116258.c
new file mode 100644 (file)
index 0000000..bd7d3a9
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+#define vect16 __attribute__((vector_size(16)))
+#define h(a) __builtin_assoc_barrier((a))
+
+ vect16 float  f( vect16 float  x, vect16 float vconstants0)
+{
+  vect16 float  t = (x * (vconstants0[0]));
+  return (x + h(t));
+}
+
+/* { dg-final { scan-assembler-times "shufps" 1 } } */
+/* { dg-final { scan-assembler-not "unpck" } } */
index 8336cbb8c73936140c198cbc07549fcd4c7e611c..4bcab71c16837d722786f1a8d0f00106b002bc26 100644 (file)
@@ -2206,10 +2206,15 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi,
        }
     }
 
+  /* Plain moves do not need lowering.  */
+  if (code == SSA_NAME
+      || code == VIEW_CONVERT_EXPR
+      || code == PAREN_EXPR)
+    return;
+
   if (CONVERT_EXPR_CODE_P (code)
       || code == FLOAT_EXPR
-      || code == FIX_TRUNC_EXPR
-      || code == VIEW_CONVERT_EXPR)
+      || code == FIX_TRUNC_EXPR)
     return;
 
   /* The signedness is determined from input argument.  */