aboutsummaryrefslogtreecommitdiff
path: root/gcc
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
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')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/m32r/m32r.c11
-rw-r--r--gcc/config/m32r/m32r.md5
-rw-r--r--gcc/cse.c13
-rw-r--r--gcc/real.c14
5 files changed, 48 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e404a69..2108f06 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+Thu Dec 10 16:02:06 1998 Jim Wilson <wilson@cygnus.com>
+
+ * 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.
+
Thu Dec 10 15:05:59 1998 Dave Brolley <brolley@cygnus.com>
* objc/objc-act.c (lang_init_options): Enclose cpplib related code in
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 8332035b..97c4bca 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -1551,9 +1551,14 @@ m32r_expand_prologue ()
/* Allocate space for register arguments if this is a variadic function. */
if (current_frame_info.pretend_size != 0)
- emit_insn (gen_addsi3 (stack_pointer_rtx,
- stack_pointer_rtx,
- GEN_INT (-current_frame_info.pretend_size)));
+ {
+ /* Use a HOST_WIDE_INT temporary, since negating an unsigned int gives
+ the wrong result on a 64-bit host. */
+ HOST_WIDE_INT pretend_size = current_frame_info.pretend_size;
+ emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx,
+ GEN_INT (-pretend_size)));
+ }
/* Save any registers we need to and set up fp. */
diff --git a/gcc/config/m32r/m32r.md b/gcc/config/m32r/m32r.md
index 53742c9..f52a525 100644
--- a/gcc/config/m32r/m32r.md
+++ b/gcc/config/m32r/m32r.md
@@ -434,8 +434,9 @@
}
}
- /* Can't use any two byte insn, fall back to seth/or3. */
- operands[2] = GEN_INT ((val) & 0xffff0000);
+ /* Can't use any two byte insn, fall back to seth/or3. Use ~0xffff instead
+ of 0xffff0000, since the later fails on a 64-bit host. */
+ operands[2] = GEN_INT ((val) & ~0xffff);
operands[3] = GEN_INT ((val) & 0xffff);
}")
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);
}
diff --git a/gcc/real.c b/gcc/real.c
index 7261e29..8cc38cb 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -553,6 +553,20 @@ endian (e, x, mode)
abort ();
}
}
+
+ /* If 32 bits is an entire word for the target, but 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. See for instance
+ simplify_unary_operation. */
+
+ if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == 32)
+ {
+ if (x[0] & ((HOST_WIDE_INT) 1 << 31))
+ x[0] |= ((HOST_WIDE_INT) (-1) << 32);
+
+ if (x[1] & ((HOST_WIDE_INT) 1 << 31))
+ x[1] |= ((HOST_WIDE_INT) (-1) << 32);
+ }
}