summaryrefslogtreecommitdiffstats
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-12 03:41:36 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-12 03:41:36 +0000
commit213b27c99d10147707909332de18c0546a423196 (patch)
tree943b9fe0140e410d24c23703edfa24a7154c671e /gcc/expmed.c
parenta1f6ba09f2743fe1c3426e1010d07065ccfb3b3f (diff)
downloadppe42-gcc-213b27c99d10147707909332de18c0546a423196.tar.gz
ppe42-gcc-213b27c99d10147707909332de18c0546a423196.zip
* expmed.c (store_bit_field): Truncate CONST_INTs.
(expand_mult_highpart, expand_divmod): Likewise. * expr.c (convert_modes, store_field): Likewise. * integrate.c (expand_inline_function): Use promote_mode() to determine whether to convert_modes() an argument as signed or unsigned. * optabs.c (expand_binop): Get CONST_INT operands sign-extended for their appropriate modes. * stmt.c (emit_case_nodes): Convert node values to the appropriate mode. (expand_end_case): Convert minval and range to the appropriate mode. * unroll.c (loop_iterations): Truncate abs_diff to the mode of the iteration variable. * varasm.c (immed_double_const): Don't require words to be narrower than host wide ints to properly sign-extend CONST_INTs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41285 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index a7684508b5b..b2396ae9bd9 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -592,6 +592,8 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size)
else
value1 = gen_lowpart (maxmode, value1);
}
+ else if (GET_CODE (value) == CONST_INT)
+ value1 = GEN_INT (trunc_int_for_mode (INTVAL (value), maxmode));
else if (!CONSTANT_P (value))
/* Parse phase is supposed to make VALUE's data type
match that of the component reference, which is a type
@@ -2787,7 +2789,7 @@ expand_mult_highpart (mode, op0, cnst1, target, unsignedp, max_cost)
if (size > HOST_BITS_PER_WIDE_INT)
abort ();
- op1 = GEN_INT (cnst1);
+ op1 = GEN_INT (trunc_int_for_mode (cnst1, mode));
if (GET_MODE_BITSIZE (wider_mode) <= HOST_BITS_PER_INT)
wide_op1 = op1;
@@ -3274,7 +3276,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
if (rem_flag && d < 0)
{
d = abs_d;
- op1 = GEN_INT (abs_d);
+ op1 = GEN_INT (trunc_int_for_mode (abs_d, compute_mode));
}
if (d == 1)
@@ -3304,7 +3306,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
t1 = copy_to_mode_reg (compute_mode, op0);
do_cmp_and_jump (t1, const0_rtx, GE,
compute_mode, label);
- expand_inc (t1, GEN_INT (abs_d - 1));
+ expand_inc (t1, GEN_INT (trunc_int_for_mode
+ (abs_d - 1, compute_mode)));
emit_label (label);
quotient = expand_shift (RSHIFT_EXPR, compute_mode, t1,
build_int_2 (lgup, 0),
@@ -3341,7 +3344,10 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
REG_EQUAL,
gen_rtx_DIV (compute_mode,
op0,
- GEN_INT (abs_d)));
+ GEN_INT
+ (trunc_int_for_mode
+ (abs_d,
+ compute_mode))));
quotient = expand_unop (compute_mode, neg_optab,
quotient, quotient, 0);
@@ -3840,8 +3846,10 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
ml = invert_mod2n (d >> pre_shift, size);
t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
build_int_2 (pre_shift, 0), NULL_RTX, unsignedp);
- quotient = expand_mult (compute_mode, t1, GEN_INT (ml), NULL_RTX,
- 0);
+ quotient = expand_mult (compute_mode, t1,
+ GEN_INT (trunc_int_for_mode
+ (ml, compute_mode)),
+ NULL_RTX, 0);
insn = get_last_insn ();
set_unique_reg_note (insn,
OpenPOWER on IntegriCloud