aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_s390x.s
diff options
context:
space:
mode:
authorMichael Munday <mike.munday@ibm.com>2018-04-30 16:55:13 +0100
committerMichael Munday <mike.munday@ibm.com>2018-05-01 15:48:17 +0000
commit5d9c78201f0f226b0b8c7ece63f6731e168efb09 (patch)
treeed2ab1a9ada76330532828828b055f30a4d96985 /src/runtime/asm_s390x.s
parentd29ec40e19fa0548292bb0bf2a4fb88920838877 (diff)
downloadgo-5d9c78201f0f226b0b8c7ece63f6731e168efb09.tar.gz
go-5d9c78201f0f226b0b8c7ece63f6731e168efb09.zip
cmd/compile: allow R11 to be allocated on s390x
R11 is only used as a temporary by a very small set of instructions (DIV, MOD, MULH and extended MVC/XC instructions). By marking these instructions as clobbering R11 we can allocate R11 in the general case. Change-Id: I0d4ffe80e57c164d42a5ea5ef6308756a5b0f742 Reviewed-on: https://go-review.googlesource.com/110255 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/asm_s390x.s')
-rw-r--r--src/runtime/asm_s390x.s48
1 files changed, 17 insertions, 31 deletions
diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s
index 1d8c4032e5..b569d8b421 100644
--- a/src/runtime/asm_s390x.s
+++ b/src/runtime/asm_s390x.s
@@ -825,30 +825,29 @@ TEXT ·checkASM(SB),NOSPLIT,$0-1
// gcWriteBarrier does NOT follow the Go ABI. It takes two arguments:
// - R2 is the destination of the write
// - R3 is the value being written at R2.
-// It clobbers R10 and R11 (the linker temp registers).
+// It clobbers R10 (the temp register).
// It does not clobber any other general-purpose registers,
// but may clobber others (e.g., floating point registers).
-TEXT runtime·gcWriteBarrier(SB),NOSPLIT,$88
+TEXT runtime·gcWriteBarrier(SB),NOSPLIT,$104
// Save the registers clobbered by the fast path.
- MOVD R1, 80(R15)
- MOVD R4, 88(R15)
+ MOVD R1, 96(R15)
+ MOVD R4, 104(R15)
MOVD g_m(g), R1
MOVD m_p(R1), R1
- MOVD (p_wbBuf+wbBuf_next)(R1), R4
// Increment wbBuf.next position.
- ADD $16, R4
+ MOVD $16, R4
+ ADD (p_wbBuf+wbBuf_next)(R1), R4
MOVD R4, (p_wbBuf+wbBuf_next)(R1)
MOVD (p_wbBuf+wbBuf_end)(R1), R1
- MOVD R1, R10 // R10 is linker temp register
// Record the write.
- MOVD R3, -16(R4) // Record value
- MOVD (R2), R1 // TODO: This turns bad writes into bad reads.
- MOVD R1, -8(R4) // Record *slot
+ MOVD R3, -16(R4) // Record value
+ MOVD (R2), R10 // TODO: This turns bad writes into bad reads.
+ MOVD R10, -8(R4) // Record *slot
// Is the buffer full?
- CMPBEQ R4, R10, flush
+ CMPBEQ R4, R1, flush
ret:
- MOVD 80(R15), R1
- MOVD 88(R15), R4
+ MOVD 96(R15), R1
+ MOVD 104(R15), R4
// Do the write.
MOVD R3, (R2)
RET
@@ -856,18 +855,11 @@ ret:
flush:
// Save all general purpose registers since these could be
// clobbered by wbBufFlush and were not saved by the caller.
- MOVD R2, 8(R15) // Also first argument to wbBufFlush
- MOVD R3, 16(R15) // Also second argument to wbBufFlush
+ STMG R2, R3, 8(R15) // set R2 and R3 as arguments for wbBufFlush
MOVD R0, 24(R15)
// R1 already saved.
// R4 already saved.
- MOVD R5, 32(R15)
- MOVD R6, 40(R15)
- MOVD R7, 48(R15)
- MOVD R8, 56(R15)
- MOVD R9, 64(R15)
- // R10 and R11 are linker temp registers.
- MOVD R12, 72(R15)
+ STMG R5, R12, 32(R15) // save R5 - R12
// R13 is g.
// R14 is LR.
// R15 is SP.
@@ -875,13 +867,7 @@ flush:
// This takes arguments R2 and R3.
CALL runtime·wbBufFlush(SB)
- MOVD 8(R15), R2
- MOVD 16(R15), R3
- MOVD 24(R15), R0
- MOVD 32(R15), R5
- MOVD 40(R15), R6
- MOVD 48(R15), R7
- MOVD 56(R15), R8
- MOVD 64(R15), R9
- MOVD 72(R15), R12
+ LMG 8(R15), R2, R3 // restore R2 - R3
+ MOVD 24(R15), R0 // restore R0
+ LMG 32(R15), R5, R12 // restore R5 - R12
JMP ret