Based on how these functions are used in test cases, I think it's correct
to require 16-bit float support in both functions.

Without this change, the checks passes for armv8-m and armv8.1-m, but the
test cases that uses them fails due to the incorrect -mfpu option.

Ok for trunk and releases/gcc-14?

--

In both functions, it's assumed that 16-bit float support is available,
but it's not checked.
In addition, check_effective_target_arm_v8_2a_fp16_neon_ok also assumes
that neon is used, but it's not checked.

gcc/testsuite/ChangeLog:

        * lib/target-supports.exp
        (check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache): Check
        that 16-bit float is supported.
        (check_effective_target_arm_v8_2a_fp16_neon_ok_nocache): Check
        that neon is used and that 16-bit float is supported.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svens...@foss.st.com>
---
 gcc/testsuite/lib/target-supports.exp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 75703ddca60..19a9981d9cd 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -6360,6 +6360,12 @@ proc 
check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache { } {
                       "-mfpu=fp-armv8 -mfloat-abi=softfp"} {
        if { [check_no_compiler_messages_nocache \
                  arm_v8_2a_fp16_scalar_ok object {
+           #if !defined (__ARM_FP)
+           #error "__ARM_FP not defined"
+           #endif
+           #if ((__ARM_FP & 1) == 0)
+           #error "__ARM_FP indicates that 16-bit is not supported"
+           #endif
            #if !defined (__ARM_FEATURE_FP16_SCALAR_ARITHMETIC)
            #error "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC not defined"
            #endif
@@ -6395,6 +6401,15 @@ proc 
check_effective_target_arm_v8_2a_fp16_neon_ok_nocache { } {
                       "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
        if { [check_no_compiler_messages_nocache \
                  arm_v8_2a_fp16_neon_ok object {
+           #if !defined (__ARM_FP)
+           #error "__ARM_FP not defined"
+           #endif
+           #if ((__ARM_FP & 1) == 0)
+           #error "__ARM_FP indicates that 16-bit is not supported"
+           #endif
+           #if !defined (__ARM_NEON__)
+           #error "__ARM_NEON__ not defined"
+           #endif
            #if !defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
            #error "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC not defined"
            #endif
-- 
2.25.1

Reply via email to