https://gcc.gnu.org/g:1112f6473183bdefb985b1644f82dee5b5dc15f0

commit r17-5311-g1112f6473183bdefb985b1644f82dee5b5dc15f0
Author: Takayuki 'January June' Suwa <[email protected]>
Date:   Fri Oct 16 07:03:52 2026 +0900

    xtensa: Fix an issue regarding the CONST.S instruction in 
xtensa_is_insn_L32R_p()
    
    Regarding the use of the CONST.S machine instruction added in a recent
    patch, the cost estimation for the corresponding insn was incorrect,
    leading it to be mistakenly equated with the L32R instruction used for
    literal pool references.  This patch fixes this problem.
    
    (note: This patch covers not only the CONST.S but also the CONST.D, which
      may become available in the future.)
    
    gcc/ChangeLog:
    
            * config/xtensa/xtensa.cc (xtensa_is_insn_L32R_p):
            Modify it to return false if the given insn corresponds to
            CONST.[SD].

Diff:
---
 gcc/config/xtensa/xtensa.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index d7420fffec24..ad4515a57aea 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -4886,6 +4886,13 @@ xtensa_is_insn_L32R_p (const rtx_insn *insn)
       && CONST_INT_P (src) && xtensa_simm12b (INTVAL (src)))
     return false;
 
+  /* If the insn corresponds to the CONST.[SD] instruction, then obviously
+     not L32R.  */
+  if (TARGET_HARD_FLOAT_CONST && (mode == SFmode || mode == DFmode)
+      && CONST_DOUBLE_P (src)
+      && xtensa_fp_const (CONST_DOUBLE_REAL_VALUE (src)) >= 0)
+    return false;
+
   /* If TARGET_CONST16 is configured, constants of the remaining forms
      correspond to pairs of CONST16 instructions, not L32R.  */
   if (TARGET_CONST16)

Reply via email to