summaryrefslogtreecommitdiff
path: root/gcc/optabs.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/optabs.c
parenta1f6ba09f2743fe1c3426e1010d07065ccfb3b3f (diff)
downloadgcc-213b27c99d10147707909332de18c0546a423196.tar.gz
* 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/optabs.c')
-rw-r--r--gcc/optabs.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 0be8d6a6bce..4f30779ec43 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -723,17 +723,25 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
}
/* In case the insn wants input operands in modes different from
- the result, convert the operands. */
+ the result, convert the operands. It would seem that we
+ don't need to convert CONST_INTs, but we do, so that they're
+ a properly sign-extended for their modes. */
- if (GET_MODE (op0) != VOIDmode
- && GET_MODE (op0) != mode0
+ if (GET_MODE (op0) != mode0
&& mode0 != VOIDmode)
- xop0 = convert_to_mode (mode0, xop0, unsignedp);
+ xop0 = convert_modes (mode0,
+ GET_MODE (op0) != VOIDmode
+ ? GET_MODE (op0)
+ : mode0,
+ xop0, unsignedp);
- if (GET_MODE (xop1) != VOIDmode
- && GET_MODE (xop1) != mode1
+ if (GET_MODE (xop1) != mode1
&& mode1 != VOIDmode)
- xop1 = convert_to_mode (mode1, xop1, unsignedp);
+ xop1 = convert_modes (mode1,
+ GET_MODE (op1) != VOIDmode
+ ? GET_MODE (op1)
+ : mode1,
+ xop1, unsignedp);
/* Now, if insn's predicates don't allow our operands, put them into
pseudo regs. */
@@ -4295,7 +4303,9 @@ expand_fix (to, from, unsignedp)
NULL_RTX, 0, OPTAB_LIB_WIDEN);
expand_fix (to, target, 0);
target = expand_binop (GET_MODE (to), xor_optab, to,
- GEN_INT ((HOST_WIDE_INT) 1 << (bitsize - 1)),
+ GEN_INT (trunc_int_for_mode
+ ((HOST_WIDE_INT) 1 << (bitsize - 1),
+ GET_MODE (to))),
to, 1, OPTAB_LIB_WIDEN);
if (target != to)