mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: make math.Ceil/Floor/Round/Trunc intrinsics on arm64
name old time/op new time/op delta Ceil 550ns ± 0% 486ns ± 7% -11.64% (p=0.000 n=13+18) Floor 495ns ±19% 512ns ±12% ~ (p=0.164 n=20+20) Round 550ns ± 0% 487ns ± 8% -11.49% (p=0.000 n=12+19) Trunc 563ns ± 7% 488ns ±13% -13.44% (p=0.000 n=15+2) Change-Id: I53f234b160b3c026a277506e2cf977d150379464 Reviewed-on: https://go-review.googlesource.com/88295 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
ba99433d33
commit
07f0f09563
7 changed files with 170 additions and 6 deletions
|
|
@ -248,7 +248,7 @@ var allAsmTests = []*asmTests{
|
|||
{
|
||||
arch: "arm64",
|
||||
os: "linux",
|
||||
imports: []string{"encoding/binary", "math/bits"},
|
||||
imports: []string{"encoding/binary", "math", "math/bits"},
|
||||
tests: linuxARM64Tests,
|
||||
},
|
||||
{
|
||||
|
|
@ -2849,6 +2849,47 @@ var linuxARM64Tests = []*asmTest{
|
|||
pos: []string{"\tMOVHU\t\\(R[0-9]+\\)"},
|
||||
neg: []string{"ORR\tR[0-9]+<<8\t"},
|
||||
},
|
||||
// Intrinsic tests for math.
|
||||
{
|
||||
fn: `
|
||||
func sqrt(x float64) float64 {
|
||||
return math.Sqrt(x)
|
||||
}
|
||||
`,
|
||||
pos: []string{"FSQRTD"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func ceil(x float64) float64 {
|
||||
return math.Ceil(x)
|
||||
}
|
||||
`,
|
||||
pos: []string{"FRINTPD"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func floor(x float64) float64 {
|
||||
return math.Floor(x)
|
||||
}
|
||||
`,
|
||||
pos: []string{"FRINTMD"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func round(x float64) float64 {
|
||||
return math.Round(x)
|
||||
}
|
||||
`,
|
||||
pos: []string{"FRINTAD"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func trunc(x float64) float64 {
|
||||
return math.Trunc(x)
|
||||
}
|
||||
`,
|
||||
pos: []string{"FRINTZD"},
|
||||
},
|
||||
}
|
||||
|
||||
var linuxMIPSTests = []*asmTest{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue