mirror of https://github.com/golang/go.git
cmd/compile: use FMA on plan9, and drop UseFMA
Every OS uses FMA now. Change-Id: Ia7ffa77c52c45aefca611ddc54e9dfffb27a48da Reviewed-on: https://go-review.googlesource.com/c/go/+/655877 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
35cb497d6e
commit
c9b07e8871
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"cmd/compile/internal/types"
|
"cmd/compile/internal/types"
|
||||||
"cmd/internal/obj"
|
"cmd/internal/obj"
|
||||||
"cmd/internal/src"
|
"cmd/internal/src"
|
||||||
"internal/buildcfg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Config holds readonly compilation information.
|
// A Config holds readonly compilation information.
|
||||||
|
|
@ -48,7 +47,6 @@ type Config struct {
|
||||||
SoftFloat bool //
|
SoftFloat bool //
|
||||||
Race bool // race detector enabled
|
Race bool // race detector enabled
|
||||||
BigEndian bool //
|
BigEndian bool //
|
||||||
UseFMA bool // Use hardware FMA operation
|
|
||||||
unalignedOK bool // Unaligned loads/stores are ok
|
unalignedOK bool // Unaligned loads/stores are ok
|
||||||
haveBswap64 bool // architecture implements Bswap64
|
haveBswap64 bool // architecture implements Bswap64
|
||||||
haveBswap32 bool // architecture implements Bswap32
|
haveBswap32 bool // architecture implements Bswap32
|
||||||
|
|
@ -354,7 +352,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
|
||||||
}
|
}
|
||||||
c.ctxt = ctxt
|
c.ctxt = ctxt
|
||||||
c.optimize = optimize
|
c.optimize = optimize
|
||||||
c.UseFMA = true
|
|
||||||
c.SoftFloat = softfloat
|
c.SoftFloat = softfloat
|
||||||
if softfloat {
|
if softfloat {
|
||||||
c.floatParamRegs = nil // no FP registers in softfloat mode
|
c.floatParamRegs = nil // no FP registers in softfloat mode
|
||||||
|
|
@ -363,12 +360,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
|
||||||
c.ABI0 = abi.NewABIConfig(0, 0, ctxt.Arch.FixedFrameSize, 0)
|
c.ABI0 = abi.NewABIConfig(0, 0, ctxt.Arch.FixedFrameSize, 0)
|
||||||
c.ABI1 = abi.NewABIConfig(len(c.intParamRegs), len(c.floatParamRegs), ctxt.Arch.FixedFrameSize, 1)
|
c.ABI1 = abi.NewABIConfig(len(c.intParamRegs), len(c.floatParamRegs), ctxt.Arch.FixedFrameSize, 1)
|
||||||
|
|
||||||
// On Plan 9, floating point operations are not allowed in note handler.
|
|
||||||
if buildcfg.GOOS == "plan9" {
|
|
||||||
// Don't use FMA on Plan 9
|
|
||||||
c.UseFMA = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if ctxt.Flag_shared {
|
if ctxt.Flag_shared {
|
||||||
// LoweredWB is secretly a CALL and CALLs on 386 in
|
// LoweredWB is secretly a CALL and CALLs on 386 in
|
||||||
// shared mode get rewritten by obj6.go to go through
|
// shared mode get rewritten by obj6.go to go through
|
||||||
|
|
|
||||||
|
|
@ -832,9 +832,6 @@ func (f *Func) spSb() (sp, sb *Value) {
|
||||||
// useFMA allows targeted debugging w/ GOFMAHASH
|
// useFMA allows targeted debugging w/ GOFMAHASH
|
||||||
// If you have an architecture-dependent FP glitch, this will help you find it.
|
// If you have an architecture-dependent FP glitch, this will help you find it.
|
||||||
func (f *Func) useFMA(v *Value) bool {
|
func (f *Func) useFMA(v *Value) bool {
|
||||||
if !f.Config.UseFMA {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if base.FmaHash == nil {
|
if base.FmaHash == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -767,11 +767,6 @@ func initIntrinsics(cfg *intrinsicBuildConfig) {
|
||||||
sys.ARM64, sys.Loong64, sys.PPC64, sys.RISCV64, sys.S390X)
|
sys.ARM64, sys.Loong64, sys.PPC64, sys.RISCV64, sys.S390X)
|
||||||
addF("math", "FMA",
|
addF("math", "FMA",
|
||||||
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
|
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
|
||||||
if !s.config.UseFMA {
|
|
||||||
s.vars[n] = s.callResult(n, callNormal) // types.Types[TFLOAT64]
|
|
||||||
return s.variable(n, types.Types[types.TFLOAT64])
|
|
||||||
}
|
|
||||||
|
|
||||||
if cfg.goamd64 >= 3 {
|
if cfg.goamd64 >= 3 {
|
||||||
return s.newValue3(ssa.OpFMA, types.Types[types.TFLOAT64], args[0], args[1], args[2])
|
return s.newValue3(ssa.OpFMA, types.Types[types.TFLOAT64], args[0], args[1], args[2])
|
||||||
}
|
}
|
||||||
|
|
@ -804,10 +799,6 @@ func initIntrinsics(cfg *intrinsicBuildConfig) {
|
||||||
sys.AMD64)
|
sys.AMD64)
|
||||||
addF("math", "FMA",
|
addF("math", "FMA",
|
||||||
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
|
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
|
||||||
if !s.config.UseFMA {
|
|
||||||
s.vars[n] = s.callResult(n, callNormal) // types.Types[TFLOAT64]
|
|
||||||
return s.variable(n, types.Types[types.TFLOAT64])
|
|
||||||
}
|
|
||||||
addr := s.entryNewValue1A(ssa.OpAddr, types.Types[types.TBOOL].PtrTo(), ir.Syms.ARMHasVFPv4, s.sb)
|
addr := s.entryNewValue1A(ssa.OpAddr, types.Types[types.TBOOL].PtrTo(), ir.Syms.ARMHasVFPv4, s.sb)
|
||||||
v := s.load(types.Types[types.TBOOL], addr)
|
v := s.load(types.Types[types.TBOOL], addr)
|
||||||
b := s.endBlock()
|
b := s.endBlock()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue