--- /dev/null
+/* { 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);
+}
}]
}
+# 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.
"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] }
"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 }