summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index fb590cdf673..ae76695a133 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2610,6 +2610,10 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val,
accum = force_operand (gen_rtx_PLUS (mode, accum, op0), target);
}
+ /* Compare only the bits of val and val_so_far that are significant
+ in the result mode, to avoid sign-/zero-extension confusion. */
+ val &= GET_MODE_MASK (mode);
+ val_so_far &= GET_MODE_MASK (mode);
if (val != val_so_far)
abort ();