]> Cypherpunks repositories - gostls13.git/commit
math: implement fast path for Exp
authorAgniva De Sarker <agnivade@yahoo.co.in>
Sat, 9 Sep 2017 14:17:37 +0000 (19:47 +0530)
committerKeith Randall <khr@golang.org>
Wed, 20 Sep 2017 21:43:00 +0000 (21:43 +0000)
commitd2f317218bf563121e80b36bb06a8ba46d040a20
tree9b106df1bfdd0751c57edd4501aaf086ca1b4045
parent475df0ebccaf0871c86b2c0b55ee841aede324b7
math: implement fast path for Exp

- using FMA and AVX instructions if available to speed-up
Exp calculation on amd64

- using a data table instead of #define'ed constants because
these instructions do not support loading floating point immediates.
One has to use a memory operand / register.

- Benchmark results on Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz:

Original vs New (non-FMA path)
name  old time/op    new time/op    delta
Exp     16.0ns ± 1%    16.1ns ± 3%   ~     (p=0.308 n=9+10)

Original vs New (FMA path)
name  old time/op    new time/op    delta
Exp     16.0ns ± 1%    13.7ns ± 2%  -14.80%  (p=0.000 n=9+10)

Change-Id: I3d8986925d82b39b95ee979ae06f59d7e591d02e
Reviewed-on: https://go-review.googlesource.com/62590
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/math/exp_amd64.s
src/math/exp_asm.go [new file with mode: 0644]