1
0
mirror of https://github.com/golang/go synced 2024-11-23 17:30:02 -07:00

cmd/compile: CALLudiv on nacl/arm doesn't clobber R12

On nacl/arm, R12 is clobbered by the RET instruction in function
that has a frame. runtime.udiv doesn't have a frame, so it does
not clobber R12.

Change-Id: I0de448749f615908f6659e92d201ba3eb2f8266d
Reviewed-on: https://go-review.googlesource.com/93116
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Cherry Zhang 2018-02-09 12:47:33 -05:00
parent 633b38c5d2
commit 5a43a271e8
2 changed files with 3 additions and 3 deletions

View File

@ -291,9 +291,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config
if c.nacl {
c.noDuffDevice = true // Don't use Duff's device on NaCl
// runtime call clobber R12 on nacl
opcodeTable[OpARMCALLudiv].reg.clobbers |= 1 << 12 // R12
// Returns clobber BP on nacl/386, so the write
// barrier does.
opcodeTable[Op386LoweredWB].reg.clobbers |= 1 << 5 // BP

View File

@ -102,6 +102,9 @@ TEXT runtime·_sfloatpanic(SB),NOSPLIT|NOFRAME,$0
#define Ra R11
// Be careful: Ra == R11 will be used by the linker for synthesized instructions.
// Note: this function does not have a frame. If it ever needs a frame,
// the RET instruction will clobber R12 on nacl, and the compiler's register
// allocator needs to know.
TEXT runtime·udiv(SB),NOSPLIT|NOFRAME,$0
MOVBU runtime·hardDiv(SB), Ra
CMP $0, Ra