mirror of
https://github.com/golang/go
synced 2024-11-17 21:54:49 -07:00
math: speed up Log on amd64
After https://golang.org/cl/31490 we break false output dependency for CVTS.. in compiler generated code. I've looked through asm code, which uses CVTS.. and added XOR to the only case where it affected performance. Log-6 21.6ns ± 0% 19.9ns ± 0% -7.87% (p=0.000 n=10+10) Change-Id: I25d9b405e3041a3839b40f9f9a52e708034bb347 Reviewed-on: https://go-review.googlesource.com/38771 Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
41fd8d6401
commit
4f579cc65b
@ -41,6 +41,7 @@ TEXT ·Log(SB),NOSPLIT,$0
|
|||||||
SHRQ $52, BX
|
SHRQ $52, BX
|
||||||
ANDL $0x7FF, BX
|
ANDL $0x7FF, BX
|
||||||
SUBL $0x3FE, BX
|
SUBL $0x3FE, BX
|
||||||
|
XORPS X1, X1 // break dependency for CVTSL2SD
|
||||||
CVTSL2SD BX, X1 // x1= k, x2= f1
|
CVTSL2SD BX, X1 // x1= k, x2= f1
|
||||||
// if f1 < math.Sqrt2/2 { k -= 1; f1 *= 2 }
|
// if f1 < math.Sqrt2/2 { k -= 1; f1 *= 2 }
|
||||||
MOVSD $HSqrt2, X0 // x0= 0.7071, x1= k, x2= f1
|
MOVSD $HSqrt2, X0 // x0= 0.7071, x1= k, x2= f1
|
||||||
|
Loading…
Reference in New Issue
Block a user