mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: stop using fucomi* ops for 387 builds
The fucomi* opcodes were only introduced for the Pentium Pro.
They do not exist for an MMX Pentium. Use the fucom* instructions
instead and move the condition codes from the fp flags register to
the integer flags register explicitly.
The use of fucomi* opcodes in ggen.go was introduced in 1.5 (CL 8738).
The bad ops were generated for 64-bit floating-point comparisons.
The use of fucomi* opcodes in gsubr.go dates back to at least 1.1.
The bad ops were generated for float{32,64} to uint64 conversions.
Fixes #13923
Change-Id: I5290599f5edea8abf8fb18036f44fa78bd1fc9e6
Reviewed-on: https://go-review.googlesource.com/18590
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
f3ce054a44
commit
3d01f28e47
4 changed files with 120 additions and 11 deletions
|
|
@ -1198,14 +1198,17 @@ func floatmove(f *gc.Node, t *gc.Node) {
|
|||
|
||||
// if 0 > v { answer = 0 }
|
||||
gins(x86.AFMOVD, &zerof, &f0)
|
||||
|
||||
gins(x86.AFUCOMIP, &f0, &f1)
|
||||
gins(x86.AFUCOMP, &f0, &f1)
|
||||
gins(x86.AFSTSW, nil, &ax)
|
||||
gins(x86.ASAHF, nil, nil)
|
||||
p1 := gc.Gbranch(optoas(gc.OGT, gc.Types[tt]), nil, 0)
|
||||
|
||||
// if 1<<64 <= v { answer = 0 too }
|
||||
gins(x86.AFMOVD, &two64f, &f0)
|
||||
|
||||
gins(x86.AFUCOMIP, &f0, &f1)
|
||||
gins(x86.AFUCOMP, &f0, &f1)
|
||||
gins(x86.AFSTSW, nil, &ax)
|
||||
gins(x86.ASAHF, nil, nil)
|
||||
p2 := gc.Gbranch(optoas(gc.OGT, gc.Types[tt]), nil, 0)
|
||||
gc.Patch(p1, gc.Pc)
|
||||
gins(x86.AFMOVVP, &f0, t) // don't care about t, but will pop the stack
|
||||
|
|
@ -1235,7 +1238,9 @@ func floatmove(f *gc.Node, t *gc.Node) {
|
|||
// actual work
|
||||
gins(x86.AFMOVD, &two63f, &f0)
|
||||
|
||||
gins(x86.AFUCOMIP, &f0, &f1)
|
||||
gins(x86.AFUCOMP, &f0, &f1)
|
||||
gins(x86.AFSTSW, nil, &ax)
|
||||
gins(x86.ASAHF, nil, nil)
|
||||
p2 = gc.Gbranch(optoas(gc.OLE, gc.Types[tt]), nil, 0)
|
||||
gins(x86.AFMOVVP, &f0, t)
|
||||
p3 := gc.Gbranch(obj.AJMP, nil, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue