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>
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/src"
- "internal/buildcfg"
)
// A Config holds readonly compilation information.
SoftFloat bool //
Race bool // race detector enabled
BigEndian bool //
- UseFMA bool // Use hardware FMA operation
unalignedOK bool // Unaligned loads/stores are ok
haveBswap64 bool // architecture implements Bswap64
haveBswap32 bool // architecture implements Bswap32
}
c.ctxt = ctxt
c.optimize = optimize
- c.UseFMA = true
c.SoftFloat = softfloat
if softfloat {
c.floatParamRegs = nil // no FP registers in softfloat mode
c.ABI0 = abi.NewABIConfig(0, 0, ctxt.Arch.FixedFrameSize, 0)
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 {
// LoweredWB is secretly a CALL and CALLs on 386 in
// shared mode get rewritten by obj6.go to go through
// useFMA allows targeted debugging w/ GOFMAHASH
// If you have an architecture-dependent FP glitch, this will help you find it.
func (f *Func) useFMA(v *Value) bool {
- if !f.Config.UseFMA {
- return false
- }
if base.FmaHash == nil {
return true
}
sys.ARM64, sys.Loong64, sys.PPC64, sys.RISCV64, sys.S390X)
addF("math", "FMA",
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 {
return s.newValue3(ssa.OpFMA, types.Types[types.TFLOAT64], args[0], args[1], args[2])
}
sys.AMD64)
addF("math", "FMA",
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)
v := s.load(types.Types[types.TBOOL], addr)
b := s.endBlock()