6, /* cost of starting a multiply */
1, /* cost of multiply per each bit set */
23, /* cost of a divide/mod */
- 15 /* "large" insn */
+ 15, /* "large" insn */
+ {2, 4, 2}, /* cost of loading integer registers
+ in QImode, HImode and SImode.
+ Relative to reg-reg move (2). */
+ {2, 4, 2}, /* cost of storing integer registers */
+ 2, /* cost of reg,reg fld/fst */
+ {8, 8, 8}, /* cost of loading fp registers
+ in SFmode, DFmode and XFmode */
+ {8, 8, 8} /* cost of loading integer registers */
};
struct processor_costs i486_cost = { /* 486 specific costs */
12, /* cost of starting a multiply */
1, /* cost of multiply per each bit set */
40, /* cost of a divide/mod */
- 15 /* "large" insn */
+ 15, /* "large" insn */
+ {2, 4, 2}, /* cost of loading integer registers
+ in QImode, HImode and SImode.
+ Relative to reg-reg move (2). */
+ {2, 4, 2}, /* cost of storing integer registers */
+ 2, /* cost of reg,reg fld/fst */
+ {8, 8, 8}, /* cost of loading fp registers
+ in SFmode, DFmode and XFmode */
+ {8, 8, 8} /* cost of loading integer registers */
};
struct processor_costs pentium_cost = {
11, /* cost of starting a multiply */
0, /* cost of multiply per each bit set */
25, /* cost of a divide/mod */
- 8 /* "large" insn */
+ 8, /* "large" insn */
+ {2, 4, 2}, /* cost of loading integer registers
+ in QImode, HImode and SImode.
+ Relative to reg-reg move (2). */
+ {2, 4, 2}, /* cost of storing integer registers */
+ 2, /* cost of reg,reg fld/fst */
+ {2, 2, 6}, /* cost of loading fp registers
+ in SFmode, DFmode and XFmode */
+ {4, 4, 6} /* cost of loading integer registers */
};
struct processor_costs pentiumpro_cost = {
1, /* cost of starting a multiply */
0, /* cost of multiply per each bit set */
17, /* cost of a divide/mod */
- 8 /* "large" insn */
+ 8, /* "large" insn */
+ {4, 4, 4}, /* cost of loading integer registers
+ in QImode, HImode and SImode.
+ Relative to reg-reg move (2). */
+ {2, 2, 2}, /* cost of storing integer registers */
+ 2, /* cost of reg,reg fld/fst */
+ {2, 2, 6}, /* cost of loading fp registers
+ in SFmode, DFmode and XFmode */
+ {4, 4, 6} /* cost of loading integer registers */
};
struct processor_costs k6_cost = {
3, /* cost of starting a multiply */
0, /* cost of multiply per each bit set */
18, /* cost of a divide/mod */
- 8 /* "large" insn */
+ 8, /* "large" insn */
+ {4, 5, 4}, /* cost of loading integer registers
+ in QImode, HImode and SImode.
+ Relative to reg-reg move (2). */
+ {2, 3, 2}, /* cost of storing integer registers */
+ 4, /* cost of reg,reg fld/fst */
+ {6, 6, 6}, /* cost of loading fp registers
+ in SFmode, DFmode and XFmode */
+ {4, 4, 4} /* cost of loading integer registers */
};
struct processor_costs *ix86_cost = &pentium_cost;
int mult_bit; /* cost of multiply per each bit set */
int divide; /* cost of a divide/mod */
int large_insn; /* insns larger than this cost more */
+ int int_load[3]; /* cost of loading integer registers
+ in QImode, HImode and SImode relative
+ to reg-reg move (2). */
+ int int_store[3]; /* cost of storing integer register
+ in QImode, HImode and SImode */
+ int fp_move; /* cost of reg,reg fld/fst */
+ int fp_load[3]; /* cost of loading FP register
+ in SFmode, DFmode and XFmode */
+ int fp_store[3]; /* cost of storing FP register
+ in SFmode, DFmode and XFmode */
};
extern struct processor_costs *ix86_cost;
: REG_P (RTX) ? 1 \
: 2)
-/* A C expression for the cost of moving data of mode M between a
- register and memory. A value of 2 is the default; this cost is
- relative to those in `REGISTER_MOVE_COST'.
+/* A C expression for the cost of moving data from a register in class FROM to
+ one in class TO. The classes are expressed using the enumeration values
+ such as `GENERAL_REGS'. A value of 2 is the default; other values are
+ interpreted relative to that.
- If moving between registers and memory is more expensive than
- between two registers, you should define this macro to express the
- relative cost.
+ It is not required that the cost always equal 2 when FROM is the same as TO;
+ on some machines it is expensive to move between registers if they are not
+ general registers.
On the i386, copying between floating-point and fixed-point
- registers is expensive. */
+ registers is done trough memory.
+
+ Integer -> fp moves are noticeably slower than the opposite direction
+ because of the partial memory stall they cause. Give it an
+ arbitary high cost.
+ */
#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
- || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) ? 10 \
- : 2)
-
+ ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
+ ? (MEMORY_MOVE_COST (DFmode, CLASS1, 0) \
+ + MEMORY_MOVE_COST (DFmode, CLASS2, 1)) \
+ : (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)) ? 10 : 2)
/* A C expression for the cost of moving data of mode M between a
register and memory. A value of 2 is the default; this cost is
between two registers, you should define this macro to express the
relative cost. */
-/* #define MEMORY_MOVE_COST(M,C,I) 2 */
+#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
+ (FLOAT_CLASS_P (CLASS) \
+ ? (GET_MODE_SIZE (MODE)==4 \
+ ? (IN ? ix86_cost->fp_load[0] : ix86_cost->fp_store[0]) \
+ : (GET_MODE_SIZE (MODE)==8 \
+ ? (IN ? ix86_cost->fp_load[1] : ix86_cost->fp_store[1]) \
+ : (IN ? ix86_cost->fp_load[2] : ix86_cost->fp_store[2]))) \
+ : (GET_MODE_SIZE (MODE)==1 \
+ ? (IN ? ix86_cost->int_load[0] : ix86_cost->int_store[0]) \
+ : (GET_MODE_SIZE (MODE)==2 \
+ ? (IN ? ix86_cost->int_load[1] : ix86_cost->int_store[1]) \
+ : ((IN ? ix86_cost->int_load[2] : ix86_cost->int_store[2]) \
+ * GET_MODE_SIZE (MODE) / 4))))
/* A C expression for the cost of a branch instruction. A value of 1
is the default; other values are interpreted relative to that. */