diff options
| author | Richard Musiol <mail@richard-musiol.de> | 2019-03-05 01:56:17 +0100 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2019-03-14 19:46:19 +0000 |
| commit | 5ee1b849592787ed050ef3fbd9b2c58aabd20ff3 (patch) | |
| tree | 50df3ba82b50ebe09d1fe252b490806be16a1648 /test/codegen/math.go | |
| parent | aa193c0b9623acd7397c0799ffc9efe5845216b2 (diff) | |
| download | go-5ee1b849592787ed050ef3fbd9b2c58aabd20ff3.tar.xz | |
math, math/bits: add intrinsics for wasm
This commit adds compiler intrinsics for the packages math and
math/bits on the wasm architecture for better performance.
benchmark old ns/op new ns/op delta
BenchmarkCeil 8.31 3.21 -61.37%
BenchmarkCopysign 5.24 3.88 -25.95%
BenchmarkAbs 5.42 3.34 -38.38%
BenchmarkFloor 8.29 3.18 -61.64%
BenchmarkRoundToEven 9.76 3.26 -66.60%
BenchmarkSqrtLatency 8.13 4.88 -39.98%
BenchmarkSqrtPrime 5246 3535 -32.62%
BenchmarkTrunc 8.29 3.15 -62.00%
BenchmarkLeadingZeros 13.0 4.23 -67.46%
BenchmarkLeadingZeros8 4.65 4.42 -4.95%
BenchmarkLeadingZeros16 7.60 4.38 -42.37%
BenchmarkLeadingZeros32 10.7 4.48 -58.13%
BenchmarkLeadingZeros64 12.9 4.31 -66.59%
BenchmarkTrailingZeros 6.52 4.04 -38.04%
BenchmarkTrailingZeros8 4.57 4.14 -9.41%
BenchmarkTrailingZeros16 6.69 4.16 -37.82%
BenchmarkTrailingZeros32 6.97 4.23 -39.31%
BenchmarkTrailingZeros64 6.59 4.00 -39.30%
BenchmarkOnesCount 7.93 3.30 -58.39%
BenchmarkOnesCount8 3.56 3.19 -10.39%
BenchmarkOnesCount16 4.85 3.19 -34.23%
BenchmarkOnesCount32 7.27 3.19 -56.12%
BenchmarkOnesCount64 8.08 3.28 -59.41%
BenchmarkRotateLeft 4.88 3.80 -22.13%
BenchmarkRotateLeft64 5.03 3.63 -27.83%
Change-Id: Ic1e0c2984878be8defb6eb7eb6ee63765c793222
Reviewed-on: https://go-review.googlesource.com/c/go/+/165177
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/codegen/math.go')
| -rw-r--r-- | test/codegen/math.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/codegen/math.go b/test/codegen/math.go index aaf6b080ff..597271ce72 100644 --- a/test/codegen/math.go +++ b/test/codegen/math.go @@ -15,12 +15,14 @@ func approx(x float64) { // arm64:"FRINTPD" // ppc64:"FRIP" // ppc64le:"FRIP" + // wasm:"F64Ceil" sink64[0] = math.Ceil(x) // s390x:"FIDBR\t[$]7" // arm64:"FRINTMD" // ppc64:"FRIM" // ppc64le:"FRIM" + // wasm:"F64Floor" sink64[1] = math.Floor(x) // s390x:"FIDBR\t[$]1" @@ -33,10 +35,12 @@ func approx(x float64) { // arm64:"FRINTZD" // ppc64:"FRIZ" // ppc64le:"FRIZ" + // wasm:"F64Trunc" sink64[3] = math.Trunc(x) // s390x:"FIDBR\t[$]4" // arm64:"FRINTND" + // wasm:"F64Nearest" sink64[4] = math.RoundToEven(x) } @@ -47,6 +51,7 @@ func sqrt(x float64) float64 { // arm/7:"SQRTD" // mips/hardfloat:"SQRTD" mips/softfloat:-"SQRTD" // mips64/hardfloat:"SQRTD" mips64/softfloat:-"SQRTD" + // wasm:"F64Sqrt" return math.Sqrt(x) } @@ -57,6 +62,7 @@ func abs(x, y float64) { // s390x:"LPDFR\t",-"MOVD\t" (no integer load/store) // ppc64:"FABS\t" // ppc64le:"FABS\t" + // wasm:"F64Abs" sink64[0] = math.Abs(x) // amd64:"BTRQ\t[$]63","PXOR" (TODO: this should be BTSQ) @@ -78,6 +84,7 @@ func copysign(a, b, c float64) { // s390x:"CPSDR",-"MOVD" (no integer load/store) // ppc64:"FCPSGN" // ppc64le:"FCPSGN" + // wasm:"F64Copysign" sink64[0] = math.Copysign(a, b) // amd64:"BTSQ\t[$]63" |
