Commit a6f71af5 by Jim Wilson

(andcosts): Modify costs to match the hardware, and add

explanatory comments.

From-SVN: r9245
parent 71851aaa
...@@ -1400,16 +1400,24 @@ andcosts (RTX) ...@@ -1400,16 +1400,24 @@ andcosts (RTX)
rtx RTX; rtx RTX;
{ {
int i; int i;
/* Anding with a register is a single cycle and instruction. */
if (GET_CODE (XEXP (RTX, 1)) != CONST_INT) if (GET_CODE (XEXP (RTX, 1)) != CONST_INT)
return 2; return 1;
i = INTVAL (XEXP (RTX, 1)); i = INTVAL (XEXP (RTX, 1));
/* And can use the extend insns cheaply. */ /* These constants are single cycle extu.[bw] instructions. */
if (i == 0xff || i == 0xffff) if (i == 0xff || i == 0xffff)
return 1;
/* Constants that can be used in an and immediate instruction is a single
cycle, but this requires r0, so make it a little more expensive. */
if (CONST_OK_FOR_L (i))
return 2; return 2;
/* Any small constant is reasonably cheap - but requires r0. */ /* Constants that can be loaded with a mov immediate and an and.
This case is probably unnecessary. */
if (CONST_OK_FOR_I (i)) if (CONST_OK_FOR_I (i))
return 3; return 2;
return 5; /* Any other constants requires a 2 cycle pc-relative load plus an and.
This case is probably unnecessary. */
return 3;
} }
/* Return the cost of a multiply. */ /* Return the cost of a multiply. */
......
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