public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-7683] aarch64: Fix up aarch64_simd_clone_compute_vecsize_and_simdlen [PR99542]
@ 2021-03-16  9:35 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-03-16  9:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fcefc59befd396267b824c170b6a37acaf10874e

commit r11-7683-gfcefc59befd396267b824c170b6a37acaf10874e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 16 10:34:44 2021 +0100

    aarch64: Fix up aarch64_simd_clone_compute_vecsize_and_simdlen [PR99542]
    
    As the patch shows, there are several bugs in
    aarch64_simd_clone_compute_vecsize_and_simdlen.
    One is that unlike for function declarations that aren't definitions
    it completely ignores argument types.  Such decls don't have DECL_ARGUMENTS,
    but we can walk TYPE_ARG_TYPES instead, like the i386 backend does or like
    the simd cloning code in the middle end does too.
    
    Another problem is that it checks types of uniform arguments.  That is
    unnecessary, uniform arguments are passed the way it normally is, it is
    a scalar argument rather than vector, so there is no reason not to support
    uniform argument of different size, or long double, structure etc.
    
    2021-03-16  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/99542
            * config/aarch64/aarch64.c
            (aarch64_simd_clone_compute_vecsize_and_simdlen): If not a function
            definition, walk TYPE_ARG_TYPES list if non-NULL for argument types
            instead of DECL_ARGUMENTS.  Ignore types for uniform arguments.
    
            * gcc.dg/gomp/pr99542.c: New test.
            * gcc.dg/gomp/pr59669-2.c (bar): Don't expect a warning on aarch64.
            * gcc.dg/gomp/simd-clones-2.c (setArray): Likewise.
            * g++.dg/vect/simd-clone-7.cc (bar): Likewise.
            * g++.dg/gomp/declare-simd-1.C (f37): Expect a different warning
            on aarch64.
            * gcc.dg/declare-simd.c (fn2): Expect a new warning on aarch64.

Diff:
---
 gcc/config/aarch64/aarch64.c               | 12 +++++++++---
 gcc/testsuite/g++.dg/gomp/declare-simd-1.C |  2 +-
 gcc/testsuite/g++.dg/vect/simd-clone-7.cc  |  2 --
 gcc/testsuite/gcc.dg/declare-simd.c        |  1 +
 gcc/testsuite/gcc.dg/gomp/pr59669-2.c      |  1 -
 gcc/testsuite/gcc.dg/gomp/pr99542.c        | 17 +++++++++++++++++
 gcc/testsuite/gcc.dg/gomp/simd-clones-2.c  |  1 -
 7 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 8a868896a72..9b44d4d2148 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -23412,11 +23412,17 @@ aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
       return 0;
     }
 
-  for (t = DECL_ARGUMENTS (node->decl); t; t = DECL_CHAIN (t))
+  int i;
+  tree type_arg_types = TYPE_ARG_TYPES (TREE_TYPE (node->decl));
+  bool decl_arg_p = (node->definition || type_arg_types == NULL_TREE);
+
+  for (t = (decl_arg_p ? DECL_ARGUMENTS (node->decl) : type_arg_types), i = 0;
+       t && t != void_list_node; t = TREE_CHAIN (t), i++)
     {
-      arg_type = TREE_TYPE (t);
+      tree arg_type = decl_arg_p ? TREE_TYPE (t) : TREE_VALUE (t);
 
-      if (!currently_supported_simd_type (arg_type, base_type))
+      if (clonei->args[i].arg_type != SIMD_CLONE_ARG_TYPE_UNIFORM
+	  && !currently_supported_simd_type (arg_type, base_type))
 	{
 	  if (TYPE_SIZE (arg_type) != TYPE_SIZE (base_type))
 	    warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
diff --git a/gcc/testsuite/g++.dg/gomp/declare-simd-1.C b/gcc/testsuite/g++.dg/gomp/declare-simd-1.C
index dcffaec9696..00996b60e52 100644
--- a/gcc/testsuite/g++.dg/gomp/declare-simd-1.C
+++ b/gcc/testsuite/g++.dg/gomp/declare-simd-1.C
@@ -287,7 +287,7 @@ struct D
   int f37 (int a);
   int e;
 };
-// { dg-warning "GCC does not currently support simdlen 16 for type 'int'" "" { target aarch64*-*-* } .-3 }
+// { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-3 }
 
 void
 f38 (D &d)
diff --git a/gcc/testsuite/g++.dg/vect/simd-clone-7.cc b/gcc/testsuite/g++.dg/vect/simd-clone-7.cc
index 527bbd94d30..fd5751b30bb 100644
--- a/gcc/testsuite/g++.dg/vect/simd-clone-7.cc
+++ b/gcc/testsuite/g++.dg/vect/simd-clone-7.cc
@@ -8,5 +8,3 @@ bar (float x, float *y, int)
 {
   return y[0] + y[1] * x;
 }
-// { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target { { aarch64*-*-* } && lp64 } } .-4 }
-
diff --git a/gcc/testsuite/gcc.dg/declare-simd.c b/gcc/testsuite/gcc.dg/declare-simd.c
index 1c71b60c974..52796f6416e 100644
--- a/gcc/testsuite/gcc.dg/declare-simd.c
+++ b/gcc/testsuite/gcc.dg/declare-simd.c
@@ -3,6 +3,7 @@
 
 #pragma omp declare simd linear (p2, p3)
 extern void fn2 (float p1, float *p2, float *p3);
+/* { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-1 } */
 
 float *a, *b;
 void fn1 (float *p1)
diff --git a/gcc/testsuite/gcc.dg/gomp/pr59669-2.c b/gcc/testsuite/gcc.dg/gomp/pr59669-2.c
index 26a30f4e3fa..f6aad8998f1 100644
--- a/gcc/testsuite/gcc.dg/gomp/pr59669-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/pr59669-2.c
@@ -7,4 +7,3 @@ void
 bar (int *a)
 {
 }
-/* { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-3 } */
diff --git a/gcc/testsuite/gcc.dg/gomp/pr99542.c b/gcc/testsuite/gcc.dg/gomp/pr99542.c
new file mode 100644
index 00000000000..b67ff5a37a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr99542.c
@@ -0,0 +1,17 @@
+/* PR middle-end/89246 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O0 -fopenmp-simd" } */
+
+#pragma omp declare simd
+extern int foo (__int128 x);	/* { dg-warning "GCC does not currently support mixed size types for 'simd' function" "" { target aarch64*-*-* } } */
+/* { dg-warning "unsupported argument type '__int128' for simd" "" { target i?86-*-* x86_64-*-* } .-1 } */
+
+#pragma omp declare simd uniform (x)
+extern int baz (__int128 x);
+
+#pragma omp declare simd
+int
+bar (int x)
+{
+  return x + foo (0) + baz (0);
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c
index 844b80b2a8d..75554de9339 100644
--- a/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c
@@ -15,7 +15,6 @@ float setArray(float *a, float x, int k)
   return a[k];
 }
 
-/* { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-6 } */
 /* { dg-final { scan-tree-dump "_ZGVbN4ua32vl_setArray" "optimized" { target i?86-*-* x86_64-*-* } } } */
 /* { dg-final { scan-tree-dump "_ZGVbN4vvva32_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */
 /* { dg-final { scan-tree-dump "_ZGVbM4vl66u_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-16  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  9:35 [gcc r11-7683] aarch64: Fix up aarch64_simd_clone_compute_vecsize_and_simdlen [PR99542] Jakub Jelinek

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).