Commit dd4fd0a0 by Jeff Law

h8300.c (h8300_adjust_insn_length): Adjust the cost of shifts by small constant values.

        * h8300/h8300.c (h8300_adjust_insn_length): Adjust the cost of
        shifts by small constant values.
        * h8300/h8300.md: Refine comments.  Remove names from many
        patterns which don't need them.
        (compare insns): Don't underestimate lengths.
        (andqi3 expander): Remove constrains.
        (andhi3): Don't underestimate length.
        (andsi3): Don't underestimate length.  Improve code when upper
        or lower half of destination is being cleared.
        (indirect_jump_h8300, indirect_jump_h8300h): Simplify.
        (shift insns): Remove useless "I" constraint.

From-SVN: r11912
parent 17d6fedc
......@@ -2342,5 +2342,46 @@ h8300_adjust_insn_length (insn, length)
}
}
/* Shifts need various adjustments. */
if (GET_CODE (pat) == PARALLEL
&& GET_CODE (XVECEXP (pat, 0, 0)) == SET
&& (GET_CODE (SET_SRC (XVECEXP (pat, 0, 0))) == ASHIFTRT
|| GET_CODE (SET_SRC (XVECEXP (pat, 0, 0))) == LSHIFTRT
|| GET_CODE (SET_SRC (XVECEXP (pat, 0, 0))) == ASHIFT))
{
rtx src = SET_SRC (XVECEXP (pat, 0, 0));
enum machine_mode mode = GET_MODE (src);
if (GET_CODE (XEXP (src, 1)) != CONST_INT)
return 0;
/* QImode shifts by small constants take one insn
per shift. So the adjustment is 20 (md length) -
# shifts * 2. */
if (mode == QImode && INTVAL (XEXP (src, 1)) <= 4)
return -(20 - INTVAL (XEXP (src, 1)) * 2);
/* Similarly for HImode and SImode shifts by
small constants on the H8/300H. */
if (TARGET_H8300H
&& (mode == HImode || mode == SImode)
&& INTVAL (XEXP (src, 1)) <= 4)
return -(20 - INTVAL (XEXP (src, 1)) * 2);
/* HImode shifts by small constants for the H8/300. */
if (mode == HImode
&& INTVAL (XEXP (src, 1)) <= 4)
return -(20 - (INTVAL (XEXP (src, 1))
* (GET_CODE (src) == ASHIFT ? 2 : 4)));
/* SImode shifts by small constants for the H8/300. */
if (mode == SImode
&& INTVAL (XEXP (src, 1)) <= 2)
return -(20 - (INTVAL (XEXP (src, 1))
* (GET_CODE (src) == ASHIFT ? 6 : 8)));
/* XXX ??? Could check for more shift/rotate cases here. */
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment