cmd/compile: intrinsics for trunc, floor, ceil on ppc64x

This implements trunc, floor, and ceil in the math package
as intrinsics on ppc64x.  Significant improvement mainly due
to avoiding call overhead of args and return value.

BenchmarkCeil-16                    5.95          0.69          -88.40%
BenchmarkFloor-16                   5.95          0.69          -88.40%
BenchmarkTrunc-16                   5.82          0.69          -88.14%

Updates #21390

Change-Id: I951e182694f6e0c431da79c577272b81fb0ebad0
Reviewed-on: https://go-review.googlesource.com/54654
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Lynn Boger 2017-08-09 13:53:34 -04:00
parent 3cb41be817
commit 0f19e24da7
7 changed files with 125 additions and 2 deletions

View file

@ -255,7 +255,10 @@ var genericOps = []opData{
{name: "PopCount32", argLength: 1}, // Count bits in arg[0]
{name: "PopCount64", argLength: 1}, // Count bits in arg[0]
{name: "Sqrt", argLength: 1}, // sqrt(arg0), float64 only
{name: "Sqrt", argLength: 1}, // sqrt(arg0), float64 only
{name: "Floor", argLength: 1}, // floor(arg0), float64 only
{name: "Ceil", argLength: 1}, // ceil(arg0), float64 only
{name: "Trunc", argLength: 1}, // trunc(arg0), float64 only
// Data movement, max argument length for Phi is indefinite so just pick
// a really large number