aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2013-09-09 13:06:53 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2013-09-09 13:06:53 +0000
commit2f1cd2ebd65eae6d87332c0bcd5d0e840c886cf3 (patch)
tree8a0c069c9c8784f5d1a4f0ad98b31f8275795896 /gcc/expmed.c
parent4789c0cef392722e1c084eba900c0c469fba3bc1 (diff)
downloadgcc-2f1cd2ebd65eae6d87332c0bcd5d0e840c886cf3.zip
gcc-2f1cd2ebd65eae6d87332c0bcd5d0e840c886cf3.tar.gz
gcc-2f1cd2ebd65eae6d87332c0bcd5d0e840c886cf3.tar.bz2
asan.c (asan_clear_shadow): Use gen_int_mode with the mode of the associated expand_* call.
gcc/ * asan.c (asan_clear_shadow): Use gen_int_mode with the mode of the associated expand_* call. (asan_emit_stack_protection): Likewise. * builtins.c (round_trampoline_addr): Likewise. * explow.c (allocate_dynamic_stack_space, probe_stack_range): Likewise. * expmed.c (expand_smod_pow2, expand_sdiv_pow2, expand_divmod) (emit_store_flag): Likewise. * expr.c (emit_move_resolve_push, push_block, emit_single_push_insn_1) (emit_push_insn, optimize_bitfield_assignment_op, expand_expr_real_1): Likewise. * function.c (instantiate_virtual_regs_in_insn): Likewise. * ifcvt.c (noce_try_store_flag_constants): Likewise. * loop-unroll.c (unroll_loop_runtime_iterations): Likewise. * modulo-sched.c (generate_prolog_epilog): Likewise. * optabs.c (expand_binop, widen_leading, expand_doubleword_clz) (expand_ctz, expand_ffs, expand_unop): Likewise. From-SVN: r202392
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index dfaa123..f0a4837 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -3666,7 +3666,8 @@ expand_smod_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
NULL_RTX, 1, OPTAB_LIB_WIDEN);
temp = expand_binop (mode, sub_optab, temp, signmask,
NULL_RTX, 1, OPTAB_LIB_WIDEN);
- temp = expand_binop (mode, and_optab, temp, GEN_INT (masklow),
+ temp = expand_binop (mode, and_optab, temp,
+ gen_int_mode (masklow, mode),
NULL_RTX, 1, OPTAB_LIB_WIDEN);
temp = expand_binop (mode, xor_optab, temp, signmask,
NULL_RTX, 1, OPTAB_LIB_WIDEN);
@@ -3681,7 +3682,8 @@ expand_smod_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
temp = expand_binop (mode, add_optab, op0, signmask,
NULL_RTX, 1, OPTAB_LIB_WIDEN);
- temp = expand_binop (mode, and_optab, temp, GEN_INT (masklow),
+ temp = expand_binop (mode, and_optab, temp,
+ gen_int_mode (masklow, mode),
NULL_RTX, 1, OPTAB_LIB_WIDEN);
temp = expand_binop (mode, sub_optab, temp, signmask,
NULL_RTX, 1, OPTAB_LIB_WIDEN);
@@ -3764,7 +3766,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
start_sequence ();
temp2 = copy_to_mode_reg (mode, op0);
- temp = expand_binop (mode, add_optab, temp2, GEN_INT (d-1),
+ temp = expand_binop (mode, add_optab, temp2, gen_int_mode (d - 1, mode),
NULL_RTX, 0, OPTAB_LIB_WIDEN);
temp = force_reg (mode, temp);
@@ -3791,7 +3793,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, -1);
if (shift_cost (optimize_insn_for_speed_p (), mode, ushift)
> COSTS_N_INSNS (1))
- temp = expand_binop (mode, and_optab, temp, GEN_INT (d - 1),
+ temp = expand_binop (mode, and_optab, temp, gen_int_mode (d - 1, mode),
NULL_RTX, 0, OPTAB_LIB_WIDEN);
else
temp = expand_shift (RSHIFT_EXPR, mode, temp,
@@ -3804,7 +3806,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
label = gen_label_rtx ();
temp = copy_to_mode_reg (mode, op0);
do_cmp_and_jump (temp, const0_rtx, GE, mode, label);
- expand_inc (temp, GEN_INT (d - 1));
+ expand_inc (temp, gen_int_mode (d - 1, mode));
emit_label (label);
return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0);
}
@@ -4062,9 +4064,11 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
pre_shift = floor_log2 (d);
if (rem_flag)
{
+ unsigned HOST_WIDE_INT mask
+ = ((unsigned HOST_WIDE_INT) 1 << pre_shift) - 1;
remainder
= expand_binop (compute_mode, and_optab, op0,
- GEN_INT (((HOST_WIDE_INT) 1 << pre_shift) - 1),
+ gen_int_mode (mask, compute_mode),
remainder, 1,
OPTAB_LIB_WIDEN);
if (remainder)
@@ -4115,10 +4119,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
= (shift_cost (speed, compute_mode, post_shift - 1)
+ shift_cost (speed, compute_mode, 1)
+ 2 * add_cost (speed, compute_mode));
- t1 = expmed_mult_highpart (compute_mode, op0,
- GEN_INT (ml),
- NULL_RTX, 1,
- max_cost - extra_cost);
+ t1 = expmed_mult_highpart
+ (compute_mode, op0,
+ gen_int_mode (ml, compute_mode),
+ NULL_RTX, 1, max_cost - extra_cost);
if (t1 == 0)
goto fail1;
t2 = force_operand (gen_rtx_MINUS (compute_mode,
@@ -4147,10 +4151,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
extra_cost
= (shift_cost (speed, compute_mode, pre_shift)
+ shift_cost (speed, compute_mode, post_shift));
- t2 = expmed_mult_highpart (compute_mode, t1,
- GEN_INT (ml),
- NULL_RTX, 1,
- max_cost - extra_cost);
+ t2 = expmed_mult_highpart
+ (compute_mode, t1,
+ gen_int_mode (ml, compute_mode),
+ NULL_RTX, 1, max_cost - extra_cost);
if (t2 == 0)
goto fail1;
quotient = expand_shift
@@ -4274,9 +4278,9 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
extra_cost = (shift_cost (speed, compute_mode, post_shift)
+ shift_cost (speed, compute_mode, size - 1)
+ add_cost (speed, compute_mode));
- t1 = expmed_mult_highpart (compute_mode, op0,
- GEN_INT (ml), NULL_RTX, 0,
- max_cost - extra_cost);
+ t1 = expmed_mult_highpart
+ (compute_mode, op0, gen_int_mode (ml, compute_mode),
+ NULL_RTX, 0, max_cost - extra_cost);
if (t1 == 0)
goto fail1;
t2 = expand_shift
@@ -4368,9 +4372,12 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
pre_shift = floor_log2 (d);
if (rem_flag)
{
- remainder = expand_binop (compute_mode, and_optab, op0,
- GEN_INT (((HOST_WIDE_INT) 1 << pre_shift) - 1),
- remainder, 0, OPTAB_LIB_WIDEN);
+ unsigned HOST_WIDE_INT mask
+ = ((unsigned HOST_WIDE_INT) 1 << pre_shift) - 1;
+ remainder = expand_binop
+ (compute_mode, and_optab, op0,
+ gen_int_mode (mask, compute_mode),
+ remainder, 0, OPTAB_LIB_WIDEN);
if (remainder)
return gen_lowpart (mode, remainder);
}
@@ -4397,9 +4404,9 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
extra_cost = (shift_cost (speed, compute_mode, post_shift)
+ shift_cost (speed, compute_mode, size - 1)
+ 2 * add_cost (speed, compute_mode));
- t3 = expmed_mult_highpart (compute_mode, t2,
- GEN_INT (ml), NULL_RTX, 1,
- max_cost - extra_cost);
+ t3 = expmed_mult_highpart
+ (compute_mode, t2, gen_int_mode (ml, compute_mode),
+ NULL_RTX, 1, max_cost - extra_cost);
if (t3 != 0)
{
t4 = expand_shift
@@ -4537,7 +4544,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
floor_log2 (d), tquotient, 1);
t2 = expand_binop (compute_mode, and_optab, op0,
- GEN_INT (d - 1),
+ gen_int_mode (d - 1, compute_mode),
NULL_RTX, 1, OPTAB_LIB_WIDEN);
t3 = gen_reg_rtx (compute_mode);
t3 = emit_store_flag (t3, NE, t2, const0_rtx,
@@ -4634,7 +4641,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
floor_log2 (d), tquotient, 0);
t2 = expand_binop (compute_mode, and_optab, op0,
- GEN_INT (d - 1),
+ gen_int_mode (d - 1, compute_mode),
NULL_RTX, 1, OPTAB_LIB_WIDEN);
t3 = gen_reg_rtx (compute_mode);
t3 = emit_store_flag (t3, NE, t2, const0_rtx,
@@ -5477,7 +5484,7 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
STORE_FLAG_VALUE, target_mode);
if (tem)
return expand_binop (target_mode, add_optab, tem,
- GEN_INT (normalizep),
+ gen_int_mode (normalizep, target_mode),
target, 0, OPTAB_WIDEN);
}
else if (!want_add
@@ -5581,7 +5588,8 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
STORE_FLAG_VALUE, target_mode);
if (tem != 0)
tem = expand_binop (target_mode, add_optab, tem,
- GEN_INT (normalizep), target, 0, OPTAB_WIDEN);
+ gen_int_mode (normalizep, target_mode),
+ target, 0, OPTAB_WIDEN);
}
else if (!want_add
&& rtx_cost (trueval, XOR, 1,