diff mbox series

[avr.applied] Adjusted rtx costs of plus + zero_extend

Message ID 1a1cf469-073e-4822-b1c6-3d6fc810585a@gjlay.de
State New
Headers show
Series [avr.applied] Adjusted rtx costs of plus + zero_extend | expand

Commit Message

Georg-Johann Lay March 6, 2024, 12:21 p.m. UTC
Adjusted rtx costs of (plus (zero_extend (...)) reg).

Johann

--

AVR: Adjust rtx cost of plus + zero_extend.

gcc/
         * config/avr/avr.cc (avr_rtx_costs_1) [PLUS+ZERO_EXTEND]: Adjust
         rtx cost.

         case E_QImode:
diff mbox series

Patch

diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index 36995e05cbe..b87ae6a256d 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -12513,6 +12513,13 @@  avr_rtx_costs_1 (rtx x, machine_mode mode, int 
outer_code,
        return true;

      case PLUS:
+      if (GET_CODE (XEXP (x, 0)) == ZERO_EXTEND
+         && REG_P (XEXP (x, 1)))
+       {
+         *total = COSTS_N_INSNS (GET_MODE_SIZE (mode) - 1);
+         return true;
+       }
+
        switch (mode)
         {