aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>1996-10-27 02:08:23 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>1996-10-27 02:08:23 +0000
commit96ff8a163efd0c95b135cf1068ac3c6c8be8c414 (patch)
tree81306034c785e0d1483fbd24bb009979ceba0fba /gcc
parent8d998e52a0865dc4a0af5413e27f21fda8ccf235 (diff)
downloadgcc-96ff8a163efd0c95b135cf1068ac3c6c8be8c414.zip
gcc-96ff8a163efd0c95b135cf1068ac3c6c8be8c414.tar.gz
gcc-96ff8a163efd0c95b135cf1068ac3c6c8be8c414.tar.bz2
Zero extend when generating a CONST_DOUBLE in convert_modes
From-SVN: r13041
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 37950e9..abdfba7 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1292,7 +1292,20 @@ convert_modes (mode, oldmode, x, unsignedp)
if (unsignedp && GET_MODE_CLASS (mode) == MODE_INT
&& GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT
&& GET_CODE (x) == CONST_INT && INTVAL (x) < 0)
- return immed_double_const (INTVAL (x), (HOST_WIDE_INT) 0, mode);
+ {
+ HOST_WIDE_INT val = INTVAL (x);
+
+ if (oldmode != VOIDmode
+ && HOST_BITS_PER_WIDE_INT > GET_MODE_BITSIZE (oldmode))
+ {
+ int width = GET_MODE_BITSIZE (oldmode);
+
+ /* We need to zero extend VAL. */
+ val &= ((HOST_WIDE_INT) 1 << width) - 1;
+ }
+
+ return immed_double_const (val, (HOST_WIDE_INT) 0, mode);
+ }
/* We can do this with a gen_lowpart if both desired and current modes
are integer, and this is either a constant integer, a register, or a