expmed.c (store_bit_field_1): Be prepared for movstrict expander to fail.
* expmed.c (store_bit_field_1): Be prepared for movstrict expander to fail. * predict.c (always_optimize_for_size_p): Rename to ... (optimize_function_for_size): ... this one; make extern. (optimize_function_for_speed_p): New. (optimize_bb_for_size_p, optimize_bb_for_size_p, optimize_edge_for_size_p,optimize_edge_for_size_p, optimize_insn_for_size_p, optimize_insn_for_size_p): Update. * basic-block.h (optimize_function_for_size_p, optimize_function_for_speed_p): Declare. * i386.md (optimize_size checks): Replace them by appropriate predicate. (standard_80387_constant_p, ix86_compute_frame_layout, ix86_expand_epilogue, ix86_decompose_address, print_operand, emit_i387_cw_initialization, inline_memory_move_cost, ix86_pad_returns, ix86_reorg): Replace optimize_size checks. From-SVN: r139737
This commit is contained in:
parent
eef302d277
commit
3debdc1e9d
7 changed files with 319 additions and 251 deletions
|
@ -1,3 +1,21 @@
|
|||
2008-08-28 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* expmed.c (store_bit_field_1): Be prepared for movstrict expander to fail.
|
||||
* predict.c (always_optimize_for_size_p): Rename to ...
|
||||
(optimize_function_for_size): ... this one; make extern.
|
||||
(optimize_function_for_speed_p): New.
|
||||
(optimize_bb_for_size_p, optimize_bb_for_size_p,
|
||||
optimize_edge_for_size_p,optimize_edge_for_size_p,
|
||||
optimize_insn_for_size_p, optimize_insn_for_size_p): Update.
|
||||
* basic-block.h (optimize_function_for_size_p,
|
||||
optimize_function_for_speed_p): Declare.
|
||||
* i386.md (optimize_size checks): Replace them by appropriate predicate.
|
||||
(standard_80387_constant_p, ix86_compute_frame_layout,
|
||||
ix86_expand_epilogue, ix86_decompose_address,
|
||||
print_operand, emit_i387_cw_initialization,
|
||||
inline_memory_move_cost, ix86_pad_returns,
|
||||
ix86_reorg): Replace optimize_size checks.
|
||||
|
||||
2008-08-28 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
* rtl.h (simplify_subreg_regno): Declare.
|
||||
|
|
|
@ -837,6 +837,8 @@ extern bool optimize_edge_for_size_p (edge);
|
|||
extern bool optimize_edge_for_speed_p (edge);
|
||||
extern bool optimize_insn_for_size_p (void);
|
||||
extern bool optimize_insn_for_speed_p (void);
|
||||
extern bool optimize_function_for_size_p (struct function *);
|
||||
extern bool optimize_function_for_speed_p (struct function *);
|
||||
extern bool gimple_predicted_by_p (const_basic_block, enum br_predictor);
|
||||
extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
|
||||
extern void gimple_predict_edge (edge, enum br_predictor, int);
|
||||
|
|
|
@ -6843,7 +6843,7 @@ standard_80387_constant_p (rtx x)
|
|||
/* For XFmode constants, try to find a special 80387 instruction when
|
||||
optimizing for size or on those CPUs that benefit from them. */
|
||||
if (mode == XFmode
|
||||
&& (optimize_size || TARGET_EXT_80387_CONSTANTS))
|
||||
&& (optimize_function_for_size_p (cfun) || TARGET_EXT_80387_CONSTANTS))
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -7429,7 +7429,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
|
|||
Recompute the value as needed. Do not recompute when amount of registers
|
||||
didn't change as reload does multiple calls to the function and does not
|
||||
expect the decision to change within single iteration. */
|
||||
if (!optimize_size
|
||||
if (!optimize_function_for_size_p (cfun)
|
||||
&& cfun->machine->use_fast_prologue_epilogue_nregs != frame->nregs)
|
||||
{
|
||||
int count = frame->nregs;
|
||||
|
@ -8176,7 +8176,7 @@ ix86_expand_epilogue (int style)
|
|||
+ frame.nregs * UNITS_PER_WORD),
|
||||
style);
|
||||
/* If not an i386, mov & pop is faster than "leave". */
|
||||
else if (TARGET_USE_LEAVE || optimize_size
|
||||
else if (TARGET_USE_LEAVE || optimize_function_for_size_p (cfun)
|
||||
|| !cfun->machine->use_fast_prologue_epilogue)
|
||||
emit_insn ((*ix86_gen_leave) ());
|
||||
else
|
||||
|
@ -8435,8 +8435,10 @@ ix86_decompose_address (rtx addr, struct ix86_address *out)
|
|||
disp = const0_rtx;
|
||||
|
||||
/* Special case: on K6, [%esi] makes the instruction vector decoded.
|
||||
Avoid this by transforming to [%esi+0]. */
|
||||
if (TARGET_K6 && !optimize_size
|
||||
Avoid this by transforming to [%esi+0].
|
||||
Reload calls address legitimization without cfun defined, so we need
|
||||
to test cfun for being non-NULL. */
|
||||
if (TARGET_K6 && cfun && optimize_function_for_speed_p (cfun)
|
||||
&& base_reg && !index_reg && !disp
|
||||
&& REG_P (base_reg)
|
||||
&& REGNO_REG_CLASS (REGNO (base_reg)) == SIREG)
|
||||
|
@ -10736,7 +10738,8 @@ print_operand (FILE *file, rtx x, int code)
|
|||
{
|
||||
rtx x;
|
||||
|
||||
if (!optimize || optimize_size || !TARGET_BRANCH_PREDICTION_HINTS)
|
||||
if (!optimize
|
||||
|| optimize_function_for_size_p (cfun) || !TARGET_BRANCH_PREDICTION_HINTS)
|
||||
return;
|
||||
|
||||
x = find_reg_note (current_output_insn, REG_BR_PROB, 0);
|
||||
|
@ -11503,7 +11506,8 @@ emit_i387_cw_initialization (int mode)
|
|||
emit_insn (gen_x86_fnstcw_1 (stored_mode));
|
||||
emit_move_insn (reg, copy_rtx (stored_mode));
|
||||
|
||||
if (TARGET_64BIT || TARGET_PARTIAL_REG_STALL || optimize_size)
|
||||
if (TARGET_64BIT || TARGET_PARTIAL_REG_STALL
|
||||
|| optimize_function_for_size_p (cfun))
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
|
@ -24914,7 +24918,8 @@ inline_memory_move_cost (enum machine_mode mode, enum reg_class regclass,
|
|||
{
|
||||
if (!in)
|
||||
return ix86_cost->int_store[0];
|
||||
if (TARGET_PARTIAL_REG_DEPENDENCY && !optimize_size)
|
||||
if (TARGET_PARTIAL_REG_DEPENDENCY
|
||||
&& optimize_function_for_speed_p (cfun))
|
||||
cost = ix86_cost->movzbl_load;
|
||||
else
|
||||
cost = ix86_cost->int_load[0];
|
||||
|
@ -26150,9 +26155,11 @@ ix86_pad_returns (void)
|
|||
static void
|
||||
ix86_reorg (void)
|
||||
{
|
||||
if (TARGET_PAD_RETURNS && optimize && !optimize_size)
|
||||
if (TARGET_PAD_RETURNS && optimize
|
||||
&& optimize_function_for_speed_p (cfun))
|
||||
ix86_pad_returns ();
|
||||
if (TARGET_FOUR_JUMP_LIMIT && optimize && !optimize_size)
|
||||
if (TARGET_FOUR_JUMP_LIMIT && optimize
|
||||
&& optimize_function_for_speed_p (cfun))
|
||||
ix86_avoid_jump_misspredicts ();
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -220,7 +220,7 @@
|
|||
}
|
||||
[(set_attr "type" "sselog1,ssemov,ssemov")
|
||||
(set (attr "mode")
|
||||
(cond [(ior (ior (ne (symbol_ref "optimize_size") (const_int 0))
|
||||
(cond [(ior (ior (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
|
||||
(eq (symbol_ref "TARGET_SSE2") (const_int 0)))
|
||||
(and (eq_attr "alternative" "2")
|
||||
(ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
|
||||
|
@ -656,7 +656,7 @@
|
|||
(match_operand:V4SF 2 "nonimmediate_operand" "")))]
|
||||
"TARGET_SSE"
|
||||
{
|
||||
if (TARGET_SSE_MATH && TARGET_RECIP && !optimize_size
|
||||
if (TARGET_SSE_MATH && TARGET_RECIP && optimize_insn_for_speed_p ()
|
||||
&& flag_finite_math_only && !flag_trapping_math
|
||||
&& flag_unsafe_math_optimizations)
|
||||
{
|
||||
|
@ -794,7 +794,7 @@
|
|||
(sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "")))]
|
||||
"TARGET_SSE"
|
||||
{
|
||||
if (TARGET_SSE_MATH && TARGET_RECIP && !optimize_size
|
||||
if (TARGET_SSE_MATH && TARGET_RECIP && optimize_insn_for_speed_p ()
|
||||
&& flag_finite_math_only && !flag_trapping_math
|
||||
&& flag_unsafe_math_optimizations)
|
||||
{
|
||||
|
|
12
gcc/expmed.c
12
gcc/expmed.c
|
@ -521,6 +521,8 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
|
|||
!= CODE_FOR_nothing))
|
||||
{
|
||||
int icode = optab_handler (movstrict_optab, fieldmode)->insn_code;
|
||||
rtx insn;
|
||||
rtx start = get_last_insn ();
|
||||
|
||||
/* Get appropriate low part of the value being stored. */
|
||||
if (GET_CODE (value) == CONST_INT || REG_P (value))
|
||||
|
@ -544,13 +546,17 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
|
|||
op0 = SUBREG_REG (op0);
|
||||
}
|
||||
|
||||
emit_insn (GEN_FCN (icode)
|
||||
insn = (GEN_FCN (icode)
|
||||
(gen_rtx_SUBREG (fieldmode, op0,
|
||||
(bitnum % BITS_PER_WORD) / BITS_PER_UNIT
|
||||
+ (offset * UNITS_PER_WORD)),
|
||||
value));
|
||||
|
||||
return true;
|
||||
if (insn)
|
||||
{
|
||||
emit_insn (insn);
|
||||
return true;
|
||||
}
|
||||
delete_insns_since (start);
|
||||
}
|
||||
|
||||
/* Handle fields bigger than a word. */
|
||||
|
|
|
@ -182,11 +182,19 @@ probably_never_executed_bb_p (const_basic_block bb)
|
|||
|
||||
/* Return true when current function should always be optimized for size. */
|
||||
|
||||
static bool
|
||||
always_optimize_for_size_p (void)
|
||||
bool
|
||||
optimize_function_for_size_p (struct function *fun)
|
||||
{
|
||||
return (optimize_size
|
||||
|| cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED);
|
||||
|| fun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED);
|
||||
}
|
||||
|
||||
/* Return true when current function should always be optimized for speed. */
|
||||
|
||||
bool
|
||||
optimize_function_for_speed_p (struct function *fun)
|
||||
{
|
||||
return !optimize_function_for_size_p (fun);
|
||||
}
|
||||
|
||||
/* Return TRUE when BB should be optimized for size. */
|
||||
|
@ -194,7 +202,7 @@ always_optimize_for_size_p (void)
|
|||
bool
|
||||
optimize_bb_for_size_p (basic_block bb)
|
||||
{
|
||||
return always_optimize_for_size_p () || !maybe_hot_bb_p (bb);
|
||||
return optimize_function_for_size_p (cfun) || !maybe_hot_bb_p (bb);
|
||||
}
|
||||
|
||||
/* Return TRUE when BB should be optimized for speed. */
|
||||
|
@ -210,7 +218,7 @@ optimize_bb_for_speed_p (basic_block bb)
|
|||
bool
|
||||
optimize_edge_for_size_p (edge e)
|
||||
{
|
||||
return always_optimize_for_size_p () || !maybe_hot_edge_p (e);
|
||||
return optimize_function_for_size_p (cfun) || !maybe_hot_edge_p (e);
|
||||
}
|
||||
|
||||
/* Return TRUE when BB should be optimized for speed. */
|
||||
|
@ -226,7 +234,7 @@ optimize_edge_for_speed_p (edge e)
|
|||
bool
|
||||
optimize_insn_for_size_p (void)
|
||||
{
|
||||
return always_optimize_for_size_p () || !crtl->maybe_hot_insn_p;
|
||||
return optimize_function_for_size_p (cfun) || !crtl->maybe_hot_insn_p;
|
||||
}
|
||||
|
||||
/* Return TRUE when BB should be optimized for speed. */
|
||||
|
|
Loading…
Add table
Reference in a new issue