From 7a6da218b191de13f4f3555c55aab958b09b66bd Mon Sep 17 00:00:00 2001 From: smasher164 Date: Tue, 25 Sep 2018 03:10:33 -0400 Subject: cmd/compile: add fma intrinsic for amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To permit ssa-level optimization, this change introduces an amd64 intrinsic that generates the VFMADD231SD instruction for the fused-multiply-add operation on systems that support it. System support is detected via cpu.X86.HasFMA. A rewrite rule can then translate the generic ssa intrinsic ("Fma") to VFMADD231SD. The benchmark compares the software implementation (old) with the intrinsic (new). name old time/op new time/op delta Fma-4 27.2ns ± 1% 1.0ns ± 9% -96.48% (p=0.008 n=5+5) Updates #25819. Change-Id: I966655e5f96817a5d06dff5942418a3915b09584 Reviewed-on: https://go-review.googlesource.com/c/go/+/137156 Run-TryBot: Keith Randall TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- test/codegen/math.go | 1 + 1 file changed, 1 insertion(+) (limited to 'test/codegen') diff --git a/test/codegen/math.go b/test/codegen/math.go index 427f305c12..c942085480 100644 --- a/test/codegen/math.go +++ b/test/codegen/math.go @@ -108,6 +108,7 @@ func copysign(a, b, c float64) { } func fma(x, y, z float64) float64 { + // amd64:"VFMADD231SD" // arm64:"FMADDD" // s390x:"FMADD" // ppc64:"FMADD" -- cgit v1.3-5-g9baa