]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
xtensa: Minor changes to FPreg_neg_scaled_simm12b in 'xt_largeconst2'
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Wed, 11 Mar 2026 18:17:44 +0000 (03:17 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Fri, 13 Mar 2026 09:41:51 +0000 (02:41 -0700)
Having a non-zero finite REAL_VALUE_TYPE is equivalent to having it be
normal, because REAL_VALUE_TYPE can only be zero, normal, infinity, or
NaN (see gcc/real.h).

gcc/ChangeLog:

* config/xtensa/xtensa.cc (FPreg_neg_scaled_simm12b_1):
Change the test to determine whether REAL_VALUE_TYPE is a non-
zero finite value to whether it is normal.
(FPreg_neg_scaled_simm12b):
Place the call to FPreg_neg_scaled_simm12b_1 last in the
expression to improve performance, and change the dump file
output slightly.

gcc/config/xtensa/xtensa.cc

index 0c63deff6159aff22ef6dd23e52a10674bf51077..35395025efe14c4357d28d1e2d4cb4c639dea3c3 100644 (file)
@@ -5526,8 +5526,9 @@ FPreg_neg_scaled_simm12b_1 (const REAL_VALUE_TYPE *rval,
   REAL_VALUE_TYPE r;
   int shift;
 
-  /* Non-zero finite values can only be accepted.  */
-  if (! real_isfinite (rval) || rval->cl == rvc_zero)
+  /* Normal (i.e., neither zero, infinity nor NaN) values can only be
+     accepted.  */
+  if (rval->cl != rvc_normal)
     return false;
 
   /* Check whether the value multiplied by 32768 is an exact integer and
@@ -5563,15 +5564,14 @@ FPreg_neg_scaled_simm12b (rtx_insn *insn)
       && GET_MODE (dest) == SFmode
       && CONST_DOUBLE_P (src = avoid_constant_pool_reference (SET_SRC (pat)))
       && GET_MODE (src) == SFmode
-      && FPreg_neg_scaled_simm12b_1 (CONST_DOUBLE_REAL_VALUE (src),
-                                    v, scale)
       && (next = next_nonnote_nondebug_insn (insn))
       && NONJUMP_INSN_P (next)
       && GET_CODE (pat_1 = PATTERN (next)) == SET
       && REG_P (dest_1 = SET_DEST (pat_1)) && FP_REG_P (REGNO (dest_1))
       && GET_MODE (dest_1) == SFmode
       && rtx_equal_p (SET_SRC (pat_1), dest)
-      && (note = find_reg_note (next, REG_DEAD, dest)))
+      && (note = find_reg_note (next, REG_DEAD, dest))
+      && FPreg_neg_scaled_simm12b_1 (CONST_DOUBLE_REAL_VALUE (src), v, scale))
     {
       /* Estimate the costs of two matching insns.  */
       xt_full_rtx_costs costs;
@@ -5617,7 +5617,7 @@ FPreg_neg_scaled_simm12b (rtx_insn *insn)
          if (dump_file)
            {
              fprintf (dump_file,
-                      "FPreg_neg_scaled_simm12b: costs (%d,%d) -> (%d,%d)\n",
+                      "\t\t\treplacing, costs (%d,%d) -> (%d,%d)\n",
                       costs.major (), costs.minor (),
                       costs_1.major (), costs_1.minor ());
              dump_insn_slim (dump_file, insn);