]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal-abi: use x87 mode, not MMX mode
authorAustin Clements <austin@google.com>
Wed, 24 Feb 2021 03:03:29 +0000 (22:03 -0500)
committerAustin Clements <austin@google.com>
Wed, 24 Feb 2021 19:26:10 +0000 (19:26 +0000)
Florian Weimer pointed out that my justification for using MMX mode
was nonsense and that staying in x87 mode simplifies transitions to
and from C. Hence, switch the spec to say we're always in x87 mode.

For #40724.

Change-Id: Iad916b2c376db41f95614aa6897f6b1184576bb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/295789
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal-abi.md

index f4ef2cc86949f2bbd26d99f6078b066f6f5cea6f..3a3509d8c2ea32bcb6551e81661b963736e189cf 100644 (file)
@@ -455,13 +455,12 @@ The arithmetic status flags are treated like scratch registers and not
 preserved across calls.
 All other bits in RFLAGS are system flags.
 
-The CPU is always in MMX technology state (not x87 mode).
+At function calls and returns, the CPU is in x87 mode (not MMX
+technology mode).
 
-*Rationale*: Go on amd64 uses the XMM registers and never uses the x87
-registers, so it makes sense to assume the CPU is in MMX mode.
-Otherwise, any function that used the XMM registers would have to
-execute an EMMS instruction before calling another function or
-returning (this is the case in the SysV ABI).
+*Rationale*: Go on amd64 does not use either the x87 registers or MMX
+registers. Hence, we follow the SysV platform conventions in order to
+simplify transitions to and from the C ABI.
 
 At calls, the MXCSR control bits are always set as follows: