https://gcc.gnu.org/g:ee126341536d26c63ec379264d7cabfc82a9100c

commit ee126341536d26c63ec379264d7cabfc82a9100c
Author: Michael Meissner <[email protected]>
Date:   Mon Oct 27 19:04:10 2025 -0400

    Do not allow non-zero 16-bit floating point constants.
    
    2025-10-27  Michael Meissner  <[email protected]>
    
    gcc/
    
            * config/rs6000/rs6000.cc (easy_altivec_constant): Do not allow 
non-zero
            16-bit floating point constants.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index e57a099466dc..f2c39aacc9a3 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -6517,9 +6517,12 @@ easy_altivec_constant (rtx op, machine_mode mode)
   else if (mode != GET_MODE (op))
     return 0;
 
-  /* V2DI/V2DF was added with VSX.  Only allow 0 and all 1's as easy
-     constants.  */
-  if (mode == V2DFmode)
+  /* V2DI/V2DF was added with VSX.  Only allow 0 and all 1's as easy constants.
+     Likewise, don't handle 16-bit floating point constants here, unless they
+     are 0.0.  */
+  if (mode == V2DFmode
+      || FP16_SCALAR_MODE_P (mode)
+      || FP16_VECTOR_MODE_P (mode))
     return zero_constant (op, mode) ? 8 : 0;
 
   else if (mode == V2DImode)

Reply via email to