+Sun Apr 18 17:24:10 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
+
+ * config/c4x/c4x.c (legitimize_operands): Use rtx_cost
+ to determine if it is worthwhile forcing a constant into a register.
+ * config/c4x/c4x.h (CONST_COSTS): An integer value of 255 or 65535
+ used with a logical and or an integer value of 16 or 24 used with
+ a right shift has zero cost on the C40.
+
Sat Apr 17 21:30:11 1999 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* gcse.c (compute_local_properties): If setp is nonzero, clear
/* Any valid memory operand screened by src_operand is OK. */
case MEM:
+#if 0
+ if (code2 != REG)
+ return 0;
+#endif
+ break;
/* After CSE, any remaining (ADDRESSOF:P reg) gets converted
into a stack slot memory address comprising a PLUS and a
if (! reload_in_progress
&& TARGET_HOIST
&& optimize > 0
- && ((GET_CODE (operands[1]) == CONST_INT
- && ! c4x_J_constant (operands[1])
- && INTVAL (operands[1]) != 0)
- || GET_CODE (operands[1]) == CONST_DOUBLE))
+ && GET_CODE (operands[1]) == CONST_INT
+ && preserve_subexpressions_p ()
+ && rtx_cost (operands[1], code) > 1)
operands[1] = force_reg (mode, operands[1]);
if (! reload_in_progress
opportunities. */
if (! reload_in_progress
&& ! ((code == PLUS || code == MINUS) && mode == Pmode)
- && (TARGET_HOIST && optimize > 1
- && ((GET_CODE (operands[2]) == CONST_INT
- && ! c4x_J_constant (operands[2])
- && INTVAL (operands[2]) != 0)
- || GET_CODE (operands[2]) == CONST_DOUBLE)))
+ && TARGET_HOIST
+ && optimize > 1
+ && GET_CODE (operands[2]) == CONST_INT
+ && preserve_subexpressions_p ()
+ && rtx_cost (operands[2], code) > 1)
operands[2] = force_reg (mode, operands[2]);
/* We can get better code on a C30 if we force constant shift counts
Some small integers are effectively free for the C40. We should
also consider if we are using the small memory model. With
the big memory model we require an extra insn for a constant
- loaded from memory. */
+ loaded from memory.
+
+ This is used by expand_binop to decide whether to force a constant
+ into a register. If the cost is greater than 2 and the constant
+ is used within a short loop, it gets forced into a register.
+ Ideally, there should be some weighting as to how mnay times it is used
+ within the loop. */
#define SHIFT_CODE_P(C) ((C) == ASHIFT || (C) == ASHIFTRT || (C) == LSHIFTRT)
case CONST_INT: \
if (c4x_J_constant (RTX)) \
return 0; \
+ if (! TARGET_C3X \
+ && OUTER_CODE == AND \
+ && GET_CODE (RTX) == CONST_INT \
+ && (INTVAL (RTX) == 255 || INTVAL (RTX) == 65535)) \
+ return 0; \
+ if (! TARGET_C3X \
+ && (OUTER_CODE == ASHIFTRT || OUTER_CODE == LSHIFTRT) \
+ && GET_CODE (RTX) == CONST_INT \
+ && (INTVAL (RTX) == 16 || INTVAL (RTX) == 24)) \
+ return 0; \
if (TARGET_C3X && SHIFT_CODE_P (OUTER_CODE)) \
return 3; \
if (LOGICAL_CODE_P (OUTER_CODE) \