diff options
author | Aaron Sawdey <acsawdey@linux.ibm.com> | 2020-07-10 17:46:17 -0500 |
---|---|---|
committer | Aaron Sawdey <acsawdey@linux.ibm.com> | 2020-07-13 15:17:38 -0500 |
commit | 305ab735bd40b52a451851fa6e2177f184eb05d4 (patch) | |
tree | e987a6b897fd9d35d6dc39b3f50c966b300e354d /gcc | |
parent | 9cba898481368ce16c6a2d30ef781a82dce27c55 (diff) | |
download | gcc-305ab735bd40b52a451851fa6e2177f184eb05d4.zip gcc-305ab735bd40b52a451851fa6e2177f184eb05d4.tar.gz gcc-305ab735bd40b52a451851fa6e2177f184eb05d4.tar.bz2 |
rs6000: add effective-target test ppc_mma_hw
Add a test for dejagnu to determine if execution of MMA instructions is
supported in the test environment. Add an execution test to make sure
that __builtin_cpu_supports("mma") is true if we can execute MMA
instructions.
gcc/testsuite/
* lib/target-supports.exp (check_ppc_mma_hw_available):
New function.
(is-effective-target): Add ppc_mma_hw.
(is-effective-target-keyword): Add ppc_mma_hw.
* gcc.target/powerpc/mma-supported.c: New file.
* gcc.target/powerpc/mma-single-test.c: Require ppc_mma_hw.
* gcc.target/powerpc/mma-double-test.c: Require ppc_mma_hw.
Diffstat (limited to 'gcc')
-rwxr-xr-x | gcc/testsuite/gcc.target/powerpc/mma-double-test.c | 1 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.target/powerpc/mma-single-test.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/mma-supported.c | 25 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 27 |
4 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-double-test.c b/gcc/testsuite/gcc.target/powerpc/mma-double-test.c index 9ba0010..ac84ae3 100755 --- a/gcc/testsuite/gcc.target/powerpc/mma-double-test.c +++ b/gcc/testsuite/gcc.target/powerpc/mma-double-test.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target power10_hw } */ +/* { dg-require-effective-target ppc_mma_hw } */ /* { dg-options "-mdejagnu-cpu=power10 -O2" } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/powerpc/mma-single-test.c b/gcc/testsuite/gcc.target/powerpc/mma-single-test.c index aa71fa7..15369a6 100755 --- a/gcc/testsuite/gcc.target/powerpc/mma-single-test.c +++ b/gcc/testsuite/gcc.target/powerpc/mma-single-test.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target power10_hw } */ +/* { dg-require-effective-target ppc_mma_hw } */ /* { dg-options "-mdejagnu-cpu=power10 -O2" } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.target/powerpc/mma-supported.c b/gcc/testsuite/gcc.target/powerpc/mma-supported.c new file mode 100644 index 0000000..92d9a7f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mma-supported.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-require-effective-target ppc_mma_hw } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2" } */ + +/* This test will only run when the ppc_mma_hw test passes. If that + test passes, then we expect to see that mma feature is supported. + If this is not the case, then the test environment has problems. */ + +#include <stdio.h> +#include <stdlib.h> + +int +main (int argc, char *argv[]) +{ +#ifdef __BUILTIN_CPU_SUPPORTS__ + if ( !__builtin_cpu_supports ("mma")) + { +#ifdef DEBUG + printf ("Error: __builtin_cpu_supports says mma not supported, but ppc_mma_hw test passed.\n"); +#endif + abort(); + } +#endif + exit (0); +} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index aeb0351..2e4c696 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2234,6 +2234,31 @@ proc check_power10_hw_available { } { }] } +# Return 1 if the target supports executing MMA instructions, 0 otherwise. +# Cache the result. It is assumed that if a simulator does not support the +# MMA instructions, that it will generate an error and this test will fail. + +proc check_ppc_mma_hw_available { } { + return [check_cached_effective_target ppc_mma_hw_available { + check_runtime_nocache ppc_mma_hw_available { + #include <altivec.h> + typedef double v4sf_t __attribute__ ((vector_size (16))); + + int main() + { + __vector_quad acc0; + v4sf_t result[4]; + result[0][0] = 1.0; + __builtin_mma_xxsetaccz (&acc0); + __builtin_mma_disassemble_acc (result, &acc0); + if (result[0][0] != 0.0) + return 1; + return 0; + } + } "-mcpu=power10" + }] +} + # Return 1 if the target supports executing __float128 on PowerPC via software # emulation, 0 otherwise. Cache the result. @@ -7830,6 +7855,7 @@ proc is-effective-target { arg } { "ppc_float128_hw" { set selected [check_ppc_float128_hw_available] } "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] } "ppc_cpu_supports_hw" { set selected [check_ppc_cpu_supports_hw_available] } + "ppc_mma_hw" { set selected [check_ppc_mma_hw_available] } "dfp_hw" { set selected [check_dfp_hw_available] } "htm_hw" { set selected [check_htm_hw_available] } "named_sections" { set selected [check_named_sections_available] } @@ -7860,6 +7886,7 @@ proc is-effective-target-keyword { arg } { "ppc_float128_sw" { return 1 } "ppc_float128_hw" { return 1 } "ppc_recip_hw" { return 1 } + "ppc_mma_hw" { return 1 } "dfp_hw" { return 1 } "htm_hw" { return 1 } "named_sections" { return 1 } |