• Agniva De Sarker's avatar
    math: implement fast path for Exp · d2f31721
    Agniva De Sarker authored
    - 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/62590Reviewed-by: 's avatarIlya Tocar <ilya.tocar@intel.com>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    Run-TryBot: Keith Randall <khr@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    d2f31721
exp_asm.go 269 Bytes