Commit 1aae91e6 by Aaron Sawdey

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.

2020-07-13  Aaron Sawdey  <acsawdey@linux.ibm.com>

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.

(cherry picked from commit 305ab735bd40b52a451851fa6e2177f184eb05d4)
parent a4d20889
/* { 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>
......
/* { 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>
......
/* { 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);
}
......@@ -2235,6 +2235,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.
......@@ -7803,6 +7828,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] }
......@@ -7833,6 +7859,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 }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment