Commit: RX: Include cost of register moving in the cost of register loading.

Message ID
State New
Headers show

Commit Message

Nick Clifton May 17, 2011, 8:58 a.m.
Hi Guys,

  I am applying the patch below to fix a bug with the
  rx_memory_move_cost function.  The problem was that the costs are
  meant to be relative to the cost of moving a value between registers,
  but the existing definition was making stores cheaper than moves, and
  loads the same cost as moves.  Thus gcc was sometimes choosing to store
  values in memory when actually it was better to keep them in memory.

  The patch fixes the problem by adding in the register move cost to the
  memory move cost.  It also removes the call to
  memory_move_secondary_cost since there is no secondary cost.


2011-05-17  Nick Clifton  <>

	* config/rx/rx.c (rx_memory_move_cost): Include cost of register


Index: gcc/config/rx/rx.c
--- gcc/config/rx/rx.c	(revision 173815)
+++ gcc/config/rx/rx.c	(working copy)
@@ -2638,7 +2638,7 @@ 
 static int
 rx_memory_move_cost (enum machine_mode mode, reg_class_t regclass, bool in)
-  return (in ? 2 : 0) + memory_move_secondary_cost (mode, regclass, in);
+  return (in ? 2 : 0) + REGISTER_MOVE_COST (mode, regclass, regclass);
 /* Convert a CC_MODE to the set of flags that it represents.  */