Here is a patch to use the new TARGET_GET_MULTILIB_ABI_NAME macro that Martin Liska added with the Aarch64 platform. The main issue to consider is what abi names to support, I created 8 versions for big- endian/little-endian, ilp32/lp64, and sve/non-sve. I am not sure if we need all of those but it seemed better to have them and not use them than to find out we need them later.
Tested on Aarch64 and x86 with bootstraps and test runs. There were no regressions. Ok to checkin? Steve Ellcey sell...@marvell.com 2018-02-19 Steve Ellcey <sell...@marvell.com> * config/aarch64/aarch64.c (aarch64_get_multilib_abi_name): New function. (TARGET_GET_MULTILIB_ABI_NAME): New macro. 2018-02-19 Steve Ellcey <sell...@marvell.com> * gfortran.dg/simd-builtins-1.f90: Update for aarch64*-*-*. * gfortran.dg/simd-builtins-2.f90: Ditto. * gfortran.dg/simd-builtins-6.f90: Ditto. * gfortran.dg/simd-builtins-8.f90: New test. * gfortran.dg/simd-builtins-8.h: New header file.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 9f52cc9ff3b..d26ff85b683 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -18720,6 +18720,23 @@ aarch64_comp_type_attributes (const_tree type1, const_tree type2) return 1; } +/* Implement TARGET_GET_MULTILIB_ABI_NAME */ + +static const char * +aarch64_get_multilib_abi_name (void) +{ + if (TARGET_BIG_END) + { + if (AARCH64_ISA_SVE) + return TARGET_ILP32 ? "aarch64_be_ilp32_sve" : "aarch64_be_sve"; + return TARGET_ILP32 ? "aarch64_be_ilp32" : "aarch64_be"; + } + if (AARCH64_ISA_SVE) + return TARGET_ILP32 ? "aarch64_ilp32_sve" : "aarch64_sve"; + return TARGET_ILP32 ? "aarch64_ilp32" : "aarch64"; +} + + /* Implement TARGET_STACK_PROTECT_GUARD. In case of a global variable based guard use the default else return a null tree. */ @@ -19242,6 +19259,9 @@ aarch64_libgcc_floating_mode_supported_p #undef TARGET_COMP_TYPE_ATTRIBUTES #define TARGET_COMP_TYPE_ATTRIBUTES aarch64_comp_type_attributes +#undef TARGET_GET_MULTILIB_ABI_NAME +#define TARGET_GET_MULTILIB_ABI_NAME aarch64_get_multilib_abi_name + #if CHECKING_P #undef TARGET_RUN_TARGET_SELFTESTS #define TARGET_RUN_TARGET_SELFTESTS selftest::aarch64_run_selftests
diff --git a/gcc/testsuite/gfortran.dg/simd-builtins-1.f90 b/gcc/testsuite/gfortran.dg/simd-builtins-1.f90 index 6d79ef8dc46..5cb3eb5132a 100644 --- a/gcc/testsuite/gfortran.dg/simd-builtins-1.f90 +++ b/gcc/testsuite/gfortran.dg/simd-builtins-1.f90 @@ -1,5 +1,6 @@ -! { dg-do compile { target { i?86-*-linux* x86_64-*-linux* } } } -! { dg-additional-options "-msse2 -mno-avx -nostdinc -Ofast -fpre-include=simd-builtins-1.h -fdump-tree-optimized" } +! { dg-do compile { target i?86-*-linux* x86_64-*-linux* aarch64*-*-linux* } } +! { dg-additional-options "-nostdinc -Ofast -fpre-include=simd-builtins-1.h -fdump-tree-optimized" } +! { dg-additional-options "-msse2 -mno-avx" { target i?86-*-linux* x86_64-*-linux* } } program test_overloaded_intrinsic real(4) :: x4(3200), y4(3200) @@ -14,6 +15,7 @@ program test_overloaded_intrinsic print *, y8 end -! { dg-final { scan-tree-dump "sinf.simdclone" "optimized" } } */ -! { dg-final { scan-tree-dump "__builtin_sin" "optimized" } } */ -! { dg-final { scan-assembler "call.*_ZGVbN4v_sinf" } } +! { dg-final { scan-tree-dump "sinf.simdclone" "optimized" } } +! { dg-final { scan-tree-dump "__builtin_sin" "optimized" } } +! { dg-final { scan-assembler "call.*_ZGVbN4v_sinf" { target i?86-*-linux* x86_64-*-* } } } +! { dg-final { scan-assembler "bl.*_ZGVnN4v_sinf" { target aarch64*-*-* } } } diff --git a/gcc/testsuite/gfortran.dg/simd-builtins-2.f90 b/gcc/testsuite/gfortran.dg/simd-builtins-2.f90 index f0e6bc13862..2e5bc22716b 100644 --- a/gcc/testsuite/gfortran.dg/simd-builtins-2.f90 +++ b/gcc/testsuite/gfortran.dg/simd-builtins-2.f90 @@ -1,11 +1,12 @@ -! { dg-do compile { target { i?86-*-linux* x86_64-*-linux* } } } -! { dg-additional-options "-msse2 -nostdinc -Ofast -fdump-tree-optimized" } +! { dg-do compile { target { i?86-*-linux* x86_64-*-linux* aarch64*-*-linux* } } } +! { dg-additional-options "-nostdinc -Ofast -fdump-tree-optimized" } +! { dg-additional-options "-msse2" { target i?86-*-linux* x86_64-*-linux* } } program test_overloaded_intrinsic real(4) :: x4(3200), y4(3200) real(8) :: x8(3200), y8(3200) - ! this should be using simd clone + ! this should not be using simd clone y4 = sin(x4) print *, y4 @@ -18,3 +19,4 @@ end ! { dg-final { scan-tree-dump "__builtin_sin" "optimized" } } */ ! { dg-final { scan-tree-dump-not "simdclone" "optimized" } } */ ! { dg-final { scan-assembler-not "call.*_ZGVbN4v_sinf" } } +! { dg-final { scan-assembler-not "bl.*_ZGVnN4v_sinf" } } diff --git a/gcc/testsuite/gfortran.dg/simd-builtins-6.f90 b/gcc/testsuite/gfortran.dg/simd-builtins-6.f90 index 2ffa807e6b6..60bcac78f3e 100644 --- a/gcc/testsuite/gfortran.dg/simd-builtins-6.f90 +++ b/gcc/testsuite/gfortran.dg/simd-builtins-6.f90 @@ -1,5 +1,6 @@ -! { dg-do compile { target { i?86-*-linux* x86_64-*-linux* } } } -! { dg-additional-options "-msse2 -mno-avx -nostdinc -Ofast -fdump-tree-optimized" } +! { dg-do compile { target { i?86-*-linux* x86_64-*-linux* aarch64*-*-linux* } } } +! { dg-additional-options "-nostdinc -Ofast -fdump-tree-optimized" } +! { dg-additional-options "-msse2 -mno-avx" { target i?86-*-linux* x86_64-*-linux* } } !GCC$ builtin (sin) attributes simd (inbranch) !GCC$ builtin (sinf) attributes simd (notinbranch) @@ -21,4 +22,5 @@ end ! { dg-final { scan-tree-dump "sinf.simdclone" "optimized" } } */ ! { dg-final { scan-tree-dump "__builtin_sin" "optimized" } } */ -! { dg-final { scan-assembler "call.*_ZGVbN4v_sinf" } } +! { dg-final { scan-assembler "call.*_ZGVbN4v_sinf" { target i?86-*-linux* x86_64-*-* } } } +! { dg-final { scan-assembler "bl.*_ZGVnN4v_sinf" { target aarch64*-*-* } } } diff --git a/gcc/testsuite/gfortran.dg/simd-builtins-8.f90 b/gcc/testsuite/gfortran.dg/simd-builtins-8.f90 index e69de29bb2d..0237235b5ae 100644 --- a/gcc/testsuite/gfortran.dg/simd-builtins-8.f90 +++ b/gcc/testsuite/gfortran.dg/simd-builtins-8.f90 @@ -0,0 +1,19 @@ +! { dg-do compile { target { aarch64*-*-linux* } } } +! { dg-additional-options "-nostdinc -Ofast -fpre-include=simd-builtins-8.h -fdump-tree-optimized" } + +program test_overloaded_intrinsic + real(4) :: x4(3200), y4(3200) + real(8) :: x8(3200), y8(3200) + + y4 = sin(x4) + print *, y4 + + y4 = sin(x8) + print *, y8 +end + +! { dg-final { scan-tree-dump "sinf.simdclone" "optimized" { target ilp32 } } } */ +! { dg-final { scan-tree-dump-not "sin.simdclone" "optimized" { target ilp32 } } } */ + +! { dg-final { scan-tree-dump "sin.simdclone" "optimized" { target lp64 } } } */ +! { dg-final { scan-tree-dump-not "sinf.simdclone" "optimized" { target lp64 } } } */ diff --git a/gcc/testsuite/gfortran.dg/simd-builtins-8.h b/gcc/testsuite/gfortran.dg/simd-builtins-8.h index e69de29bb2d..610fd52a535 100644 --- a/gcc/testsuite/gfortran.dg/simd-builtins-8.h +++ b/gcc/testsuite/gfortran.dg/simd-builtins-8.h @@ -0,0 +1,8 @@ +!GCC$ builtin (sin) attributes simd (notinbranch) if('aarch64') +!GCC$ builtin (sin) attributes simd (notinbranch) if('aarch64_sve') +!GCC$ builtin (sin) attributes simd (notinbranch) if('aarch64_be') +!GCC$ builtin (sin) attributes simd (notinbranch) if('aarch64_be_sve') +!GCC$ builtin (sinf) attributes simd (notinbranch) if('aarch64_ilp32') +!GCC$ builtin (sinf) attributes simd (notinbranch) if('aarch64_ilp32_sve') +!GCC$ builtin (sinf) attributes simd (notinbranch) if('aarch64_be_ilp32') +!GCC$ builtin (sinf) attributes simd (notinbranch) if('aarch64_be_ilp32_sve')