mirror of
https://github.com/golang/go
synced 2024-11-14 08:50:22 -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:
parent
fceaa2e242
commit
37a038a3dc
@ -230,7 +230,7 @@ var allAsmTests = []*asmTests{
|
|||||||
{
|
{
|
||||||
arch: "386",
|
arch: "386",
|
||||||
os: "linux",
|
os: "linux",
|
||||||
imports: []string{"encoding/binary"},
|
imports: []string{"encoding/binary", "math"},
|
||||||
tests: linux386Tests,
|
tests: linux386Tests,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -254,13 +254,14 @@ var allAsmTests = []*asmTests{
|
|||||||
{
|
{
|
||||||
arch: "mips",
|
arch: "mips",
|
||||||
os: "linux",
|
os: "linux",
|
||||||
imports: []string{"math/bits"},
|
imports: []string{"math/bits", "math"},
|
||||||
tests: linuxMIPSTests,
|
tests: linuxMIPSTests,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arch: "mips64",
|
arch: "mips64",
|
||||||
os: "linux",
|
os: "linux",
|
||||||
tests: linuxMIPS64Tests,
|
imports: []string{"math"},
|
||||||
|
tests: linuxMIPS64Tests,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arch: "ppc64le",
|
arch: "ppc64le",
|
||||||
@ -822,6 +823,14 @@ var linuxAMD64Tests = []*asmTest{
|
|||||||
}`,
|
}`,
|
||||||
pos: []string{"\tPOPCNTQ\t", "support_popcnt"},
|
pos: []string{"\tPOPCNTQ\t", "support_popcnt"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fn: `
|
||||||
|
func $(x float64) float64 {
|
||||||
|
return math.Sqrt(x)
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
pos: []string{"SQRTSD"},
|
||||||
|
},
|
||||||
// multiplication merging tests
|
// multiplication merging tests
|
||||||
{
|
{
|
||||||
fn: `
|
fn: `
|
||||||
@ -1909,6 +1918,16 @@ var linux386Tests = []*asmTest{
|
|||||||
`,
|
`,
|
||||||
neg: []string{"memmove"},
|
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{
|
var linuxS390XTests = []*asmTest{
|
||||||
@ -2906,6 +2925,7 @@ var linuxARM64Tests = []*asmTest{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var linuxMIPSTests = []*asmTest{
|
var linuxMIPSTests = []*asmTest{
|
||||||
|
// Intrinsic tests for math/bits
|
||||||
{
|
{
|
||||||
fn: `
|
fn: `
|
||||||
func f0(a uint64) int {
|
func f0(a uint64) int {
|
||||||
@ -2986,6 +3006,15 @@ var linuxMIPSTests = []*asmTest{
|
|||||||
`,
|
`,
|
||||||
pos: []string{"\tCLZ\t"},
|
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
|
// check that stack store is optimized away
|
||||||
fn: `
|
fn: `
|
||||||
@ -3009,6 +3038,15 @@ var linuxMIPS64Tests = []*asmTest{
|
|||||||
pos: []string{"SLLV\t\\$17"},
|
pos: []string{"SLLV\t\\$17"},
|
||||||
neg: []string{"SGT"},
|
neg: []string{"SGT"},
|
||||||
},
|
},
|
||||||
|
// Intrinsic tests for math.
|
||||||
|
{
|
||||||
|
fn: `
|
||||||
|
func $(x float64) float64 {
|
||||||
|
return math.Sqrt(x)
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
pos: []string{"SQRTD"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var linuxPPC64LETests = []*asmTest{
|
var linuxPPC64LETests = []*asmTest{
|
||||||
|
Loading…
Reference in New Issue
Block a user