aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-02-22 11:02:31 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2003-02-22 10:02:31 +0000
commit1c4a429ab09b46100cd4b0444e6d5e2e8472e721 (patch)
tree257ede1e5a0927db4b10d7b84ff244d229c10cd4 /gcc/expmed.c
parent1e2115dcc04ef844f63f22923b83439bcbf31b1c (diff)
downloadgcc-1c4a429ab09b46100cd4b0444e6d5e2e8472e721.zip
gcc-1c4a429ab09b46100cd4b0444e6d5e2e8472e721.tar.gz
gcc-1c4a429ab09b46100cd4b0444e6d5e2e8472e721.tar.bz2
expmed.c (expand_divmod): Undo sign extensions for unsigned operands
* expmed.c (expand_divmod): Undo sign extensions for unsigned operands * cfgcleanup.c (try_forward_edges): Don't check loop structures when not optimizing. (cleanup_cfg): Do not iterate trought delete_trivially_dead_insns when not expensive. * toplev.c (rest_of_compilation): Duplicate loop headers only when optimizing; Delete trivially dead insns early; fix optimize check. * Makefile.in (c-decl.o, c-objc-common.o, cgraph.o, tree-inline.o): Add dependency on cgraph.h * c-decl.c: Include cgraph.h (finish_function): Update call of tree_inlinable_function_p. * c-objc-common.c: Include cgraph.h * cgraph.h: New file. * cgraphunit.c: New file. * cgraph.c (cgraph_node, cgraph_edge): Move into cgraph.h (cgraph_nodes, cgraph_n_nodes): Globalize. (cgraph_finalize_function, cgraph_finalize_compilation_unit cgraph_create_edges, cgraph_optimize, cgraph_mark_needed_node): Move into cgraphunit.c * tree-inline.c: Include cgraph.h * tree-inline.c: Include cgraph.h From-SVN: r63281
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 9fe87b6..33d8152 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2955,14 +2955,20 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
int size;
rtx insn, set;
optab optab1, optab2;
- int op1_is_constant, op1_is_pow2;
+ int op1_is_constant, op1_is_pow2 = 0;
int max_cost, extra_cost;
static HOST_WIDE_INT last_div_const = 0;
+ static HOST_WIDE_INT ext_op1;
op1_is_constant = GET_CODE (op1) == CONST_INT;
- op1_is_pow2 = (op1_is_constant
- && ((EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1))
- || (! unsignedp && EXACT_POWER_OF_2_OR_ZERO_P (-INTVAL (op1))))));
+ if (op1_is_constant)
+ {
+ ext_op1 = INTVAL (op1);
+ if (unsignedp)
+ ext_op1 &= GET_MODE_MASK (mode);
+ op1_is_pow2 = ((EXACT_POWER_OF_2_OR_ZERO_P (ext_op1)
+ || (! unsignedp && EXACT_POWER_OF_2_OR_ZERO_P (-ext_op1))));
+ }
/*
This is the structure of expand_divmod:
@@ -3142,7 +3148,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
unsigned HOST_WIDE_INT mh, ml;
int pre_shift, post_shift;
int dummy;
- unsigned HOST_WIDE_INT d = INTVAL (op1);
+ unsigned HOST_WIDE_INT d = (INTVAL (op1)
+ & GET_MODE_MASK (compute_mode));
if (EXACT_POWER_OF_2_OR_ZERO_P (d))
{