]> Cypherpunks repositories - gostls13.git/commit
math: add round assembly implementations on riscv64
authorMeng Zhuo <mzh@golangcn.org>
Mon, 22 Jul 2024 07:53:37 +0000 (15:53 +0800)
committerMeng Zhuo <mengzhuo1203@gmail.com>
Wed, 11 Sep 2024 02:28:10 +0000 (02:28 +0000)
commit90391c2e8ad8da167aed53bad5857008a410d0c1
tree66de3a386a54c635575d48d63dd4460bda1921a5
parent2982253c42c7803670b0d32755a3da5578ef1c49
math: add round assembly implementations on riscv64

This CL reapplies CL 504737 and adds integer precision
limitation check, since CL 504737 only checks whether
floating point number is +-Inf or NaN.

This CL is also ~7% faster than CL 504737.

Updates #68322

goos: linux
goarch: riscv64
pkg: math
            │ math.old.bench │           math.new.bench            │
            │     sec/op     │   sec/op     vs base                │
Ceil             54.09n ± 0%   18.72n ± 0%  -65.39% (p=0.000 n=10)
Floor            40.72n ± 0%   18.72n ± 0%  -54.03% (p=0.000 n=10)
Round            20.73n ± 0%   20.73n ± 0%        ~ (p=1.000 n=10)
RoundToEven      24.07n ± 0%   24.07n ± 0%        ~ (p=1.000 n=10)
Trunc            38.72n ± 0%   18.72n ± 0%  -51.65% (p=0.000 n=10)
geomean          33.56n        20.09n       -40.13%

Change-Id: I06cfe2cb9e2535cd705d40b6650a7e71fedd906c
Reviewed-on: https://go-review.googlesource.com/c/go/+/600075
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/math/floor_asm.go
src/math/floor_noasm.go
src/math/floor_riscv64.s [new file with mode: 0644]