https://gcc.gnu.org/g:8816cba6f699997f668fb75295fc462ce4d992ff

commit r17-6290-g8816cba6f699997f668fb75295fc462ce4d992ff
Author: Maciej W. Rozycki <[email protected]>
Date:   Sun Nov 15 12:03:02 2026 +0000

    MIPS: Reorder `mips_insn_cost'
    
    Make the order of the hook implementing functions match that of the
    respective hook definition macros.
    
            gcc/
            * config/mips/mips.cc (mips_insn_cost): Reorder.

Diff:
---
 gcc/config/mips/mips.cc | 62 ++++++++++++++++++++++++-------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index 2500db9a09e7..7808b86a8f7d 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -4258,37 +4258,6 @@ mips_set_reg_reg_cost (machine_mode mode)
     }
 }
 
-/* Implement TARGET_INSN_COST.  */
-
-static int
-mips_insn_cost (rtx_insn *x, bool speed)
-{
-  int cost;
-  int count;
-  int ratio;
-
-  if (recog_memoized (x) < 0
-      && GET_CODE (PATTERN (x)) != ASM_INPUT
-      && asm_noperands (PATTERN (x)) < 0)
-    goto pattern_cost;
-
-  /* FIXME: return get_attr_length?  More tests may be needed.  */
-  if (!speed)
-    goto pattern_cost;
-
-  count = get_attr_insn_count (x);
-  ratio = get_attr_perf_ratio (x);
-  cost = COSTS_N_INSNS (count) * ratio;
-  if (cost > 0)
-    return cost;
-
-pattern_cost:
-  cost = pattern_cost (PATTERN (x), speed);
-  /* If the cost is zero, then it's likely a complex insn.
-     FIXME: Return COSTS_N_INSNS (2)?  More tests are needed.  */
-  return cost;
-}
-
 /* Implement TARGET_RTX_COSTS.  */
 
 static bool
@@ -4812,6 +4781,37 @@ mips_address_cost (rtx addr, machine_mode mode,
   return mips_address_insns (addr, mode, false);
 }
 
+/* Implement TARGET_INSN_COST.  */
+
+static int
+mips_insn_cost (rtx_insn *x, bool speed)
+{
+  int cost;
+  int count;
+  int ratio;
+
+  if (recog_memoized (x) < 0
+      && GET_CODE (PATTERN (x)) != ASM_INPUT
+      && asm_noperands (PATTERN (x)) < 0)
+    goto pattern_cost;
+
+  /* FIXME: return get_attr_length?  More tests may be needed.  */
+  if (!speed)
+    goto pattern_cost;
+
+  count = get_attr_insn_count (x);
+  ratio = get_attr_perf_ratio (x);
+  cost = COSTS_N_INSNS (count) * ratio;
+  if (cost > 0)
+    return cost;
+
+pattern_cost:
+  cost = pattern_cost (PATTERN (x), speed);
+  /* If the cost is zero, then it's likely a complex insn.
+     FIXME: Return COSTS_N_INSNS (2)?  More tests are needed.  */
+  return cost;
+}
+
 /* Implement TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P.  */
 
 static bool

Reply via email to