From: Takayuki 'January June' Suwa <[email protected]>
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].
---
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 d7420fffec248..ad4515a57aead 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)
--
2.54.0