aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2019-11-04 20:36:21 -0500
committerRuss Cox <rsc@golang.org>2019-11-07 14:53:38 +0000
commite8f01d591f9be2653bfb13c0214c4c96b64aa028 (patch)
treee35b60521034914a4edaba49700c51266c7e398f /src/math
parent543c6d2e0dcd24886fce6c00e84b7238c30c1c0b (diff)
downloadgo-e8f01d591f9be2653bfb13c0214c4c96b64aa028.tar.xz
math: test portable FMA even on system with hardware FMA
This makes it a little less likely the portable FMA will be broken without realizing it. Change-Id: I7f7f4509b35160a9709f8b8a0e494c09ea6e410a Reviewed-on: https://go-review.googlesource.com/c/go/+/205337 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/math')
-rw-r--r--src/math/all_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/math/all_test.go b/src/math/all_test.go
index e9621e6dc9..1ac9d71a25 100644
--- a/src/math/all_test.go
+++ b/src/math/all_test.go
@@ -3053,12 +3053,18 @@ func TestYn(t *testing.T) {
}
}
+var PortableFMA = FMA // hide call from compiler intrinsic; falls back to portable code
+
func TestFMA(t *testing.T) {
for _, c := range fmaC {
got := FMA(c.x, c.y, c.z)
if !alike(got, c.want) {
t.Errorf("FMA(%g,%g,%g) == %g; want %g", c.x, c.y, c.z, got, c.want)
}
+ got = PortableFMA(c.x, c.y, c.z)
+ if !alike(got, c.want) {
+ t.Errorf("PortableFMA(%g,%g,%g) == %g; want %g", c.x, c.y, c.z, got, c.want)
+ }
}
}