1
0
mirror of https://github.com/golang/go synced 2024-09-30 11:18:33 -06:00

math/big: uses SIMD for some math big functions on s390x

The following benchmarks are improved by the amounts shown
(Others unaffected beyond the level of noise.)
Also adds a test to confirm non-SIMD implementation still correct,
even when run on SIMD-capable machine

Benchmark                   old            new
BenchmarkAddVV/100-18    66148.08 MB/s 117546.19 MB/s 1.8x
BenchmarkAddVV/1000-18   70168.27 MB/s 133478.96 MB/s 1.9x
BenchmarkAddVV/10000-18  67489.80 MB/s 100010.79 MB/s 1.5x
BenchmarkAddVV/100000-18 54329.99 MB/s  69232.45 MB/s 1.3x
BenchmarkAddVW/100-18     9929.10 MB/s  14841.31 MB/s 1.5x
BenchmarkAddVW/1000-18   10583.31 MB/s  18674.44 MB/s 1.76x
BenchmarkAddVW/10000-18  10521.15 MB/s  17484.10 MB/s 1.66x
BenchmarkAddVW/100000-18 10616.56 MB/s  18084.27 MB/s 1.7x

Change-Id: Ic9234c41a43f6c5e9d0e9377de8b4deeefc428a7
Reviewed-on: https://go-review.googlesource.com/32211
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Bill O'Farrell 2016-10-26 18:35:12 -04:00 committed by Brad Fitzpatrick
parent 829aa6732a
commit 1e6b12a201
3 changed files with 1001 additions and 252 deletions

View File

@ -0,0 +1,23 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !math_big_pure_go
package big
func addVV_check(z, x, y []Word) (c Word)
func addVV_vec(z, x, y []Word) (c Word)
func addVV_novec(z, x, y []Word) (c Word)
func subVV_check(z, x, y []Word) (c Word)
func subVV_vec(z, x, y []Word) (c Word)
func subVV_novec(z, x, y []Word) (c Word)
func addVW_check(z, x []Word, y Word) (c Word)
func addVW_vec(z, x []Word, y Word) (c Word)
func addVW_novec(z, x []Word, y Word) (c Word)
func subVW_check(z, x []Word, y Word) (c Word)
func subVW_vec(z, x []Word, y Word) (c Word)
func subVW_novec(z, x []Word, y Word) (c Word)
func hasVectorFacility() bool
var hasVX = hasVectorFacility()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build s390x !math_big_pure_go
package big
import (
"testing"
)
// Tests whether the non vector routines are working, even when the tests are run on a
// vector-capable machine
func TestFunVVnovec(t *testing.T) {
if hasVX == true {
for _, a := range sumVV {
arg := a
testFunVV(t, "addVV_novec", addVV_novec, arg)
arg = argVV{a.z, a.y, a.x, a.c}
testFunVV(t, "addVV_novec symmetric", addVV_novec, arg)
arg = argVV{a.x, a.z, a.y, a.c}
testFunVV(t, "subVV_novec", subVV_novec, arg)
arg = argVV{a.y, a.z, a.x, a.c}
testFunVV(t, "subVV_novec symmetric", subVV_novec, arg)
}
}
}
func TestFunVWnovec(t *testing.T) {
if hasVX == true {
for _, a := range sumVW {
arg := a
testFunVW(t, "addVW_novec", addVW_novec, arg)
arg = argVW{a.x, a.z, a.y, a.c}
testFunVW(t, "subVW_novec", subVW_novec, arg)
}
}
}