• erifan01's avatar
    cmd/compile: intrinsify math.RoundToEven and math.Abs on arm64 · 8149db4f
    erifan01 authored
    math.RoundToEven can be done by one arm64 instruction FRINTND, intrinsify it to improve performance.
    The current pure Go implementation of the function Abs is translated into five instructions on arm64:
    str, ldr, and, str, ldr. The intrinsic implementation requires only one instruction, so in terms of
    performance, intrinsify it is worthwhile.
    
    Benchmarks:
    name           old time/op  new time/op  delta
    Abs-8          3.50ns ± 0%  1.50ns ± 0%  -57.14%  (p=0.000 n=10+10)
    RoundToEven-8  9.26ns ± 0%  1.50ns ± 0%  -83.80%  (p=0.000 n=10+10)
    
    Change-Id: I9456b26ab282b544dfac0154fc86f17aed96ac3d
    Reviewed-on: https://go-review.googlesource.com/116535Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    8149db4f
ssa.go 180 KB