diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-30 14:19:01 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-30 14:19:01 +0000 |
commit | 4a9d7ef7b86df2903330f57af9e3813c57d750e9 (patch) | |
tree | 4339e3edb706d886f8df2cbbc9a8fe530f969a60 /gcc/config | |
parent | 1cf539a295d9d25f380ac308e00d196410534da7 (diff) | |
download | gcc-4a9d7ef7b86df2903330f57af9e3813c57d750e9.tar.gz |
* optabs.c (expand_abs_nojump): Update BRANCH_COST call.
* fold-cost.c (LOGICAL_OP_NON_SHORT_CIRCUIT, fold_truthop): Likewise.
* dojump.c (do_jump): Likewise.
* ifcvt.c (MAX_CONDITIONAL_EXECUTE): Likewise.
(note-if_info): Add BRANCH_COST.
(noce_try_store_flag_constants, noce_try_addcc, noce_try_store_flag_mask,
noce_try_cmove_arith, noce_try_cmove_arith, noce_try_cmove_arith,
noce_find_if_block, find_if_case_1, find_if_case_2): Use compuated
branch cost.
* expr.h (BRANCH_COST): Update default.
* predict.c (predictable_edge_p): New function.
* expmed.c (expand_smod_pow2, expand_sdiv_pow2, emit_store_flag):
Update BRANCH_COST call.
* basic-block.h (predictable_edge_p): Declare.
* config/alpha/alpha.h (BRANCH_COST): Update.
* config/frv/frv.h (BRANCH_COST): Update.
* config/s390/s390.h (BRANCH_COST): Update.
* config/spu/spu.h (BRANCH_COST): Update.
* config/sparc/sparc.h (BRANCH_COST): Update.
* config/m32r/m32r.h (BRANCH_COST): Update.
* config/i386/i386.h (BRANCH_COST): Update.
* config/i386/i386.c (ix86_expand_int_movcc): Update use of BRANCH_COST.
* config/sh/sh.h (BRANCH_COST): Update.
* config/pdp11/pdp11.h (BRANCH_COST): Update.
* config/avr/avr.h (BRANCH_COST): Update.
* config/crx/crx.h (BRANCH_COST): Update.
* config/xtensa/xtensa.h (BRANCH_COST): Update.
* config/stormy16/stormy16.h (BRANCH_COST): Update.
* config/m68hc11/m68hc11.h (BRANCH_COST): Update.
* config/iq2000/iq2000.h (BRANCH_COST): Update.
* config/ia64/ia64.h (BRANCH_COST): Update.
* config/rs6000/rs6000.h (BRANCH_COST): Update.
* config/arc/arc.h (BRANCH_COST): Update.
* config/score/score.h (BRANCH_COST): Update.
* config/arm/arm.h (BRANCH_COST): Update.
* config/pa/pa.h (BRANCH_COST): Update.
* config/mips/mips.h (BRANCH_COST): Update.
* config/vax/vax.h (BRANCH_COST): Update.
* config/h8300/h8300.h (BRANCH_COST): Update.
* params.def (PARAM_PREDICTABLE_BRANCH_OUTCOME): New.
* doc/invoke.texi (predictable-branch-cost-outcome): Document.
* doc/tm.texi (BRANCH_COST): Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139804 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/alpha/alpha.h | 2 | ||||
-rw-r--r-- | gcc/config/arc/arc.h | 2 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 2 | ||||
-rw-r--r-- | gcc/config/avr/avr.h | 2 | ||||
-rw-r--r-- | gcc/config/crx/crx.h | 2 | ||||
-rw-r--r-- | gcc/config/frv/frv.h | 2 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.h | 2 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 5 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 3 | ||||
-rw-r--r-- | gcc/config/ia64/ia64.h | 2 | ||||
-rw-r--r-- | gcc/config/iq2000/iq2000.h | 2 | ||||
-rw-r--r-- | gcc/config/m32r/m32r.h | 2 | ||||
-rw-r--r-- | gcc/config/m68hc11/m68hc11.h | 2 | ||||
-rw-r--r-- | gcc/config/mips/mips.h | 2 | ||||
-rw-r--r-- | gcc/config/pa/pa.h | 2 | ||||
-rw-r--r-- | gcc/config/pdp11/pdp11.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.h | 2 | ||||
-rw-r--r-- | gcc/config/s390/s390.h | 2 | ||||
-rw-r--r-- | gcc/config/score/score.h | 2 | ||||
-rw-r--r-- | gcc/config/sh/sh.h | 3 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.h | 2 | ||||
-rw-r--r-- | gcc/config/spu/spu.h | 2 | ||||
-rw-r--r-- | gcc/config/stormy16/stormy16.h | 2 | ||||
-rw-r--r-- | gcc/config/vax/vax.h | 2 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.h | 2 |
25 files changed, 29 insertions, 26 deletions
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 4336e6c9357..8e022d6a5f8 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -640,7 +640,7 @@ extern int alpha_memory_latency; #define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) /* Provide the cost of a branch. Exact meaning under development. */ -#define BRANCH_COST 5 +#define BRANCH_COST(speed_p, predictable_p) 5 /* Stack layout; function entry, exit and calling. */ diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index ea40fb23ab7..ff473c3f73e 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -824,7 +824,7 @@ arc_select_cc_mode (OP, X, Y) /* The cost of a branch insn. */ /* ??? What's the right value here? Branches are certainly more expensive than reg->reg moves. */ -#define BRANCH_COST 2 +#define BRANCH_COST(speed_p, predictable_p) 2 /* Nonzero if access to memory by bytes is slow and undesirable. For RISC chips, it means that access to memory by bytes is no diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 2f236e02442..4132b06b024 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2297,7 +2297,7 @@ do { \ /* Try to generate sequences that don't involve branches, we can then use conditional instructions */ -#define BRANCH_COST \ +#define BRANCH_COST(speed_p, predictable_p) \ (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) /* Position Independent Code. */ diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index b5132e26313..74409851805 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -511,7 +511,7 @@ do { \ (MODE)==SImode ? 8 : \ (MODE)==SFmode ? 8 : 16) -#define BRANCH_COST 0 +#define BRANCH_COST(speed_p, predictable_p) 0 #define SLOW_BYTE_ACCESS 0 diff --git a/gcc/config/crx/crx.h b/gcc/config/crx/crx.h index c3e1e203113..91c5f31d1e1 100644 --- a/gcc/config/crx/crx.h +++ b/gcc/config/crx/crx.h @@ -420,7 +420,7 @@ struct cumulative_args /* Moving to processor register flushes pipeline - thus asymmetric */ #define REGISTER_MOVE_COST(MODE, FROM, TO) ((TO != GENERAL_REGS) ? 8 : 2) /* Assume best case (branch predicted) */ -#define BRANCH_COST 2 +#define BRANCH_COST(speed_p, predictable_p) 2 #define SLOW_BYTE_ACCESS 1 diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index 6c86ef569f2..8a71337fcc1 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -2193,7 +2193,7 @@ do { \ /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ -#define BRANCH_COST frv_branch_cost_int +#define BRANCH_COST(speed_p, predictable_p) frv_branch_cost_int /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no faster than accessing a diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 5ed4205dcd3..7305fc32f85 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -1004,7 +1004,7 @@ struct cum_arg #define DELAY_SLOT_LENGTH(JUMP) \ (NEXT_INSN (PREV_INSN (JUMP)) == JUMP ? 0 : 2) -#define BRANCH_COST 0 +#define BRANCH_COST(speed_p, predictable_p) 0 /* Tell final.c how to eliminate redundant test instructions. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9ef95b503ec..002a9a7e2a0 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -14636,7 +14636,8 @@ ix86_expand_int_movcc (rtx operands[]) */ if ((!TARGET_CMOVE || (mode == QImode && TARGET_PARTIAL_REG_STALL)) - && BRANCH_COST >= 2) + && BRANCH_COST (optimize_insn_for_speed_p (), + false) >= 2) { if (cf == 0) { @@ -14721,7 +14722,7 @@ ix86_expand_int_movcc (rtx operands[]) optab op; rtx var, orig_out, out, tmp; - if (BRANCH_COST <= 2) + if (BRANCH_COST (optimize_insn_for_speed_p (), false) <= 2) return 0; /* FAIL */ /* If one of the two operands is an interesting constant, load a diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 7ad70694242..d933c5e2389 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1975,7 +1975,8 @@ do { \ /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ -#define BRANCH_COST ix86_branch_cost +#define BRANCH_COST(speed_p, predictable_p) \ + (!(speed_p) ? 2 : (predictable_p) ? 0 : ix86_branch_cost) /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 6fca6902408..e97bcf6e934 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1384,7 +1384,7 @@ do { \ many additional insn groups we run into, vs how good the dynamic branch predictor is. */ -#define BRANCH_COST 6 +#define BRANCH_COST(speed_p, predictable_p) 6 /* Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e. a `char' or a `short') is no faster than accessing a diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index f09a9f7bf2a..f6c7ec5edb6 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -624,7 +624,7 @@ typedef struct iq2000_args #define MEMORY_MOVE_COST(MODE,CLASS,TO_P) \ (TO_P ? 2 : 16) -#define BRANCH_COST 2 +#define BRANCH_COST(speed_p, predictable_p) 2 #define SLOW_BYTE_ACCESS 1 diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 33fe7e0666a..f2f7e891201 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1224,7 +1224,7 @@ L2: .word STATIC /* A value of 2 here causes GCC to avoid using branches in comparisons like while (a < N && a). Branches aren't that expensive on the M32R so we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */ -#define BRANCH_COST ((TARGET_BRANCH_COST) ? 2 : 1) +#define BRANCH_COST(speed_p, predictable_p) ((TARGET_BRANCH_COST) ? 2 : 1) /* Nonzero if access to memory by bytes is slow and undesirable. For RISC chips, it means that access to memory by bytes is no diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 7034c93b30e..cae57e3a9fe 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1266,7 +1266,7 @@ extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER]; Pretend branches are cheap because GCC generates sub-optimal code for the default value. */ -#define BRANCH_COST 0 +#define BRANCH_COST(speed_p, predictable_p) 0 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 0 diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 66788c17e6e..e008e804781 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -2557,7 +2557,7 @@ typedef struct mips_args { /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ -#define BRANCH_COST mips_branch_cost +#define BRANCH_COST(speed_p, predictable_p) mips_branch_cost #define LOGICAL_OP_NON_SHORT_CIRCUIT 0 /* If defined, modifies the length assigned to instruction INSN as a diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 610bcf5da3c..5e272a2f346 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1570,7 +1570,7 @@ do { \ : 2) /* Adjust the cost of branches. */ -#define BRANCH_COST (pa_cpu == PROCESSOR_8000 ? 2 : 1) +#define BRANCH_COST(speed_p, predictable_p) (pa_cpu == PROCESSOR_8000 ? 2 : 1) /* Handling the special cases is going to get too complicated for a macro, just call `pa_adjust_insn_length' to do the real work. */ diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index 662886cf8db..e572d6cf9c3 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -1057,7 +1057,7 @@ JMP FUNCTION 0x0058 0x0000 <- FUNCTION /* there is no point in avoiding branches on a pdp, since branches are really cheap - I just want to find out how much difference the BRANCH_COST macro makes in code */ -#define BRANCH_COST (TARGET_BRANCH_CHEAP ? 0 : 1) +#define BRANCH_COST(speed_p, predictable_p) (TARGET_BRANCH_CHEAP ? 0 : 1) #define COMPARE_FLAG_MODE HImode diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 048d163ff14..2d5bbff39ab 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -967,7 +967,7 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; Set this to 3 on the RS/6000 since that is roughly the average cost of an unscheduled conditional branch. */ -#define BRANCH_COST 3 +#define BRANCH_COST(speed_p, predictable_p) 3 /* Override BRANCH_COST heuristic which empirically produces worse performance for removing short circuiting from the logical ops. */ diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index b96f10026e7..a31efd24a23 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -828,7 +828,7 @@ extern struct rtx_def *s390_compare_op0, *s390_compare_op1, *s390_compare_emitte /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ -#define BRANCH_COST 1 +#define BRANCH_COST(speed_p, predictable_p) 1 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 1 diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h index d400f6ab0ce..d9900a50214 100644 --- a/gcc/config/score/score.h +++ b/gcc/config/score/score.h @@ -793,7 +793,7 @@ typedef struct score_args (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P))) /* Try to generate sequences that don't involve branches. */ -#define BRANCH_COST 2 +#define BRANCH_COST(speed_p, predictable_p) 2 /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 1 diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 47ecfc494da..15bc744fd1d 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2847,7 +2847,8 @@ struct sh_args { The SH1 does not have delay slots, hence we get a pipeline stall at every branch. The SH4 is superscalar, so the single delay slot is not sufficient to keep both pipelines filled. */ -#define BRANCH_COST (TARGET_SH5 ? 1 : ! TARGET_SH2 || TARGET_HARD_SH4 ? 2 : 1) +#define BRANCH_COST(speed_p, predictable_p) \ + (TARGET_SH5 ? 1 : ! TARGET_SH2 || TARGET_HARD_SH4 ? 2 : 1) /* Assembler output control. */ diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 42894705361..de5f52089a3 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2196,7 +2196,7 @@ do { \ On Niagara-2, a not-taken branch costs 1 cycle whereas a taken branch costs 6 cycles. */ -#define BRANCH_COST \ +#define BRANCH_COST (speed_p, predictable_p) \ ((sparc_cpu == PROCESSOR_V9 \ || sparc_cpu == PROCESSOR_ULTRASPARC) \ ? 7 \ diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h index b27e9b7b12e..f78eb73c429 100644 --- a/gcc/config/spu/spu.h +++ b/gcc/config/spu/spu.h @@ -434,7 +434,7 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \ /* Costs */ -#define BRANCH_COST spu_branch_cost +#define BRANCH_COST(speed_p, predictable_p) spu_branch_cost #define SLOW_BYTE_ACCESS 0 diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index 4cd4084a2bb..005108de349 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -587,7 +587,7 @@ do { \ #define MEMORY_MOVE_COST(M,C,I) (5 + memory_move_secondary_cost (M, C, I)) -#define BRANCH_COST 5 +#define BRANCH_COST(speed_p, predictable_p) 5 #define SLOW_BYTE_ACCESS 0 diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index 84a6ba4bd1a..20d781bf27e 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -648,7 +648,7 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; Branches are extremely cheap on the VAX while the shift insns often used to replace branches can be expensive. */ -#define BRANCH_COST 0 +#define BRANCH_COST(speed_p, predictable_p) 0 /* Tell final.c how to eliminate redundant test instructions. */ diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 1c23b8d568c..fecb56996e3 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -887,7 +887,7 @@ typedef struct xtensa_args #define MEMORY_MOVE_COST(MODE, CLASS, IN) 4 -#define BRANCH_COST 3 +#define BRANCH_COST(speed_p, predictable_p) 3 /* How to refer to registers in assembler output. This sequence is indexed by compiler's hard-register-number (see above). */ |