aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2010-10-22 15:56:51 -0400
committerDJ Delorie <dj@gcc.gnu.org>2010-10-22 15:56:51 -0400
commitf6bac694c268aa6bd605c215f7aae27ff774631d (patch)
treecf3f19139965e023b2decc8bbc4c03d514314504
parent4d1bc60a12eafe8aed38fff234a4f6ca16f78501 (diff)
downloadgcc-f6bac694c268aa6bd605c215f7aae27ff774631d.zip
gcc-f6bac694c268aa6bd605c215f7aae27ff774631d.tar.gz
gcc-f6bac694c268aa6bd605c215f7aae27ff774631d.tar.bz2
* config/m32c/m32c-lib1.S (m32c_jsri16): Make reentrant.
From-SVN: r165859
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/m32c/m32c-lib1.S32
2 files changed, 24 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d4114d3..78802b0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-22 DJ Delorie <dj@redhat.com>
+
+ * config/m32c/m32c-lib1.S (m32c_jsri16): Make reentrant.
+
2010-10-22 Paul Koning <ni1d@arrl.net>
* config/pdp11/pdp11.h (IRA_COVER_CLASSES): Define.
diff --git a/gcc/config/m32c/m32c-lib1.S b/gcc/config/m32c/m32c-lib1.S
index 9556e09..777781b 100644
--- a/gcc/config/m32c/m32c-lib1.S
+++ b/gcc/config/m32c/m32c-lib1.S
@@ -204,20 +204,28 @@ cmpsi_lt:
#endif
#ifdef L__m32c_jsri16
- .data
-m32c_jsri_addr:
- .byte 0, 0, 0
-m32c_jsri_ret:
- .byte 0, 0, 0
-
.text
+#ifdef A16
.global m32c_jsri16
m32c_jsri16:
- pop.w m32c_jsri_ret
- pop.b m32c_jsri_ret+2
- pop.w m32c_jsri_addr
- push.b m32c_jsri_ret+2
- push.w m32c_jsri_ret
- jmpi.a m32c_jsri_addr
+ add.w #-1, sp
+
+ /* Read the address (16 bits) and return address (24 bits) off
+ the stack. */
+ mov.w 4[sp], r0
+ mov.w 1[sp], r3
+ mov.b 3[sp], a0 /* This zero-extends, so the high byte has
+ zero in it. */
+
+ /* Write the return address, then new address, to the stack. */
+ mov.w a0, 1[sp] /* Just to get the zero in 2[sp]. */
+ mov.w r0, 0[sp]
+ mov.w r3, 3[sp]
+ mov.b a0, 5[sp]
+
+ /* This "returns" to the target address, leaving the pending
+ return address on the stack. */
+ rts
+#endif
#endif