Commit 3bb22aee by Richard Stallman

*** empty log message ***

From-SVN: r783
parent d3797078
...@@ -1221,7 +1221,7 @@ extern char *a29k_function_name; ...@@ -1221,7 +1221,7 @@ extern char *a29k_function_name;
instruction are those involving floating-point or address. So instruction are those involving floating-point or address. So
only these need be expensive. */ only these need be expensive. */
#define CONST_COSTS(RTX,CODE) \ #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \ case CONST_INT: \
return 0; \ return 0; \
case CONST: \ case CONST: \
...@@ -1239,7 +1239,7 @@ extern char *a29k_function_name; ...@@ -1239,7 +1239,7 @@ extern char *a29k_function_name;
The multiply cost depends on whether this is a 29050 or not. */ 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: \ case MULT: \
return TARGET_29050 ? COSTS_N_INSNS (2) : COSTS_N_INSNS (40); \ return TARGET_29050 ? COSTS_N_INSNS (2) : COSTS_N_INSNS (40); \
case DIV: \ case DIV: \
......
...@@ -751,7 +751,7 @@ enum reg_class { ...@@ -751,7 +751,7 @@ enum reg_class {
of a switch statement. If the code is computed here, of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */ 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 CONST: \
case LABEL_REF: \ case LABEL_REF: \
case SYMBOL_REF: \ case SYMBOL_REF: \
...@@ -764,7 +764,7 @@ enum reg_class { ...@@ -764,7 +764,7 @@ enum reg_class {
switch on CODE. switch on CODE.
On C1 and C2, multiply is faster than shift. */ On C1 and C2, multiply is faster than shift. */
#define RTX_COSTS(RTX,CODE) \ #define RTX_COSTS(RTX,CODE,OUTER_CODE) \
case MULT: \ case MULT: \
total = COSTS_N_INSNS (4); \ total = COSTS_N_INSNS (4); \
break; \ break; \
......
...@@ -1093,14 +1093,18 @@ while (0) ...@@ -1093,14 +1093,18 @@ while (0)
/* Provide the costs of a rtl expression. This is in the body of a /* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. */ switch on CODE. */
#define RTX_COSTS(X,CODE) \ #define RTX_COSTS(X,CODE,OUTER_CODE) \
case MULT: \ case MULT: \
return COSTS_N_INSNS (10); \ return COSTS_N_INSNS (10); \
case DIV: \ case DIV: \
case UDIV: \ case UDIV: \
case MOD: \ case MOD: \
case UMOD: \ 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 /* Compute the cost of computing a constant rtl expression RTX
...@@ -1108,7 +1112,7 @@ while (0) ...@@ -1108,7 +1112,7 @@ while (0)
of a switch statement. If the code is computed here, of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */ 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_INT: \
case CONST: \ case CONST: \
case LABEL_REF: \ case LABEL_REF: \
...@@ -1120,11 +1124,7 @@ while (0) ...@@ -1120,11 +1124,7 @@ while (0)
return code == 1 ? 0 : \ return code == 1 ? 0 : \
code == 2 ? 1 : \ code == 2 ? 1 : \
2; \ 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 /* 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 and/or execution delay of an insn using that address. If the cost is
......
...@@ -1285,7 +1285,7 @@ __transfer_from_trampoline () \ ...@@ -1285,7 +1285,7 @@ __transfer_from_trampoline () \
of a switch statement. If the code is computed here, of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */ 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_INT: \
/* Constant zero is super cheap due to clr instruction. */ \ /* Constant zero is super cheap due to clr instruction. */ \
if (RTX == const0_rtx) return 0; \ if (RTX == const0_rtx) return 0; \
...@@ -1293,7 +1293,8 @@ __transfer_from_trampoline () \ ...@@ -1293,7 +1293,8 @@ __transfer_from_trampoline () \
if (INTVAL (RTX) >= -128 && INTVAL (RTX) <= 127) return 1; \ if (INTVAL (RTX) >= -128 && INTVAL (RTX) <= 127) return 1; \
/* Constants between -136 and 254 are easily generated */ \ /* Constants between -136 and 254 are easily generated */ \
/* by intelligent uses of moveq, add[q], and subq */ \ /* 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 CONST: \
case LABEL_REF: \ case LABEL_REF: \
case SYMBOL_REF: \ case SYMBOL_REF: \
...@@ -1310,7 +1311,7 @@ __transfer_from_trampoline () \ ...@@ -1310,7 +1311,7 @@ __transfer_from_trampoline () \
#define MULL_COST (TARGET_68040 ? 5 : 13) #define MULL_COST (TARGET_68040 ? 5 : 13)
#define MULW_COST (TARGET_68040 ? 3 : 8) #define MULW_COST (TARGET_68040 ? 3 : 8)
#define RTX_COSTS(X,CODE) \ #define RTX_COSTS(X,CODE,OUTER_CODE) \
case PLUS: \ case PLUS: \
/* An lea costs about three times as much as a simple add. */ \ /* An lea costs about three times as much as a simple add. */ \
if (GET_MODE (X) == SImode \ if (GET_MODE (X) == SImode \
......
...@@ -1482,7 +1482,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, ...@@ -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 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 won't do anything in cse, but it will cause expand_binop to pass the
constant to the define_expands). */ constant to the define_expands). */
#define CONST_COSTS(RTX,CODE) \ #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \ case CONST_INT: \
if (SMALL_INT (RTX)) \ if (SMALL_INT (RTX)) \
return 0; \ return 0; \
...@@ -1516,7 +1516,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, ...@@ -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 /* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. */ switch on CODE. */
#define RTX_COSTS(X,CODE) \ #define RTX_COSTS(X,CODE,OUTER_CODE) \
case MEM: \ case MEM: \
return COSTS_N_INSNS (2); \ return COSTS_N_INSNS (2); \
case MULT: \ case MULT: \
......
...@@ -999,7 +999,7 @@ __transfer_from_trampoline () \ ...@@ -999,7 +999,7 @@ __transfer_from_trampoline () \
of a switch statement. If the code is computed here, of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */ 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_INT: \
if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \ if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \
if (INTVAL (RTX) < 0x4000 && INTVAL (RTX) >= -0x4000) \ if (INTVAL (RTX) < 0x4000 && INTVAL (RTX) >= -0x4000) \
......
...@@ -1030,7 +1030,7 @@ extern int current_function_calls_alloca; ...@@ -1030,7 +1030,7 @@ extern int current_function_calls_alloca;
of a switch statement. If the code is computed here, of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */ 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_INT: \
if (CONST_OK_FOR_LETTER_P (INTVAL (RTX),'I')) return 0; \ if (CONST_OK_FOR_LETTER_P (INTVAL (RTX),'I')) return 0; \
case CONST: \ case CONST: \
......
...@@ -1225,19 +1225,29 @@ struct rt_cargs {int gregs, fregs; }; ...@@ -1225,19 +1225,29 @@ struct rt_cargs {int gregs, fregs; };
few bits. */ few bits. */
#define SHIFT_COUNT_TRUNCATED #define SHIFT_COUNT_TRUNCATED
/* Compute the cost of computing a constant rtl expression RTX /* Compute the cost of computing a constant rtl expression RTX whose
whose rtx-code is CODE. The body of this macro is a portion rtx-code is CODE, contained within an expression of code OUTER_CODE.
of a switch statement. If the code is computed here, The body of this macro is a portion of a switch statement. If the
return it with a return statement. Otherwise, break from the switch. */ 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_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 CONST: \
case LABEL_REF: \ case LABEL_REF: \
case SYMBOL_REF: \ case SYMBOL_REF: \
case CONST_DOUBLE: \ if (current_function_operand (RTX, Pmode)) return 0; \
return COSTS_N_INSNS (2); 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 /* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. switch on CODE.
...@@ -1245,11 +1255,12 @@ struct rt_cargs {int gregs, fregs; }; ...@@ -1245,11 +1255,12 @@ struct rt_cargs {int gregs, fregs; };
References to our own data area are really references to r14, so they References to our own data area are really references to r14, so they
are very cheap. Multiples and divides are very expensive. */ are very cheap. Multiples and divides are very expensive. */
#define RTX_COSTS(X,CODE) \ #define RTX_COSTS(X,CODE,OUTER_CODE) \
case MEM: \ case MEM: \
return current_function_operand (X, Pmode) ? 0 : COSTS_N_INSNS (2); \ return current_function_operand (X, Pmode) ? 0 : COSTS_N_INSNS (2); \
case MULT: \ 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 DIV: \
case UDIV: \ case UDIV: \
case MOD: \ case MOD: \
......
...@@ -1200,7 +1200,7 @@ struct rs6000_args {int words, fregno, nargs_prototype; }; ...@@ -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 On the RS/6000, if it is legal in the insn, it is free. So this
always returns 0. */ always returns 0. */
#define CONST_COSTS(RTX,CODE) \ #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
case CONST_INT: \ case CONST_INT: \
case CONST: \ case CONST: \
case LABEL_REF: \ case LABEL_REF: \
...@@ -1211,7 +1211,7 @@ struct rs6000_args {int words, fregno, nargs_prototype; }; ...@@ -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 /* Provide the costs of a rtl expression. This is in the body of a
switch on CODE. */ switch on CODE. */
#define RTX_COSTS(X,CODE) \ #define RTX_COSTS(X,CODE,OUTER_CODE) \
case MULT: \ case MULT: \
return (GET_CODE (XEXP (X, 1)) != CONST_INT \ return (GET_CODE (XEXP (X, 1)) != CONST_INT \
? COSTS_N_INSNS (5) \ ? COSTS_N_INSNS (5) \
......
...@@ -1281,7 +1281,7 @@ extern struct rtx_def *legitimize_pic_address (); ...@@ -1281,7 +1281,7 @@ extern struct rtx_def *legitimize_pic_address ();
of a switch statement. If the code is computed here, of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */ 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_INT: \
if (INTVAL (RTX) == 0) \ if (INTVAL (RTX) == 0) \
return 0; \ return 0; \
...@@ -1322,7 +1322,7 @@ extern struct rtx_def *legitimize_pic_address (); ...@@ -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, 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. */ 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: \ case MULT: \
return COSTS_N_INSNS (25); \ return COSTS_N_INSNS (25); \
case DIV: \ case DIV: \
......
...@@ -647,7 +647,7 @@ enum reg_class {NO_REGS,GENERAL_REGS,FPP_REG,ALL_REGS,LIM_REG_CLASSES}; ...@@ -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, /* specify the costs of various sorts of constants,
and also indicate that multiplication is cheap on this machine. */ 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: \ case CONST_INT: \
/* Constant zero is super cheap due to clr instruction. */ \ /* Constant zero is super cheap due to clr instruction. */ \
if (RTX == const0_rtx) return 0; \ if (RTX == const0_rtx) return 0; \
......
...@@ -835,32 +835,39 @@ gen_rtx (PLUS, Pmode, frame, gen_rtx (CONST_INT, VOIDmode, 12)) ...@@ -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, of a switch statement. If the code is computed here,
return it with a return statement. Otherwise, break from the switch. */ 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: \ case CONST_INT: \
/* Constant zero is super cheap due to clr instruction. */ \ if (INTVAL (RTX) == 0) return 0; \
if ((RTX) == const0_rtx) return 0; \ if (OUTER_CODE == AND) \
/* Constants of +/- 1 should also be super cheap since \ return ((unsigned) ~INTVAL (RTX) <= 077) ? 1 : 2; \
may be used in decl/incl/aob/sob insns. */ \ if ((unsigned) INTVAL (RTX) <= 077) return 1; \
if ((RTX) == const1_rtx || (RTX) == constm1_rtx) return 0; \ if (OUTER_CODE == COMPARE && INTVAL (RTX) == -1) return 1; \
if ((unsigned) INTVAL (RTX) < 077) return 1; \ if (OUTER_CODE == PLUS && (unsigned) -INTVAL (RTX) <= 077) return 1;\
case CONST: \ case CONST: \
case LABEL_REF: \ case LABEL_REF: \
case SYMBOL_REF: \ case SYMBOL_REF: \
return 3; \ return 3; \
case CONST_DOUBLE: \ case CONST_DOUBLE: \
return 5; if (GET_MODE_CLASS (GET_MODE (RTX)) == MODE_FLOAT) \
return vax_float_literal (RTX) ? 5 : 8; \
/* On most VAX models, shift are almost as expensive as multiplies, so else return \
we'd rather use multiply unless it can be done in an extremely small (CONST_DOUBLE_HIGH (RTX) == 0 && (unsigned)CONST_DOUBLE_LOW (RTX) < 64 \
sequence. */ || OUTER_CODE == PLUS && CONST_DOUBLE_HIGH (RTX) == -1 && (unsigned)-CONST_DOUBLE_LOW (RTX) < 64) ? 2 : 5;
#define RTX_COSTS(RTX,CODE) \
case LSHIFT: \ #define RTX_COSTS(RTX,CODE,OUTER_CODE) case FIX: case FLOAT: \
case ASHIFT: \ case MULT: case DIV: case UDIV: case MOD: case UMOD: \
case ASHIFTRT: \ case LSHIFT: case ASHIFT: case LSHIFTRT: case ASHIFTRT: \
case LSHIFTRT: \ case ROTATE: case ROTATERT: case PLUS: case MINUS: case IOR: \
case ROTATE: \ case XOR: case AND: case NEG: case NOT: case ZERO_EXTRACT: \
case ROTATERT: \ case SIGN_EXTRACT: case MEM: return vax_rtx_cost(RTX)
return COSTS_N_INSNS (4);
#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 /* Specify the cost of a branch insn; roughly the number of extra insns that
should be added to avoid a branch. should be added to avoid a branch.
......
...@@ -299,7 +299,7 @@ init_loop () ...@@ -299,7 +299,7 @@ init_loop ()
rtx lea; rtx lea;
int i; 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 /* We multiply by 2 to reconcile the difference in scale between
these two ways of computing costs. Otherwise the cost of a copy 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) ...@@ -4796,7 +4796,7 @@ general_induction_var (x, src_reg, add_val, mult_val)
if (GET_CODE (*mult_val) == USE) if (GET_CODE (*mult_val) == USE)
*mult_val = XEXP (*mult_val, 0); *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 /* Always return some benefit if this is a giv so it will be detected
as such. This allows elimination of bivs that might otherwise as such. This allows elimination of bivs that might otherwise
......
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