• Lynn Boger's avatar
    cmd/compile,cmd/internal/obj/ppc64: make math.Abs,math.Copysign instrinsics on ppc64x · 4d0151ed
    Lynn Boger authored
    This adds support for math Abs, Copysign to be instrinsics on ppc64x.
    
    New instruction FCPSGN is added to generate fcpsgn. Some new
    rules are added to improve the int<->float conversions that are
    generated mainly due to the Float64bits and Float64frombits in
    the math package. PPC64.rules is also modified as suggested
    in the review for CL 63290.
    
    Improvements:
    benchmark                           old ns/op     new ns/op     delta
    BenchmarkAbs-16                   1.12          0.69          -38.39%
    BenchmarkCopysign-16              1.30          0.93          -28.46%
    BenchmarkNextafter32-16           9.34          8.05          -13.81%
    BenchmarkFrexp-16                 8.81          7.60          -13.73%
    
    Others that used Copysign also saw smaller improvements.
    
    I attempted to make this work using rules since that
    seems to be preferred, but due to the use of Float64bits and
    Float64frombits in these functions, several rules had to be added and
    even then not all cases were matched. Using rules became too
    complicated and seemed too fragile for these.
    
    Updates #21390
    
    Change-Id: Ia265da9a18355e08000818a4fba1a40e9e031995
    Reviewed-on: https://go-review.googlesource.com/67130
    Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    4d0151ed
a.out.go 12.3 KB