mirror of
https://github.com/golang/go
synced 2024-11-17 08:04:46 -07:00
runtime: restore SSE guard in asyncPreempt on 386
So we don't use SSE instructions under GO386=softfloat. Change-Id: I8ecc92340ee567f84a22501df2543ec041d25ef2 Reviewed-on: https://go-review.googlesource.com/c/go/+/260137 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
c19725016d
commit
67edc0ed81
@ -189,26 +189,34 @@ func (l *layout) restore() {
|
||||
|
||||
func gen386() {
|
||||
p("PUSHFL")
|
||||
|
||||
// Assign stack offsets.
|
||||
// Save general purpose registers.
|
||||
var l = layout{sp: "SP"}
|
||||
for _, reg := range regNames386 {
|
||||
if reg == "SP" {
|
||||
if reg == "SP" || strings.HasPrefix(reg, "X") {
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(reg, "X") {
|
||||
l.add("MOVUPS", reg, 16)
|
||||
} else {
|
||||
l.add("MOVL", reg, 4)
|
||||
}
|
||||
l.add("MOVL", reg, 4)
|
||||
}
|
||||
|
||||
p("ADJSP $%d", l.stack)
|
||||
// Save SSE state only if supported.
|
||||
lSSE := layout{stack: l.stack, sp: "SP"}
|
||||
for i := 0; i < 8; i++ {
|
||||
lSSE.add("MOVUPS", fmt.Sprintf("X%d", i), 16)
|
||||
}
|
||||
|
||||
p("ADJSP $%d", lSSE.stack)
|
||||
p("NOP SP")
|
||||
l.save()
|
||||
p("CMPB internal∕cpu·X86+const_offsetX86HasSSE2(SB), $1\nJNE nosse")
|
||||
lSSE.save()
|
||||
label("nosse:")
|
||||
p("CALL ·asyncPreempt2(SB)")
|
||||
p("CMPB internal∕cpu·X86+const_offsetX86HasSSE2(SB), $1\nJNE nosse2")
|
||||
lSSE.restore()
|
||||
label("nosse2:")
|
||||
l.restore()
|
||||
p("ADJSP $%d", -l.stack)
|
||||
p("ADJSP $%d", -lSSE.stack)
|
||||
|
||||
p("POPFL")
|
||||
p("RET")
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
|
||||
MOVL BP, 16(SP)
|
||||
MOVL SI, 20(SP)
|
||||
MOVL DI, 24(SP)
|
||||
CMPB internal∕cpu·X86+const_offsetX86HasSSE2(SB), $1
|
||||
JNE nosse
|
||||
MOVUPS X0, 28(SP)
|
||||
MOVUPS X1, 44(SP)
|
||||
MOVUPS X2, 60(SP)
|
||||
@ -22,7 +24,10 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
|
||||
MOVUPS X5, 108(SP)
|
||||
MOVUPS X6, 124(SP)
|
||||
MOVUPS X7, 140(SP)
|
||||
nosse:
|
||||
CALL ·asyncPreempt2(SB)
|
||||
CMPB internal∕cpu·X86+const_offsetX86HasSSE2(SB), $1
|
||||
JNE nosse2
|
||||
MOVUPS 140(SP), X7
|
||||
MOVUPS 124(SP), X6
|
||||
MOVUPS 108(SP), X5
|
||||
@ -31,6 +36,7 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
|
||||
MOVUPS 60(SP), X2
|
||||
MOVUPS 44(SP), X1
|
||||
MOVUPS 28(SP), X0
|
||||
nosse2:
|
||||
MOVL 24(SP), DI
|
||||
MOVL 20(SP), SI
|
||||
MOVL 16(SP), BP
|
||||
|
Loading…
Reference in New Issue
Block a user