]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/64421 (Incorrect vector function name generated for log)
authorJakub Jelinek <jakub@redhat.com>
Sun, 1 Feb 2015 17:34:50 +0000 (18:34 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Feb 2015 17:34:50 +0000 (18:34 +0100)
Backported from mainline
2015-01-26  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/64421
* omp-low.c (simd_clone_mangle): If DECL_ASSEMBLER_NAME starts
with asterisk, skip the first character.

* gcc.dg/vect/pr64421.c: New test.

From-SVN: r220325

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr64421.c [new file with mode: 0644]

index fb8617dd5116fc03fd3b4b3df3bbc5e88e349d58..13763900ee2c9e89abed5d522616cfd4103e4de1 100644 (file)
@@ -3,6 +3,10 @@
        Backported from mainline
        2015-01-26  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/64421
+       * omp-low.c (simd_clone_mangle): If DECL_ASSEMBLER_NAME starts
+       with asterisk, skip the first character.
+
        * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add
        OPTION_MASK_QUAD_MEMORY_ATOMIC.
 
index 6d9206c9530d4de146293750043db902aed7e76f..f0059be6b5dbb05365d994e519a4da8cd65fef3a 100644 (file)
@@ -11106,9 +11106,11 @@ simd_clone_mangle (struct cgraph_node *node,
     }
 
   pp_underscore (&pp);
-  pp_string (&pp,
-            IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)));
-  const char *str = pp_formatted_text (&pp);
+  const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl));
+  if (*str == '*')
+    ++str;
+  pp_string (&pp, str);
+  str = pp_formatted_text (&pp);
 
   /* If there already is a SIMD clone with the same mangled name, don't
      add another one.  This can happen e.g. for
index 594cf32692addeded8276116b772891846a76f9f..7e1df70e0972706ba2c4f3afbc27aaa85dcf1f00 100644 (file)
@@ -1,6 +1,11 @@
 2015-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2015-01-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/64421
+       * gcc.dg/vect/pr64421.c: New test.
+
        2015-01-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/63637
diff --git a/gcc/testsuite/gcc.dg/vect/pr64421.c b/gcc/testsuite/gcc.dg/vect/pr64421.c
new file mode 100644 (file)
index 0000000..7e48a8b
--- /dev/null
@@ -0,0 +1,36 @@
+/* PR middle-end/64421 */
+/* { dg-require-effective-target vect_simd_clones } */
+/* { dg-additional-options "-fopenmp-simd" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+#include "tree-vect.h"
+
+#pragma omp declare simd linear (y) notinbranch
+int foo (int x, int y) __asm ("bar");
+
+#pragma omp declare simd linear (y) notinbranch
+int
+foo (int x, int y)
+{
+  return x + y;
+}
+
+int a[1024] = { 1, 2 };
+
+int
+main ()
+{
+  int i;
+  check_vect ();
+  #pragma omp simd
+  for (i = 0; i < 1024; i++)
+    a[i] = foo (a[i], i);
+  if (a[0] != 1 || a[1] != 3)
+    abort ();
+  for (i = 2; i < 1024; i++)
+    if (a[i] != i)
+      abort ();
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */