Update 'gcc.dg/vect/vect-simd-clone-*.c' GCN 'dg-warning's (was: [PATCH] aarch64: enable mixed-types for aarch64 simdclones)
Hi! On 2023-10-16T16:03:26+0100, "Andre Vieira (lists)" wrote: > --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c > @@ -12,8 +12,13 @@ int array[N]; > > #pragma omp declare simd simdlen(4) notinbranch > #pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3) > +#ifdef __aarch64__ > +#pragma omp declare simd simdlen(2) notinbranch > +#pragma omp declare simd simdlen(2) notinbranch uniform(b) linear(c:3) > +#else > #pragma omp declare simd simdlen(8) notinbranch > #pragma omp declare simd simdlen(8) notinbranch uniform(b) linear(c:3) > +#endif > __attribute__((noinline)) int > foo (int a, int b, int c) > { These added lines run afoul with end-of-file GCN-specific DejaGnu directives: [...] /* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */ /* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */ That, indeed, also has been suboptimal, to use absolute lines numbers here. (..., and maybe, like aarch64 have now done, GCN also should suitably parameterize the 'simdlen', to resolve this altogether? Until then, to resolve regressions, I've pushed to master branch commit 7b15959f8e35b821ebfe832a36e5e712b708dae1 "Update 'gcc.dg/vect/vect-simd-clone-*.c' GCN 'dg-warning's", see attached. Grüße Thomas > --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c > @@ -12,8 +12,13 @@ int array[N] __attribute__((aligned (32))); > > #pragma omp declare simd simdlen(4) notinbranch aligned(a:16) uniform(a) > linear(b) > #pragma omp declare simd simdlen(4) notinbranch aligned(a:32) uniform(a) > linear(b) > +#ifdef __aarch64__ > +#pragma omp declare simd simdlen(2) notinbranch aligned(a:16) uniform(a) > linear(b) > +#pragma omp declare simd simdlen(2) notinbranch aligned(a:32) uniform(a) > linear(b) > +#else > #pragma omp declare simd simdlen(8) notinbranch aligned(a:16) uniform(a) > linear(b) > #pragma omp declare simd simdlen(8) notinbranch aligned(a:32) uniform(a) > linear(b) > +#endif > __attribute__((noinline)) void > foo (int *a, int b, int c) > { > --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c > @@ -12,7 +12,11 @@ float d[N]; > int e[N]; > unsigned short f[N]; > > +#ifdef __aarch64__ > +#pragma omp declare simd simdlen(4) notinbranch uniform(b) > +#else > #pragma omp declare simd simdlen(8) notinbranch uniform(b) > +#endif > __attribute__((noinline)) float > foo (float a, float b, float c) > { > --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c > @@ -10,7 +10,11 @@ > > int d[N], e[N]; > > +#ifdef __aarch64__ > +#pragma omp declare simd simdlen(2) notinbranch uniform(b) linear(c:3) > +#else > #pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3) > +#endif > __attribute__((noinline)) long long int > foo (int a, int b, int c) > { > --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c > @@ -12,14 +12,22 @@ int a[N], b[N]; > long int c[N]; > unsigned char d[N]; > > +#ifdef __aarch64__ > +#pragma omp declare simd simdlen(2) notinbranch > +#else > #pragma omp declare simd simdlen(8) notinbranch > +#endif > __attribute__((noinline)) int > foo (long int a, int b, int c) > { >return a + b + c; > } > > +#ifdef __aarch64__ > +#pragma omp declare simd simdlen(2) notinbranch > +#else > #pragma omp declare simd simdlen(8) notinbranch > +#endif > __attribute__((noinline)) long int > bar (int a, int b, long int c) > { - Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 >From 7b15959f8e35b821ebfe832a36e5e712b708dae1 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 14 Dec 2023 10:47:35 +0100 Subject: [PATCH] Update 'gcc.dg/vect/vect-simd-clone-*.c' GCN 'dg-warning's Recent commit f5fc001a84a7dbb942a6252b3162dd38b4aae311 "aarch64: enable mixed-types for aarch64 simdclones" added lines to those test cases and GCN-specific line numbers got out of sync, which had originally gotten added in commit b73c49f6f88dd7f7569f9a72c8ceb04598d4c15c "amdgcn: OpenMP SIMD routine support". gcc/testsuite/ * gcc.dg/vect/vect-simd-clone-1.c: Update GCN 'dg-warning's. * gcc.dg/vect/vect-simd-clone-2.c: Likewise. * gcc.dg/vect/vect-simd-clone-3.c: Likewise. * gcc.dg/vect/vect-simd-clone-4.c: Likewise. * gcc.dg/vect/vect-simd-clone-5.c: Likewise. * gcc.dg/vect/vect-simd-clone-8.c: Likewise. --- gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c | 5 ++--- gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c | 5 ++--- gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c | 3 +--
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
On 11/12/2023 21:42, Thomas Schwinge wrote: Hi Andre! On 2023-10-16T16:03:26+0100, "Andre Vieira (lists)" wrote: Just a minor update to the patch, I had missed the libgomp testsuite, so had to make some adjustments there too. Unfortunately, there appear to be a number of DejaGnu directive errors in your test case changes -- do you not see those in your testing? I hadn't seen those... I wonder whether they don't show up if you do dg-cmp-results with just one -v, I have binned the build, but I'll rerun it and double check, may need to use '-v -v' instead. Thanks for letting me know. ..., and the following change also doesn't look quite right: --- a/libgomp/testsuite/libgomp.fortran/declare-simd-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/declare-simd-1.f90 @@ -1,5 +1,5 @@ ! { dg-do run { target vect_simd_clones } } -! { dg-options "-fno-inline" } +! { dg-options "-fno-inline -cpp -D__aarch64__" } Yeah, that needs a target selector. Thanks!
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
On Wed, Jul 26, 2023 at 7:45 AM Andre Vieira (lists) via Gcc-patches wrote: > > Hi, > > This patch enables the use of mixed-types for simd clones for AArch64 > and adds aarch64 as a target_vect_simd_clones. > > Bootstrapped and regression tested on aarch64-unknown-linux-gnu > > gcc/ChangeLog: > > * config/aarch64/aarch64.cc (currently_supported_simd_type): > Remove. > (aarch64_simd_clone_compute_vecsize_and_simdlen): Use NFS type > to determine simdlen. > > gcc/testsuite/ChangeLog: > > * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. > * c-c++-common/gomp/declare-variant-14.c: Add aarch64 checks > and remove warning check. > * g++.dg/gomp/attrs-10.C: Likewise. > * g++.dg/gomp/declare-simd-1.C: Likewise. > * g++.dg/gomp/declare-simd-3.C: Likewise. > * g++.dg/gomp/declare-simd-4.C: Likewise. > * gcc.dg/gomp/declare-simd-3.c: Likewise. > * gcc.dg/gomp/simd-clones-2.c: Likewise. > * gfortran.dg/gomp/declare-variant-14.f90: Likewise. > * c-c++-common/gomp/pr60823-1.c: Remove warning check. > * c-c++-common/gomp/pr60823-3.c: Likewise. > * g++.dg/gomp/declare-simd-7.C: Likewise. > * g++.dg/gomp/declare-simd-8.C: Likewise. > * g++.dg/gomp/pr88182.C: Likewise. > * gcc.dg/declare-simd.c: Likewise. > * gcc.dg/gomp/declare-simd-1.c: Likewise. > * gcc.dg/gomp/pr87895-1.c: Likewise. > * gfortran.dg/gomp/declare-simd-2.f90: Likewise. > * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. > * gfortran.dg/gomp/pr79154-1.f90: Likewise. > * gfortran.dg/gomp/pr83977.f90: Likewise. > * gcc.dg/gomp/pr87887-1.c: Add warning test. > * gcc.dg/gomp/pr89246-1.c: Likewise. > * gcc.dg/gomp/pr99542.c: Update warning test. A few testcases has errors now: ERROR: gcc.dg/gomp/pr87887-1.c: syntax error in target selector ".-4" for " dg-warning 13 "unsupported return type ‘struct S’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " ERROR: gcc.dg/gomp/pr87887-1.c: syntax error in target selector ".-4" for " dg-warning 13 "unsupported return type ‘struct S’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " ERROR: gcc.dg/gomp/pr89246-1.c: syntax error in target selector ".-4" for " dg-warning 11 "unsupported argument type ‘__int128’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " ERROR: gcc.dg/gomp/pr89246-1.c: syntax error in target selector ".-4" for " dg-warning 11 "unsupported argument type ‘__int128’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " ERROR: gcc.dg/gomp/simd-clones-2.c: unmatched open quote in list for " dg-final 19 { scan-tree-dump "_ZGVnN2ua32vl_setArray" "optimized { target aarch64*-*-* } } " ERROR: gcc.dg/gomp/simd-clones-2.c: unmatched open quote in list for " dg-final 19 { scan-tree-dump "_ZGVnN2ua32vl_setArray" "optimized { target aarch64*-*-* } } " Looks like you forgot the comment operand to dg-warning. And you forgot the end quote after `"optimized` in those scan-tree-dump. My suggestion is to use contrib/test_summary next time to errors like this. Thanks, Andrew Pinski Thanks, Andrew Pinski
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
Hi Andre! On 2023-10-16T16:03:26+0100, "Andre Vieira (lists)" wrote: > Just a minor update to the patch, I had missed the libgomp testsuite, so > had to make some adjustments there too. Unfortunately, there appear to be a number of DejaGnu directive errors in your test case changes -- do you not see those in your testing? -PASS: gcc.dg/gomp/pr87887-1.c (test for excess errors) +ERROR: gcc.dg/gomp/pr87887-1.c: syntax error in target selector ".-4" for " dg-warning 13 "unsupported return type ‘struct S’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " +ERROR: gcc.dg/gomp/pr87887-1.c: syntax error in target selector ".-4" for " dg-warning 13 "unsupported return type ‘struct S’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " -UNSUPPORTED: gcc.dg/gomp/pr89246-1.c +ERROR: gcc.dg/gomp/pr89246-1.c: syntax error in target selector ".-4" for " dg-warning 11 "unsupported argument type ‘__int128’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " +ERROR: gcc.dg/gomp/pr89246-1.c: syntax error in target selector ".-4" for " dg-warning 11 "unsupported argument type ‘__int128’ for ‘simd’ functions" { target aarch64*-*-* } .-4 " -PASS: gcc.dg/gomp/simd-clones-2.c (test for excess errors) -PASS: gcc.dg/gomp/simd-clones-2.c scan-tree-dump optimized "(?n)^__attribute__\\(\\(omp declare simd \\(notinbranch aligned\\(2:32\\)\\), omp declare simd \\(inbranch uniform\\(2\\) linear\\(1:66\\)\\)\\)\\)$" -[...] -PASS: gcc.dg/gomp/simd-clones-2.c scan-tree-dump optimized "_ZGVeN16vvva32_addit" +ERROR: gcc.dg/gomp/simd-clones-2.c: unmatched open quote in list for " dg-final 19 { scan-tree-dump "_ZGVnN2ua32vl_setArray" "optimized { target aarch64*-*-* } } " +ERROR: gcc.dg/gomp/simd-clones-2.c: unmatched open quote in list for " dg-final 19 { scan-tree-dump "_ZGVnN2ua32vl_setArray" "optimized { target aarch64*-*-* } } " -PASS: libgomp.c/declare-variant-1.c (test for excess errors) -PASS: libgomp.c/declare-variant-1.c scan-ltrans-tree-dump-not optimized "f04 \\(x" -PASS: libgomp.c/declare-variant-1.c scan-ltrans-tree-dump-times optimized "f01 \\(x" 4 -PASS: libgomp.c/declare-variant-1.c scan-ltrans-tree-dump-times optimized "f03 \\(x" 14 -PASS: libgomp.c/declare-variant-1.c scan-tree-dump-times gimple "f04 \\(x" 2 +ERROR: libgomp.c/declare-variant-1.c: unknown dg option: \} for "}" +ERROR: libgomp.c/declare-variant-1.c: unknown dg option: \} for "}" ..., and the following change also doesn't look quite right: > --- a/libgomp/testsuite/libgomp.fortran/declare-simd-1.f90 > +++ b/libgomp/testsuite/libgomp.fortran/declare-simd-1.f90 > @@ -1,5 +1,5 @@ > ! { dg-do run { target vect_simd_clones } } > -! { dg-options "-fno-inline" } > +! { dg-options "-fno-inline -cpp -D__aarch64__" } Grüße Thomas > gcc/ChangeLog: > > * config/aarch64/aarch64.cc (lane_size): New function. > (aarch64_simd_clone_compute_vecsize_and_simdlen): Determine > simdlen according to NDS rule > and reject combination of simdlen and types that lead to > vectors larger than 128bits. > > gcc/testsuite/ChangeLog: > > * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. > * c-c++-common/gomp/declare-variant-14.c: Adapt test for aarch64. > * c-c++-common/gomp/pr60823-1.c: Likewise. > * c-c++-common/gomp/pr60823-2.c: Likewise. > * c-c++-common/gomp/pr60823-3.c: Likewise. > * g++.dg/gomp/attrs-10.C: Likewise. > * g++.dg/gomp/declare-simd-1.C: Likewise. > * g++.dg/gomp/declare-simd-3.C: Likewise. > * g++.dg/gomp/declare-simd-4.C: Likewise. > * g++.dg/gomp/declare-simd-7.C: Likewise. > * g++.dg/gomp/declare-simd-8.C: Likewise. > * g++.dg/gomp/pr88182.C: Likewise. > * gcc.dg/declare-simd.c: Likewise. > * gcc.dg/gomp/declare-simd-1.c: Likewise. > * gcc.dg/gomp/declare-simd-3.c: Likewise. > * gcc.dg/gomp/pr87887-1.c: Likewise. > * gcc.dg/gomp/pr87895-1.c: Likewise. > * gcc.dg/gomp/pr89246-1.c: Likewise. > * gcc.dg/gomp/pr99542.c: Likewise. > * gcc.dg/gomp/simd-clones-2.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-1.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-2.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-4.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-5.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-8.c: Likewise. > * gfortran.dg/gomp/declare-simd-2.f90: Likewise. > * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. > * gfortran.dg/gomp/declare-variant-14.f90: Likewise. > * gfortran.dg/gomp/pr79154-1.f90: Likewise. > * gfortran.dg/gomp/pr83977.f90: Likewise. > > libgomp/testsuite/ChangeLog: > > * libgomp.c/declare-variant-1.c: Adapt test for aarch64. > * libgomp.fortran/declare-simd-1.f90: Likewise. >
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
Sorry for the very slow review on this. It LGTM apart from some minor comments below: "Andre Vieira (lists)" writes: > Hey, > > Just a minor update to the patch, I had missed the libgomp testsuite, so > had to make some adjustments there too. > > gcc/ChangeLog: > > * config/aarch64/aarch64.cc (lane_size): New function. > (aarch64_simd_clone_compute_vecsize_and_simdlen): Determine > simdlen according to NDS rule > and reject combination of simdlen and types that lead to > vectors larger than 128bits. > > gcc/testsuite/ChangeLog: > > * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. > * c-c++-common/gomp/declare-variant-14.c: Adapt test for aarch64. > * c-c++-common/gomp/pr60823-1.c: Likewise. > * c-c++-common/gomp/pr60823-2.c: Likewise. > * c-c++-common/gomp/pr60823-3.c: Likewise. > * g++.dg/gomp/attrs-10.C: Likewise. > * g++.dg/gomp/declare-simd-1.C: Likewise. > * g++.dg/gomp/declare-simd-3.C: Likewise. > * g++.dg/gomp/declare-simd-4.C: Likewise. > * g++.dg/gomp/declare-simd-7.C: Likewise. > * g++.dg/gomp/declare-simd-8.C: Likewise. > * g++.dg/gomp/pr88182.C: Likewise. > * gcc.dg/declare-simd.c: Likewise. > * gcc.dg/gomp/declare-simd-1.c: Likewise. > * gcc.dg/gomp/declare-simd-3.c: Likewise. > * gcc.dg/gomp/pr87887-1.c: Likewise. > * gcc.dg/gomp/pr87895-1.c: Likewise. > * gcc.dg/gomp/pr89246-1.c: Likewise. > * gcc.dg/gomp/pr99542.c: Likewise. > * gcc.dg/gomp/simd-clones-2.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-1.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-2.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-4.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-5.c: Likewise. > * gcc.dg/gcc.dg/vect/vect-simd-clone-8.c: Likewise. > * gfortran.dg/gomp/declare-simd-2.f90: Likewise. > * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. > * gfortran.dg/gomp/declare-variant-14.f90: Likewise. > * gfortran.dg/gomp/pr79154-1.f90: Likewise. > * gfortran.dg/gomp/pr83977.f90: Likewise. > > libgomp/testsuite/ChangeLog: > > * libgomp.c/declare-variant-1.c: Adapt test for aarch64. > * libgomp.fortran/declare-simd-1.f90: Likewise. > > diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc > index > 9fbfc548a891f5d11940c6fd3c49a14bfbdec886..37507f091c2a6154fa944c3a9fad6a655ab5d5a1 > 100644 > --- a/gcc/config/aarch64/aarch64.cc > +++ b/gcc/config/aarch64/aarch64.cc > @@ -27414,33 +27414,62 @@ supported_simd_type (tree t) >return false; > } > > -/* Return true for types that currently are supported as SIMD return > - or argument types. */ > +/* Determine the lane size for the clone argument/return type. This follows > + the LS(P) rule in the VFABIA64. */ > > -static bool > -currently_supported_simd_type (tree t, tree b) > +static unsigned > +lane_size (cgraph_simd_clone_arg_type clone_arg_type, tree type) > { > - if (COMPLEX_FLOAT_TYPE_P (t)) > -return false; > + gcc_assert (clone_arg_type != SIMD_CLONE_ARG_TYPE_MASK); > > - if (TYPE_SIZE (t) != TYPE_SIZE (b)) > -return false; > + /* For non map-to-vector types that are pointers we use the element type it > + points to. */ > + if (POINTER_TYPE_P (type)) > +switch (clone_arg_type) > + { > + default: > + break; > + case SIMD_CLONE_ARG_TYPE_UNIFORM: > + case SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP: > + case SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP: > + type = TREE_TYPE (type); > + break; > + } > > - return supported_simd_type (t); > + /* For types (or types pointers of non map-to-vector types point to) that > are > + integers or floating point, we use their size if they are 1, 2, 4 or 8. > + */ > + if (INTEGRAL_TYPE_P (type) > + || SCALAR_FLOAT_TYPE_P (type)) > + switch (TYPE_PRECISION (type) / BITS_PER_UNIT) > + { > + default: > + break; > + case 1: > + case 2: > + case 4: > + case 8: > + return TYPE_PRECISION (type); > + } The formatting looks a bit off here. The switch should be indented by 4 columns and the { by 6. > + /* For any other we use the size of uintptr_t. For map-to-vector types > that > + are pointers, using the size of uintptr_t is the same as using the size > of > + their type, seeing all pointers are the same size as uintptr_t. */ > + return POINTER_SIZE; > } > > + > /* Implement TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN. */ > > static int > aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, > struct cgraph_simd_clone *clonei, > - tree base_type, int num, > - bool
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
Hey, Just a minor update to the patch, I had missed the libgomp testsuite, so had to make some adjustments there too. gcc/ChangeLog: * config/aarch64/aarch64.cc (lane_size): New function. (aarch64_simd_clone_compute_vecsize_and_simdlen): Determine simdlen according to NDS rule and reject combination of simdlen and types that lead to vectors larger than 128bits. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. * c-c++-common/gomp/declare-variant-14.c: Adapt test for aarch64. * c-c++-common/gomp/pr60823-1.c: Likewise. * c-c++-common/gomp/pr60823-2.c: Likewise. * c-c++-common/gomp/pr60823-3.c: Likewise. * g++.dg/gomp/attrs-10.C: Likewise. * g++.dg/gomp/declare-simd-1.C: Likewise. * g++.dg/gomp/declare-simd-3.C: Likewise. * g++.dg/gomp/declare-simd-4.C: Likewise. * g++.dg/gomp/declare-simd-7.C: Likewise. * g++.dg/gomp/declare-simd-8.C: Likewise. * g++.dg/gomp/pr88182.C: Likewise. * gcc.dg/declare-simd.c: Likewise. * gcc.dg/gomp/declare-simd-1.c: Likewise. * gcc.dg/gomp/declare-simd-3.c: Likewise. * gcc.dg/gomp/pr87887-1.c: Likewise. * gcc.dg/gomp/pr87895-1.c: Likewise. * gcc.dg/gomp/pr89246-1.c: Likewise. * gcc.dg/gomp/pr99542.c: Likewise. * gcc.dg/gomp/simd-clones-2.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-1.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-2.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-4.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-5.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-8.c: Likewise. * gfortran.dg/gomp/declare-simd-2.f90: Likewise. * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. * gfortran.dg/gomp/declare-variant-14.f90: Likewise. * gfortran.dg/gomp/pr79154-1.f90: Likewise. * gfortran.dg/gomp/pr83977.f90: Likewise. libgomp/testsuite/ChangeLog: * libgomp.c/declare-variant-1.c: Adapt test for aarch64. * libgomp.fortran/declare-simd-1.f90: Likewise.diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 9fbfc548a891f5d11940c6fd3c49a14bfbdec886..37507f091c2a6154fa944c3a9fad6a655ab5d5a1 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -27414,33 +27414,62 @@ supported_simd_type (tree t) return false; } -/* Return true for types that currently are supported as SIMD return - or argument types. */ +/* Determine the lane size for the clone argument/return type. This follows + the LS(P) rule in the VFABIA64. */ -static bool -currently_supported_simd_type (tree t, tree b) +static unsigned +lane_size (cgraph_simd_clone_arg_type clone_arg_type, tree type) { - if (COMPLEX_FLOAT_TYPE_P (t)) -return false; + gcc_assert (clone_arg_type != SIMD_CLONE_ARG_TYPE_MASK); - if (TYPE_SIZE (t) != TYPE_SIZE (b)) -return false; + /* For non map-to-vector types that are pointers we use the element type it + points to. */ + if (POINTER_TYPE_P (type)) +switch (clone_arg_type) + { + default: + break; + case SIMD_CLONE_ARG_TYPE_UNIFORM: + case SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP: + case SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP: + type = TREE_TYPE (type); + break; + } - return supported_simd_type (t); + /* For types (or types pointers of non map-to-vector types point to) that are + integers or floating point, we use their size if they are 1, 2, 4 or 8. + */ + if (INTEGRAL_TYPE_P (type) + || SCALAR_FLOAT_TYPE_P (type)) + switch (TYPE_PRECISION (type) / BITS_PER_UNIT) + { + default: + break; + case 1: + case 2: + case 4: + case 8: + return TYPE_PRECISION (type); + } + /* For any other we use the size of uintptr_t. For map-to-vector types that + are pointers, using the size of uintptr_t is the same as using the size of + their type, seeing all pointers are the same size as uintptr_t. */ + return POINTER_SIZE; } + /* Implement TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN. */ static int aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, struct cgraph_simd_clone *clonei, - tree base_type, int num, - bool explicit_p) + tree base_type ATTRIBUTE_UNUSED, + int num, bool explicit_p) { tree t, ret_type; - unsigned int elt_bits, count; + unsigned int nds_elt_bits; + int count; unsigned HOST_WIDE_INT const_simdlen; - poly_uint64 vec_bits; if (!TARGET_SIMD) return 0; @@ -27460,80 +27489,135 @@ aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, }
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
Hi, This patch enables the use of mixed-types for simd clones for AArch64, adds aarch64 as a target_vect_simd_clones and corrects the way the simdlen is chosen for non-specified simdlen clauses according to the 'Vector Function Application Binary Interface Specification for AArch64'. Additionally this patch also restricts combinations of simdlen and return/argument types that map to vectors larger than 128 bits as we currently do not have a way to represent these types in a way that is consistent internally and externally. As I was writing this patch I was also contemplating a refactor of the compute_vecsize_and_simdlen targethook. The current way it works where it is called once to get the 'count' and then count times for each of the respective simdlens, this leads to the need to write this function in an overly complex way. I was thinking it would be nice to return either a vector of simdlens or perhaps a vector of some 'class' that can be extended per target. I was thinking something along the lines of: class clone_config { poly_uint64 simdlen; bool inbranch; char vecsize_mangle; poly_uint64 vecsize_int; poly_uint64 vecsize_float; }; auto_vec clone_configs = targetm.simd_clone.compute_vecsizse_and_simdlen (node, clone_info, base_type, explicit_p); for (auto config : clone_configs) { clone = simd_clone_struct_alloc (clone_info->nargs + ((i & 1) != 0)); simd_clone_struct_copy (clone, clone_info); /* Undo changes targetm.simd_clone.compute_vecsize_and_simdlen and simd_clone_adjust_argument_types did to the first clone's info. Andre: Not sure we'd still need this here...*/ clone->nargs -= clone_info->inbranch; clone->simdlen = orig_simdlen; targetm.simd_clone.config_clone (node, clone, config); <--- new } I didn't want to block this patch on that, so I've left it for now, @Jakub: what are your thoughts on this? Bootstrapped and regression tested on aarch64-unknown-linux-gnu. gcc/ChangeLog: * config/aarch64/aarch64.cc (lane_size): New function. (aarch64_simd_clone_compute_vecsize_and_simdlen): Determine simdlen according to NDS rule and reject combination of simdlen and types that lead to vectors larger than 128bits. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. * c-c++-common/gomp/declare-variant-14.c: Adapt test for aarch64. * c-c++-common/gomp/pr60823-1.c: Likewise. * c-c++-common/gomp/pr60823-2.c: Likewise. * c-c++-common/gomp/pr60823-3.c: Likewise. * g++.dg/gomp/attrs-10.C: Likewise. * g++.dg/gomp/declare-simd-1.C: Likewise. * g++.dg/gomp/declare-simd-3.C: Likewise. * g++.dg/gomp/declare-simd-4.C: Likewise. * g++.dg/gomp/declare-simd-7.C: Likewise. * g++.dg/gomp/declare-simd-8.C: Likewise. * g++.dg/gomp/pr88182.C: Likewise. * gcc.dg/declare-simd.c: Likewise. * gcc.dg/gomp/declare-simd-1.c: Likewise. * gcc.dg/gomp/declare-simd-3.c: Likewise. * gcc.dg/gomp/pr87887-1.c: Likewise. * gcc.dg/gomp/pr87895-1.c: Likewise. * gcc.dg/gomp/pr89246-1.c: Likewise. * gcc.dg/gomp/pr99542.c: Likewise. * gcc.dg/gomp/simd-clones-2.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-1.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-2.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-4.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-5.c: Likewise. * gcc.dg/gcc.dg/vect/vect-simd-clone-8.c: Likewise. * gfortran.dg/gomp/declare-simd-2.f90: Likewise. * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. * gfortran.dg/gomp/declare-variant-14.f90: Likewise. * gfortran.dg/gomp/pr79154-1.f90: Likewise. * gfortran.dg/gomp/pr83977.f90: Likewise.diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 7cd230c4602a15980016bdc92e80579be0c07094..5fb4c863d875871d6de865e72ce360506a3694d2 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -27274,31 +27274,61 @@ supported_simd_type (tree t) return false; } -/* Return true for types that currently are supported as SIMD return - or argument types. */ +/* Determine the lane size for the clone argument/return type. This follows + the LS(P) rule in the VFABIA64. */ -static bool -currently_supported_simd_type (tree t, tree b) +static unsigned +lane_size (cgraph_simd_clone_arg_type clone_arg_type, tree type) { - if (COMPLEX_FLOAT_TYPE_P (t)) -return false; + gcc_assert (clone_arg_type != SIMD_CLONE_ARG_TYPE_MASK); - if (TYPE_SIZE (t) != TYPE_SIZE (b)) -return false; + /* For non map-to-vector types that are pointers we use the element type it + points to. */ + if (POINTER_TYPE_P (type)) +switch (clone_arg_type) + { + default: + break;
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
Jakub Jelinek writes: > On Wed, Aug 09, 2023 at 06:27:20PM +0100, Richard Sandiford wrote: >> Jakub Jelinek writes: >> > On Wed, Aug 09, 2023 at 05:55:28PM +0100, Richard Sandiford wrote: >> >> Jakub: do you remember what the reason was? I don't mind dropping >> >> "function", but it feels weird to drop the quotes around "simd". >> >> Seems like, if we do that, there'll one day be a patch to add >> >> them back. :) >> > >> > Because in OpenMP their are % functions, not % >> > %functions, but we also have the %/% attribute as >> > extension. >> >> Yeah, I can understand dropping the "function" bit. But why >> s/unsupported ... for %/unsupported ... for simd/? >> Even if it's only a partial syntax quote, it is still a syntax quote. > > % in OpenMP is something very different though, so I think it is > better to use it as a generic term which covers the different syntax cases. OK, I won't press it further. Richard
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
On Wed, Aug 09, 2023 at 06:27:20PM +0100, Richard Sandiford wrote: > Jakub Jelinek writes: > > On Wed, Aug 09, 2023 at 05:55:28PM +0100, Richard Sandiford wrote: > >> Jakub: do you remember what the reason was? I don't mind dropping > >> "function", but it feels weird to drop the quotes around "simd". > >> Seems like, if we do that, there'll one day be a patch to add > >> them back. :) > > > > Because in OpenMP their are % functions, not % > > %functions, but we also have the %/% attribute as > > extension. > > Yeah, I can understand dropping the "function" bit. But why > s/unsupported ... for %/unsupported ... for simd/? > Even if it's only a partial syntax quote, it is still a syntax quote. % in OpenMP is something very different though, so I think it is better to use it as a generic term which covers the different syntax cases. Jakub
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
Jakub Jelinek writes: > On Wed, Aug 09, 2023 at 05:55:28PM +0100, Richard Sandiford wrote: >> Jakub: do you remember what the reason was? I don't mind dropping >> "function", but it feels weird to drop the quotes around "simd". >> Seems like, if we do that, there'll one day be a patch to add >> them back. :) > > Because in OpenMP their are % functions, not % > %functions, but we also have the %/% attribute as > extension. Yeah, I can understand dropping the "function" bit. But why s/unsupported ... for %/unsupported ... for simd/? Even if it's only a partial syntax quote, it is still a syntax quote. Thanks, Richard
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
On Wed, Aug 09, 2023 at 05:55:28PM +0100, Richard Sandiford wrote: > Jakub: do you remember what the reason was? I don't mind dropping > "function", but it feels weird to drop the quotes around "simd". > Seems like, if we do that, there'll one day be a patch to add > them back. :) Because in OpenMP their are % functions, not % %functions, but we also have the %/% attribute as extension. Jakub
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
On 09/08/2023 17:55, Richard Sandiford wrote: "Andre Vieira (lists)" writes: On 08/08/2023 11:51, Richard Sandiford wrote: "Andre Vieira (lists)" writes: warning_at (DECL_SOURCE_LOCATION (node->decl), 0, - "unsupported return type %qT for % functions", + "unsupported return type %qT for simd", ret_type); What's the reason for s/% functions/simd/, in particular for dropping the quotes around simd? It's to align with i386's error message, this helps with testing as then I can avoid having different tests for the same error. I asked Jakub which one he preferred, and he gave me an explanation why the i386's one was preferable, ... but I didn't write it down unfortunately. Jakub: do you remember what the reason was? I don't mind dropping "function", but it feels weird to drop the quotes around "simd". Seems like, if we do that, there'll one day be a patch to add them back. :) After some IRC scrolling, unfortunately my client doesn't have a fancy search :( avieira> Andre Vieira jakub: which one do you prefer? 1:59 PM "unsupported argument type %qT for simd" (i386) 1:59 PM "unsupported argument type %qT for % functions", (aarch64) 1:59 PM Gonna change one to be the same as the other ... 2:04 PM → gaius joined ⇐ lh_ideapad, egallager and jwakely_ quit 2:36 PM I'd just go with for simd; % functions isn't an established term, it would be either % functions, but we have also simd attribute...
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
"Andre Vieira (lists)" writes: > Here is my new version, see inline response to your comments. > > New cover letter: > > This patch enables the use of mixed-types for simd clones for AArch64, > adds aarch64 as a target_vect_simd_clones and corrects the way the > simdlen is chosen for non-specified simdlen clauses according to the > 'Vector Function Application Binary Interface Specification for AArch64'. > > gcc/ChangeLog: > > * config/aarch64/aarch64.cc (currently_supported_simd_type): > Remove. > (aarch64_simd_clone_compute_vecsize_and_simdlen): Determine > simdlen according to NDS rule. > (lane_size): New function. > > gcc/testsuite/ChangeLog: > > * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. > * c-c++-common/gomp/declare-variant-14.c: Add aarch64 checks > and remove warning check. > * g++.dg/gomp/attrs-10.C: Likewise. > * g++.dg/gomp/declare-simd-1.C: Likewise. > * g++.dg/gomp/declare-simd-3.C: Likewise. > * g++.dg/gomp/declare-simd-4.C: Likewise. > * gcc.dg/gomp/declare-simd-3.c: Likewise. > * gcc.dg/gomp/simd-clones-2.c: Likewise. > * gfortran.dg/gomp/declare-variant-14.f90: Likewise. > * c-c++-common/gomp/pr60823-1.c: Remove warning check. > * c-c++-common/gomp/pr60823-3.c: Likewise. > * g++.dg/gomp/declare-simd-7.C: Likewise. > * g++.dg/gomp/declare-simd-8.C: Likewise. > * g++.dg/gomp/pr88182.C: Likewise. > * gcc.dg/declare-simd.c: Likewise. > * gcc.dg/gomp/declare-simd-1.c: Likewise. > * gcc.dg/gomp/pr87895-1.c: Likewise. > * gfortran.dg/gomp/declare-simd-2.f90: Likewise. > * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. > * gfortran.dg/gomp/pr79154-1.f90: Likewise. > * gfortran.dg/gomp/pr83977.f90: Likewise. > * gcc.dg/gomp/pr87887-1.c: Add warning test. > * gcc.dg/gomp/pr89246-1.c: Likewise. > * gcc.dg/gomp/pr99542.c: Update warning test. > > > > On 08/08/2023 11:51, Richard Sandiford wrote: >> "Andre Vieira (lists)" writes: > >>> warning_at (DECL_SOURCE_LOCATION (node->decl), 0, >>> - "unsupported return type %qT for % functions", >>> + "unsupported return type %qT for simd", >>> ret_type); >> >> What's the reason for s/% functions/simd/, in particular for >> dropping the quotes around simd? > > It's to align with i386's error message, this helps with testing as then > I can avoid having different tests for the same error. > > I asked Jakub which one he preferred, and he gave me an explanation why > the i386's one was preferable, ... but I didn't write it down unfortunately. Jakub: do you remember what the reason was? I don't mind dropping "function", but it feels weird to drop the quotes around "simd". Seems like, if we do that, there'll one day be a patch to add them back. :) Thanks, Richard
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
Here is my new version, see inline response to your comments. New cover letter: This patch enables the use of mixed-types for simd clones for AArch64, adds aarch64 as a target_vect_simd_clones and corrects the way the simdlen is chosen for non-specified simdlen clauses according to the 'Vector Function Application Binary Interface Specification for AArch64'. gcc/ChangeLog: * config/aarch64/aarch64.cc (currently_supported_simd_type): Remove. (aarch64_simd_clone_compute_vecsize_and_simdlen): Determine simdlen according to NDS rule. (lane_size): New function. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. * c-c++-common/gomp/declare-variant-14.c: Add aarch64 checks and remove warning check. * g++.dg/gomp/attrs-10.C: Likewise. * g++.dg/gomp/declare-simd-1.C: Likewise. * g++.dg/gomp/declare-simd-3.C: Likewise. * g++.dg/gomp/declare-simd-4.C: Likewise. * gcc.dg/gomp/declare-simd-3.c: Likewise. * gcc.dg/gomp/simd-clones-2.c: Likewise. * gfortran.dg/gomp/declare-variant-14.f90: Likewise. * c-c++-common/gomp/pr60823-1.c: Remove warning check. * c-c++-common/gomp/pr60823-3.c: Likewise. * g++.dg/gomp/declare-simd-7.C: Likewise. * g++.dg/gomp/declare-simd-8.C: Likewise. * g++.dg/gomp/pr88182.C: Likewise. * gcc.dg/declare-simd.c: Likewise. * gcc.dg/gomp/declare-simd-1.c: Likewise. * gcc.dg/gomp/pr87895-1.c: Likewise. * gfortran.dg/gomp/declare-simd-2.f90: Likewise. * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. * gfortran.dg/gomp/pr79154-1.f90: Likewise. * gfortran.dg/gomp/pr83977.f90: Likewise. * gcc.dg/gomp/pr87887-1.c: Add warning test. * gcc.dg/gomp/pr89246-1.c: Likewise. * gcc.dg/gomp/pr99542.c: Update warning test. On 08/08/2023 11:51, Richard Sandiford wrote: "Andre Vieira (lists)" writes: warning_at (DECL_SOURCE_LOCATION (node->decl), 0, - "unsupported return type %qT for % functions", + "unsupported return type %qT for simd", ret_type); What's the reason for s/% functions/simd/, in particular for dropping the quotes around simd? It's to align with i386's error message, this helps with testing as then I can avoid having different tests for the same error. I asked Jakub which one he preferred, and he gave me an explanation why the i386's one was preferable, ... but I didn't write it down unfortunately. return 0; } + nfs_type = ret_type; Genuine question, but what does nfs stand for in this context? Was supposed to be nds... my bad. I don't think this implements the NDS calculation in the spec: The `Narrowest Data Size of f`, or ``NDS(f)``, as the minumum of the lane size ``LS(P)`` among all input parameters and return value of ``f``. ... We then define the `Lane Size of P`, or ``LS(P)``, as follows. 1. If ``MTV(P)`` is ``false`` and ``P`` is a pointer or reference to some type ``T`` for which ``PBV(T)`` is ``true``, ``LS(P) = sizeof(T)``. 2. If ``PBV(T(P))`` is ``true``, ``LS(P) = sizeof(P)``. 3. Otherwise ``LS(P) = sizeof(uintptr_t)``. AIUI, (1) means that we need to look at the targets of uniform and linear scalars[*] that have pointer type, so that e.g. a uniform uint8_t * pointer should cause NDS to be 1. [*] i.e. arguments that remain scalar in the vector prototype (2) means that other types of uniform and linear scalars do contribute. A uniform uint8_t should cause NDS to be 1. You are right, I misread the ABI description there. Thanks, Richarddiff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 7cd230c4602a15980016bdc92e80579be0c07094..458a4dbf76138e329eb99077780089a9b501c046 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -27274,28 +27274,57 @@ supported_simd_type (tree t) return false; } -/* Return true for types that currently are supported as SIMD return - or argument types. */ +/* Determine the lane size for the clone argument/return type. This follows + the LS(P) rule in the VFABIA64. */ -static bool -currently_supported_simd_type (tree t, tree b) +static unsigned +lane_size (cgraph_simd_clone_arg_type clone_arg_type, tree type) { - if (COMPLEX_FLOAT_TYPE_P (t)) -return false; + gcc_assert (clone_arg_type != SIMD_CLONE_ARG_TYPE_MASK); - if (TYPE_SIZE (t) != TYPE_SIZE (b)) -return false; + /* For non map-to-vector types that are pointers we use the element type it + points to. */ + if (POINTER_TYPE_P (type)) +switch (clone_arg_type) + { + default: + break; + case SIMD_CLONE_ARG_TYPE_UNIFORM: + case SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP: + case SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP: + type = TREE_TYPE
Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones
"Andre Vieira (lists)" writes: > Hi, > > This patch enables the use of mixed-types for simd clones for AArch64 > and adds aarch64 as a target_vect_simd_clones. > > Bootstrapped and regression tested on aarch64-unknown-linux-gnu > > gcc/ChangeLog: > > * config/aarch64/aarch64.cc (currently_supported_simd_type): > Remove. > (aarch64_simd_clone_compute_vecsize_and_simdlen): Use NFS type > to determine simdlen. > > gcc/testsuite/ChangeLog: > > * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. > * c-c++-common/gomp/declare-variant-14.c: Add aarch64 checks > and remove warning check. > * g++.dg/gomp/attrs-10.C: Likewise. > * g++.dg/gomp/declare-simd-1.C: Likewise. > * g++.dg/gomp/declare-simd-3.C: Likewise. > * g++.dg/gomp/declare-simd-4.C: Likewise. > * gcc.dg/gomp/declare-simd-3.c: Likewise. > * gcc.dg/gomp/simd-clones-2.c: Likewise. > * gfortran.dg/gomp/declare-variant-14.f90: Likewise. > * c-c++-common/gomp/pr60823-1.c: Remove warning check. > * c-c++-common/gomp/pr60823-3.c: Likewise. > * g++.dg/gomp/declare-simd-7.C: Likewise. > * g++.dg/gomp/declare-simd-8.C: Likewise. > * g++.dg/gomp/pr88182.C: Likewise. > * gcc.dg/declare-simd.c: Likewise. > * gcc.dg/gomp/declare-simd-1.c: Likewise. > * gcc.dg/gomp/pr87895-1.c: Likewise. > * gfortran.dg/gomp/declare-simd-2.f90: Likewise. > * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. > * gfortran.dg/gomp/pr79154-1.f90: Likewise. > * gfortran.dg/gomp/pr83977.f90: Likewise. > * gcc.dg/gomp/pr87887-1.c: Add warning test. > * gcc.dg/gomp/pr89246-1.c: Likewise. > * gcc.dg/gomp/pr99542.c: Update warning test. > > diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc > index > 560e5431636ef46c41d56faa0c4e95be78f64b50..ac6350a44481628a947a0f20e034acf92cde63ec > 100644 > --- a/gcc/config/aarch64/aarch64.cc > +++ b/gcc/config/aarch64/aarch64.cc > @@ -27194,21 +27194,6 @@ supported_simd_type (tree t) >return false; > } > > -/* Return true for types that currently are supported as SIMD return > - or argument types. */ > - > -static bool > -currently_supported_simd_type (tree t, tree b) > -{ > - if (COMPLEX_FLOAT_TYPE_P (t)) > -return false; > - > - if (TYPE_SIZE (t) != TYPE_SIZE (b)) > -return false; > - > - return supported_simd_type (t); > -} > - > /* Implement TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN. */ > > static int > @@ -27217,7 +27202,7 @@ aarch64_simd_clone_compute_vecsize_and_simdlen > (struct cgraph_node *node, > tree base_type, int num, > bool explicit_p) > { > - tree t, ret_type; > + tree t, ret_type, nfs_type; >unsigned int elt_bits, count; >unsigned HOST_WIDE_INT const_simdlen; >poly_uint64 vec_bits; > @@ -27240,55 +27225,61 @@ aarch64_simd_clone_compute_vecsize_and_simdlen > (struct cgraph_node *node, > } > >ret_type = TREE_TYPE (TREE_TYPE (node->decl)); > + /* According to AArch64's Vector ABI the type that determines the simdlen > is > + the narrowest of types, so we ignore base_type for AArch64. */ >if (TREE_CODE (ret_type) != VOID_TYPE > - && !currently_supported_simd_type (ret_type, base_type)) > + && !supported_simd_type (ret_type)) > { >if (!explicit_p) > ; > - else if (TYPE_SIZE (ret_type) != TYPE_SIZE (base_type)) > - warning_at (DECL_SOURCE_LOCATION (node->decl), 0, > - "GCC does not currently support mixed size types " > - "for % functions"); > - else if (supported_simd_type (ret_type)) > + else if (COMPLEX_FLOAT_TYPE_P (ret_type)) > warning_at (DECL_SOURCE_LOCATION (node->decl), 0, > "GCC does not currently support return type %qT " > - "for % functions", ret_type); > + "for simd", ret_type); >else > warning_at (DECL_SOURCE_LOCATION (node->decl), 0, > - "unsupported return type %qT for % functions", > + "unsupported return type %qT for simd", > ret_type); What's the reason for s/% functions/simd/, in particular for dropping the quotes around simd? >return 0; > } > > + nfs_type = ret_type; Genuine question, but what does nfs stand for in this context? >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++) > { >tree arg_type = decl_arg_p ? TREE_TYPE (t) : TREE_VALUE (t); > - >if (clonei->args[i].arg_type != SIMD_CLONE_ARG_TYPE_UNIFORM > -
[PATCH] aarch64: enable mixed-types for aarch64 simdclones
Hi, This patch enables the use of mixed-types for simd clones for AArch64 and adds aarch64 as a target_vect_simd_clones. Bootstrapped and regression tested on aarch64-unknown-linux-gnu gcc/ChangeLog: * config/aarch64/aarch64.cc (currently_supported_simd_type): Remove. (aarch64_simd_clone_compute_vecsize_and_simdlen): Use NFS type to determine simdlen. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Add aarch64 targets to vect_simd_clones. * c-c++-common/gomp/declare-variant-14.c: Add aarch64 checks and remove warning check. * g++.dg/gomp/attrs-10.C: Likewise. * g++.dg/gomp/declare-simd-1.C: Likewise. * g++.dg/gomp/declare-simd-3.C: Likewise. * g++.dg/gomp/declare-simd-4.C: Likewise. * gcc.dg/gomp/declare-simd-3.c: Likewise. * gcc.dg/gomp/simd-clones-2.c: Likewise. * gfortran.dg/gomp/declare-variant-14.f90: Likewise. * c-c++-common/gomp/pr60823-1.c: Remove warning check. * c-c++-common/gomp/pr60823-3.c: Likewise. * g++.dg/gomp/declare-simd-7.C: Likewise. * g++.dg/gomp/declare-simd-8.C: Likewise. * g++.dg/gomp/pr88182.C: Likewise. * gcc.dg/declare-simd.c: Likewise. * gcc.dg/gomp/declare-simd-1.c: Likewise. * gcc.dg/gomp/pr87895-1.c: Likewise. * gfortran.dg/gomp/declare-simd-2.f90: Likewise. * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Likewise. * gfortran.dg/gomp/pr79154-1.f90: Likewise. * gfortran.dg/gomp/pr83977.f90: Likewise. * gcc.dg/gomp/pr87887-1.c: Add warning test. * gcc.dg/gomp/pr89246-1.c: Likewise. * gcc.dg/gomp/pr99542.c: Update warning test.diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 560e5431636ef46c41d56faa0c4e95be78f64b50..ac6350a44481628a947a0f20e034acf92cde63ec 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -27194,21 +27194,6 @@ supported_simd_type (tree t) return false; } -/* Return true for types that currently are supported as SIMD return - or argument types. */ - -static bool -currently_supported_simd_type (tree t, tree b) -{ - if (COMPLEX_FLOAT_TYPE_P (t)) -return false; - - if (TYPE_SIZE (t) != TYPE_SIZE (b)) -return false; - - return supported_simd_type (t); -} - /* Implement TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN. */ static int @@ -27217,7 +27202,7 @@ aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, tree base_type, int num, bool explicit_p) { - tree t, ret_type; + tree t, ret_type, nfs_type; unsigned int elt_bits, count; unsigned HOST_WIDE_INT const_simdlen; poly_uint64 vec_bits; @@ -27240,55 +27225,61 @@ aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, } ret_type = TREE_TYPE (TREE_TYPE (node->decl)); + /* According to AArch64's Vector ABI the type that determines the simdlen is + the narrowest of types, so we ignore base_type for AArch64. */ if (TREE_CODE (ret_type) != VOID_TYPE - && !currently_supported_simd_type (ret_type, base_type)) + && !supported_simd_type (ret_type)) { if (!explicit_p) ; - else if (TYPE_SIZE (ret_type) != TYPE_SIZE (base_type)) - warning_at (DECL_SOURCE_LOCATION (node->decl), 0, - "GCC does not currently support mixed size types " - "for % functions"); - else if (supported_simd_type (ret_type)) + else if (COMPLEX_FLOAT_TYPE_P (ret_type)) warning_at (DECL_SOURCE_LOCATION (node->decl), 0, "GCC does not currently support return type %qT " - "for % functions", ret_type); + "for simd", ret_type); else warning_at (DECL_SOURCE_LOCATION (node->decl), 0, - "unsupported return type %qT for % functions", + "unsupported return type %qT for simd", ret_type); return 0; } + nfs_type = ret_type; 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++) { tree arg_type = decl_arg_p ? TREE_TYPE (t) : TREE_VALUE (t); - if (clonei->args[i].arg_type != SIMD_CLONE_ARG_TYPE_UNIFORM - && !currently_supported_simd_type (arg_type, base_type)) + && !supported_simd_type (arg_type)) { if (!explicit_p) ; - else if (TYPE_SIZE (arg_type) != TYPE_SIZE (base_type)) + else if (COMPLEX_FLOAT_TYPE_P (ret_type)) warning_at (DECL_SOURCE_LOCATION (node->decl), 0, - "GCC does not currently support mixed size types " -