https://gcc.gnu.org/g:3ebea69c237d738960bbef1991bb1ee1276b303e

commit 3ebea69c237d738960bbef1991bb1ee1276b303e
Author: Michael Meissner <[email protected]>
Date:   Mon Nov 3 19:50:31 2025 -0500

    Tell user if we have hardware support for 16-bit floating point.
    
    2025-11-03  Michael Meissner  <[email protected]>
    
    gcc/
    
            * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros); Define
            __BFLOAT16_HW__ if we have hardware support for __bflot16 
conversions.
            Define __FLOAT16_HW__ if we have hardware support for _Float16
            conversions.

Diff:
---
 gcc/config/rs6000/rs6000-c.cc | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 7ab226885182..3b4d4c4a09ab 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -588,9 +588,19 @@ rs6000_target_modify_macros (bool define_p,
 
   /* 16-bit floating point support.  */
   if ((flags & OPTION_MASK_FLOAT16) != 0)
-    rs6000_define_or_undefine_macro (define_p, "__FLOAT16__");
+    {
+      rs6000_define_or_undefine_macro (define_p, "__FLOAT16__");
+      if ((cpu_option & CPU_OPTION_POWER9_MASK) != 0)
+       rs6000_define_or_undefine_macro (define_p, "__FLOAT16_HW__");
+    }
+
   if ((flags & OPTION_MASK_BFLOAT16) != 0)
-    rs6000_define_or_undefine_macro (define_p, "__BFLOAT16__");
+    {
+      rs6000_define_or_undefine_macro (define_p, "__BFLOAT16__");
+      if ((cpu_option & CPU_OPTION_POWER10_MASK) != 0)
+       rs6000_define_or_undefine_macro (define_p, "__BFLOAT16_HW__");
+    }
+
   /* Tell the user if we are targeting CELL.  */
   if (rs6000_cpu == PROCESSOR_CELL)
     rs6000_define_or_undefine_macro (define_p, "__PPU__");

Reply via email to