aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@cygnus.com>1998-12-10 17:21:35 +0000
committerJim Wilson <wilson@gcc.gnu.org>1998-12-10 09:21:35 -0800
commit737e7965de64b49022c536aaa33a4e0d8de29582 (patch)
tree8a3b49849a4a07306e6f4b52490a51677d4b2da6 /gcc/cse.c
parentea585788ba7c48bbeec2ed953224a06bb1ebe0ac (diff)
downloadgcc-737e7965de64b49022c536aaa33a4e0d8de29582.zip
gcc-737e7965de64b49022c536aaa33a4e0d8de29582.tar.gz
gcc-737e7965de64b49022c536aaa33a4e0d8de29582.tar.bz2
Fix alpha-x-m32r-elf bugs.
* cse.c (simplify_unary_operation): Sign-extend constants when they have the most significant bit set for the target. * real.c (endian): Sign-extend 32 bit output values on a 64 bit host. * m32r/m32r.c (m32r_expand_prologue): Store pretend_size in HOST_WIDE_INT temporary before negating it. * m32r/m32r.md (movsi_insn+1): Use ~0xffff instead of 0xffff0000. From-SVN: r24254
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 7b81de4..5e77631 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3242,6 +3242,19 @@ simplify_unary_operation (code, mode, op, op_mode)
!= ((HOST_WIDE_INT) (-1) << (width - 1))))
val &= ((HOST_WIDE_INT) 1 << width) - 1;
+ /* If this would be an entire word for the target, but is not for
+ the host, then sign-extend on the host so that the number will look
+ the same way on the host that it would on the target.
+
+ For example, when building a 64 bit alpha hosted 32 bit sparc
+ targeted compiler, then we want the 32 bit unsigned value -1 to be
+ represented as a 64 bit value -1, and not as 0x00000000ffffffff.
+ The later confuses the sparc backend. */
+
+ if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
+ && (val & ((HOST_WIDE_INT) 1 << (width - 1))))
+ val |= ((HOST_WIDE_INT) (-1) << width);
+
return GEN_INT (val);
}