]> Cypherpunks repositories - gostls13.git/commit
math: check overflow in amd64 Exp implementation
authorAlberto Donizetti <alb.donizetti@gmail.com>
Fri, 3 Feb 2017 09:36:47 +0000 (10:36 +0100)
committerRuss Cox <rsc@golang.org>
Fri, 10 Feb 2017 13:40:08 +0000 (13:40 +0000)
commitf44e58703115af61e7b03416273031d788c076f1
tree0ae1a5660e99dc95153e19cf955fda4ecdd317c4
parent4fafc843a27940c76f43d0d897d918dab2efd529
math: check overflow in amd64 Exp implementation

Unlike the pure go implementation used by every other architecture,
the amd64 asm implementation of Exp does not fail early if the
argument is known to overflow. Make it fail early.

Cost of the check is < 1ns (on an old Sandy Bridge machine):

name   old time/op  new time/op  delta
Exp-4  18.3ns ± 1%  18.7ns ± 1%  +2.08%  (p=0.000 n=18+20)

Fixes #14932
Fixes #18912

Change-Id: I04b3f9b4ee853822cbdc97feade726fbe2907289
Reviewed-on: https://go-review.googlesource.com/36271
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/math/all_test.go
src/math/exp_amd64.s