*** empty log message ***

From-SVN: r783
This commit is contained in:
Richard Stallman 1992-04-18 19:56:04 +00:00
parent d3797078d4
commit 3bb22aee13
13 changed files with 73 additions and 54 deletions

View File

@ -1221,7 +1221,7 @@ extern char *a29k_function_name;
instruction are those involving floating-point or address. So
only these need be expensive. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
return 0; \
case CONST: \
@ -1239,7 +1239,7 @@ extern char *a29k_function_name;
The multiply cost depends on whether this is a 29050 or not. */
#define RTX_COSTS(X,CODE) \
#define RTX_COSTS(X,CODE,OUTER_CODE) \
case MULT: \
return TARGET_29050 ? COSTS_N_INSNS (2) : COSTS_N_INSNS (40); \
case DIV: \

View File

@ -751,7 +751,7 @@ enum reg_class {
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST: \
case LABEL_REF: \
case SYMBOL_REF: \
@ -764,7 +764,7 @@ enum reg_class {
switch on CODE.
On C1 and C2, multiply is faster than shift. */
#define RTX_COSTS(RTX,CODE) \
#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
case MULT: \
total = COSTS_N_INSNS (4); \
break; \

View File

@ -1093,14 +1093,18 @@ while (0)
/* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. */
#define RTX_COSTS(X,CODE) \
#define RTX_COSTS(X,CODE,OUTER_CODE) \
case MULT: \
return COSTS_N_INSNS (10); \
case DIV: \
case UDIV: \
case MOD: \
case UMOD: \
return COSTS_N_INSNS (40);
return COSTS_N_INSNS (40); \
case PLUS: \
if (GET_CODE (XEXP (RTX, 0)) == REG \
&& GET_CODE (XEXP (RTX, 1)) == CONST_INT) \
return 1;
/* Compute the cost of computing a constant rtl expression RTX
@ -1108,7 +1112,7 @@ while (0)
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
case CONST: \
case LABEL_REF: \
@ -1120,11 +1124,7 @@ while (0)
return code == 1 ? 0 : \
code == 2 ? 1 : \
2; \
} \
case PLUS: \
if (GET_CODE (XEXP (RTX, 0)) == REG \
&& GET_CODE (XEXP (RTX, 1)) == CONST_INT) \
return 1;
}
/* Compute the cost of an address. This is meant to approximate the size
and/or execution delay of an insn using that address. If the cost is

View File

@ -1285,7 +1285,7 @@ __transfer_from_trampoline () \
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
/* Constant zero is super cheap due to clr instruction. */ \
if (RTX == const0_rtx) return 0; \
@ -1293,7 +1293,8 @@ __transfer_from_trampoline () \
if (INTVAL (RTX) >= -128 && INTVAL (RTX) <= 127) return 1; \
/* Constants between -136 and 254 are easily generated */ \
/* by intelligent uses of moveq, add[q], and subq */ \
if (INTVAL (RTX) >= -136 && INTVAL (RTX) <= 254) return 2; \
if (OUTER_CODE == SET && INTVAL (RTX) >= -136 \
&& INTVAL (RTX) <= 254) return 2; \
case CONST: \
case LABEL_REF: \
case SYMBOL_REF: \
@ -1310,7 +1311,7 @@ __transfer_from_trampoline () \
#define MULL_COST (TARGET_68040 ? 5 : 13)
#define MULW_COST (TARGET_68040 ? 3 : 8)
#define RTX_COSTS(X,CODE) \
#define RTX_COSTS(X,CODE,OUTER_CODE) \
case PLUS: \
/* An lea costs about three times as much as a simple add. */ \
if (GET_MODE (X) == SImode \

View File

@ -1482,7 +1482,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
is as good as a register; since it can't be placed in any insn, it
won't do anything in cse, but it will cause expand_binop to pass the
constant to the define_expands). */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
if (SMALL_INT (RTX)) \
return 0; \
@ -1516,7 +1516,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
/* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. */
#define RTX_COSTS(X,CODE) \
#define RTX_COSTS(X,CODE,OUTER_CODE) \
case MEM: \
return COSTS_N_INSNS (2); \
case MULT: \

View File

@ -999,7 +999,7 @@ __transfer_from_trampoline () \
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \
if (INTVAL (RTX) < 0x4000 && INTVAL (RTX) >= -0x4000) \

View File

@ -1030,7 +1030,7 @@ extern int current_function_calls_alloca;
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
if (CONST_OK_FOR_LETTER_P (INTVAL (RTX),'I')) return 0; \
case CONST: \

View File

@ -1225,19 +1225,29 @@ struct rt_cargs {int gregs, fregs; };
few bits. */
#define SHIFT_COUNT_TRUNCATED
/* Compute the cost of computing a constant rtl expression RTX
whose rtx-code is CODE. The body of this macro is a portion
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
/* Compute the cost of computing a constant rtl expression RTX whose
rtx-code is CODE, contained within an expression of code OUTER_CODE.
The body of this macro is a portion of a switch statement. If the
code is computed here, return it with a return statement. Otherwise,
break from the switch. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
return 0; \
if (OUTER_CODE == IOR && exact_log2 (INTVAL (RTX)) >= 0 \
|| OUTER_CODE == AND && exact_log2 (~INTVAL (RTX)) >= 0 \
|| ((OUTER_CODE == PLUS || OUTER_CODE == MINUS) \
&& (unsigned int) (INTVAL (RTX) + 15) < 31) \
|| (OUTER_CODE == SET && (unsigned int) INTVAL (RTX) < 16))\
return 0; \
return ((unsigned)(INTVAL(RTX) + 0x8000) < 0x10000 || (INTVAL (RTX) & 0xffff0000) == 0) ? 0 : COSTS_N_INSNS (2);\
case CONST: \
case LABEL_REF: \
case SYMBOL_REF: \
case CONST_DOUBLE: \
if (current_function_operand (RTX, Pmode)) return 0; \
return COSTS_N_INSNS (2);
case CONST_DOUBLE: \
if ((RTX) == CONST0_RTX (GET_MODE (RTX))) return 2; \
return (GET_MODE_CLASS (GET_MODE (RTX)) == MODE_FLOAT) ? COSTS_N_INSNS (5) : COSTS_N_INSNS (4);
/* Provide the costs of a rtl expression. This is in the body of a
switch on CODE.
@ -1245,11 +1255,12 @@ struct rt_cargs {int gregs, fregs; };
References to our own data area are really references to r14, so they
are very cheap. Multiples and divides are very expensive. */
#define RTX_COSTS(X,CODE) \
#define RTX_COSTS(X,CODE,OUTER_CODE) \
case MEM: \
return current_function_operand (X, Pmode) ? 0 : COSTS_N_INSNS (2); \
case MULT: \
return TARGET_IN_LINE_MUL ? COSTS_N_INSNS (19) : COSTS_N_INSNS (25); \
return (TARGET_IN_LINE_MUL && GET_MODE_CLASS (GET_MODE (X)) == MODE_INT)\
? COSTS_N_INSNS (19) : COSTS_N_INSNS (25); \
case DIV: \
case UDIV: \
case MOD: \

View File

@ -1200,7 +1200,7 @@ struct rs6000_args {int words, fregno, nargs_prototype; };
On the RS/6000, if it is legal in the insn, it is free. So this
always returns 0. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
case CONST: \
case LABEL_REF: \
@ -1211,7 +1211,7 @@ struct rs6000_args {int words, fregno, nargs_prototype; };
/* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. */
#define RTX_COSTS(X,CODE) \
#define RTX_COSTS(X,CODE,OUTER_CODE) \
case MULT: \
return (GET_CODE (XEXP (X, 1)) != CONST_INT \
? COSTS_N_INSNS (5) \

View File

@ -1281,7 +1281,7 @@ extern struct rtx_def *legitimize_pic_address ();
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
if (INTVAL (RTX) == 0) \
return 0; \
@ -1322,7 +1322,7 @@ extern struct rtx_def *legitimize_pic_address ();
If we need more than 12 insns to do a multiply, then go out-of-line,
since the call overhead will be < 10% of the cost of the multiply. */
#define RTX_COSTS(X,CODE) \
#define RTX_COSTS(X,CODE,OUTER_CODE) \
case MULT: \
return COSTS_N_INSNS (25); \
case DIV: \

View File

@ -647,7 +647,7 @@ enum reg_class {NO_REGS,GENERAL_REGS,FPP_REG,ALL_REGS,LIM_REG_CLASSES};
/* specify the costs of various sorts of constants,
and also indicate that multiplication is cheap on this machine. */
#define CONST_COSTS(RTX,CODE) \
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
/* Constant zero is super cheap due to clr instruction. */ \
if (RTX == const0_rtx) return 0; \

View File

@ -835,32 +835,39 @@ gen_rtx (PLUS, Pmode, frame, gen_rtx (CONST_INT, VOIDmode, 12))
of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */
#define CONST_COSTS(RTX,CODE) \
/* On a VAX, constants from 0..63 are cheap because they can use the
1 byte literal constant format. compare to -1 should be made cheap
so that decrement-and-branch insns can be formed more easily (if
the value -1 is copied to a register some decrement-and-branch patterns
will not match). */
#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \
/* Constant zero is super cheap due to clr instruction. */ \
if ((RTX) == const0_rtx) return 0; \
/* Constants of +/- 1 should also be super cheap since \
may be used in decl/incl/aob/sob insns. */ \
if ((RTX) == const1_rtx || (RTX) == constm1_rtx) return 0; \
if ((unsigned) INTVAL (RTX) < 077) return 1; \
if (INTVAL (RTX) == 0) return 0; \
if (OUTER_CODE == AND) \
return ((unsigned) ~INTVAL (RTX) <= 077) ? 1 : 2; \
if ((unsigned) INTVAL (RTX) <= 077) return 1; \
if (OUTER_CODE == COMPARE && INTVAL (RTX) == -1) return 1; \
if (OUTER_CODE == PLUS && (unsigned) -INTVAL (RTX) <= 077) return 1;\
case CONST: \
case LABEL_REF: \
case SYMBOL_REF: \
return 3; \
case CONST_DOUBLE: \
return 5;
if (GET_MODE_CLASS (GET_MODE (RTX)) == MODE_FLOAT) \
return vax_float_literal (RTX) ? 5 : 8; \
else return \
(CONST_DOUBLE_HIGH (RTX) == 0 && (unsigned)CONST_DOUBLE_LOW (RTX) < 64 \
|| OUTER_CODE == PLUS && CONST_DOUBLE_HIGH (RTX) == -1 && (unsigned)-CONST_DOUBLE_LOW (RTX) < 64) ? 2 : 5;
/* On most VAX models, shift are almost as expensive as multiplies, so
we'd rather use multiply unless it can be done in an extremely small
sequence. */
#define RTX_COSTS(RTX,CODE) \
case LSHIFT: \
case ASHIFT: \
case ASHIFTRT: \
case LSHIFTRT: \
case ROTATE: \
case ROTATERT: \
return COSTS_N_INSNS (4);
#define RTX_COSTS(RTX,CODE,OUTER_CODE) case FIX: case FLOAT: \
case MULT: case DIV: case UDIV: case MOD: case UMOD: \
case LSHIFT: case ASHIFT: case LSHIFTRT: case ASHIFTRT: \
case ROTATE: case ROTATERT: case PLUS: case MINUS: case IOR: \
case XOR: case AND: case NEG: case NOT: case ZERO_EXTRACT: \
case SIGN_EXTRACT: case MEM: return vax_rtx_cost(RTX)
#define ADDRESS_COST(RTX) (1 + (GET_CODE (RTX) == REG ? 0 : vax_address_cost(RTX)))
/* Specify the cost of a branch insn; roughly the number of extra insns that
should be added to avoid a branch.

View File

@ -299,7 +299,7 @@ init_loop ()
rtx lea;
int i;
add_cost = rtx_cost (gen_rtx (PLUS, SImode, reg, reg));
add_cost = rtx_cost (gen_rtx (PLUS, SImode, reg, reg), SET);
/* We multiply by 2 to reconcile the difference in scale between
these two ways of computing costs. Otherwise the cost of a copy
@ -4796,7 +4796,7 @@ general_induction_var (x, src_reg, add_val, mult_val)
if (GET_CODE (*mult_val) == USE)
*mult_val = XEXP (*mult_val, 0);
benefit += rtx_cost (orig_x);
benefit += rtx_cost (orig_x, SET);
/* Always return some benefit if this is a giv so it will be detected
as such. This allows elimination of bivs that might otherwise