1
0
mirror of https://github.com/golang/go synced 2024-11-13 20:10:32 -07:00

cmd/compile: add code generation tests for sqrt intrinsics

Add "sqrt-intrisified" code generation tests for mips64 and 386, where
we weren't intrisifying math.Sqrt (see CL 96615 and CL 95916), and for
mips and amd64, which lacked sqrt intrinsics tests.

Change-Id: I0cfc08aec6eefd47f3cd7a5995a89393e8b7ed9e
Reviewed-on: https://go-review.googlesource.com/96716
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Alberto Donizetti 2018-02-23 11:42:49 +01:00
parent fceaa2e242
commit 37a038a3dc

View File

@ -230,7 +230,7 @@ var allAsmTests = []*asmTests{
{
arch: "386",
os: "linux",
imports: []string{"encoding/binary"},
imports: []string{"encoding/binary", "math"},
tests: linux386Tests,
},
{
@ -254,13 +254,14 @@ var allAsmTests = []*asmTests{
{
arch: "mips",
os: "linux",
imports: []string{"math/bits"},
imports: []string{"math/bits", "math"},
tests: linuxMIPSTests,
},
{
arch: "mips64",
os: "linux",
tests: linuxMIPS64Tests,
arch: "mips64",
os: "linux",
imports: []string{"math"},
tests: linuxMIPS64Tests,
},
{
arch: "ppc64le",
@ -822,6 +823,14 @@ var linuxAMD64Tests = []*asmTest{
}`,
pos: []string{"\tPOPCNTQ\t", "support_popcnt"},
},
{
fn: `
func $(x float64) float64 {
return math.Sqrt(x)
}
`,
pos: []string{"SQRTSD"},
},
// multiplication merging tests
{
fn: `
@ -1909,6 +1918,16 @@ var linux386Tests = []*asmTest{
`,
neg: []string{"memmove"},
},
// Intrinsic tests for math
{
fn: `
func $(x float64) float64 {
return math.Sqrt(x)
}
`,
pos: []string{"FSQRT|SQRTSD"}, // 387|sse2
},
}
var linuxS390XTests = []*asmTest{
@ -2906,6 +2925,7 @@ var linuxARM64Tests = []*asmTest{
}
var linuxMIPSTests = []*asmTest{
// Intrinsic tests for math/bits
{
fn: `
func f0(a uint64) int {
@ -2986,6 +3006,15 @@ var linuxMIPSTests = []*asmTest{
`,
pos: []string{"\tCLZ\t"},
},
// Intrinsic tests for math.
{
fn: `
func $(x float64) float64 {
return math.Sqrt(x)
}
`,
pos: []string{"SQRTD"},
},
{
// check that stack store is optimized away
fn: `
@ -3009,6 +3038,15 @@ var linuxMIPS64Tests = []*asmTest{
pos: []string{"SLLV\t\\$17"},
neg: []string{"SGT"},
},
// Intrinsic tests for math.
{
fn: `
func $(x float64) float64 {
return math.Sqrt(x)
}
`,
pos: []string{"SQRTD"},
},
}
var linuxPPC64LETests = []*asmTest{