summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/mkpreempt.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/mkpreempt.go')
-rw-r--r--libgo/go/runtime/mkpreempt.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/libgo/go/runtime/mkpreempt.go b/libgo/go/runtime/mkpreempt.go
index 64e220772e1..31b6f5cbac3 100644
--- a/libgo/go/runtime/mkpreempt.go
+++ b/libgo/go/runtime/mkpreempt.go
@@ -244,6 +244,15 @@ func genAMD64() {
// TODO: MXCSR register?
+ // Apparently, the signal handling code path in darwin kernel leaves
+ // the upper bits of Y registers in a dirty state, which causes
+ // many SSE operations (128-bit and narrower) become much slower.
+ // Clear the upper bits to get to a clean state. See issue #37174.
+ // It is safe here as Go code don't use the upper bits of Y registers.
+ p("#ifdef GOOS_darwin")
+ p("VZEROUPPER")
+ p("#endif")
+
p("PUSHQ BP")
p("MOVQ SP, BP")
p("// Save flags before clobbering them")