mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
test/codegen: port arm64 slice zeroing tests
Finish porting arm64 slice zeroing codegen tests; delete them from asm_test. Change-Id: Id2532df8ba1c340fa662a6b5238daa3de30548be Reviewed-on: https://go-review.googlesource.com/105136 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Giovanni Bajo <rasky@develer.com>
This commit is contained in:
parent
cd682f3832
commit
3e31eb6b84
2 changed files with 48 additions and 158 deletions
|
|
@ -428,160 +428,6 @@ var linuxARM64Tests = []*asmTest{
|
||||||
`,
|
`,
|
||||||
pos: []string{"\tCSEL\t"},
|
pos: []string{"\tCSEL\t"},
|
||||||
},
|
},
|
||||||
// Check that zero stores are combine into larger stores
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(h []uint16) {
|
|
||||||
_ = h[1] // early bounds check to guarantee safety of writes below
|
|
||||||
h[0] = 0
|
|
||||||
h[1] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"MOVW\tZR"},
|
|
||||||
neg: []string{"MOVB", "MOVH"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(h []uint16) {
|
|
||||||
_ = h[1] // early bounds check to guarantee safety of writes below
|
|
||||||
h[1] = 0
|
|
||||||
h[0] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"MOVW\tZR"},
|
|
||||||
neg: []string{"MOVB", "MOVH"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(h []uint16) {
|
|
||||||
_ = h[3] // early bounds check to guarantee safety of writes below
|
|
||||||
h[0] = 0
|
|
||||||
h[1] = 0
|
|
||||||
h[2] = 0
|
|
||||||
h[3] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"MOVD\tZR"},
|
|
||||||
neg: []string{"MOVB", "MOVH", "MOVW"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(h []uint16) {
|
|
||||||
_ = h[3] // early bounds check to guarantee safety of writes below
|
|
||||||
h[2] = 0
|
|
||||||
h[3] = 0
|
|
||||||
h[1] = 0
|
|
||||||
h[0] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"MOVD\tZR"},
|
|
||||||
neg: []string{"MOVB", "MOVH", "MOVW"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(w []uint32) {
|
|
||||||
_ = w[1] // early bounds check to guarantee safety of writes below
|
|
||||||
w[0] = 0
|
|
||||||
w[1] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"MOVD\tZR"},
|
|
||||||
neg: []string{"MOVB", "MOVH", "MOVW"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(w []uint32) {
|
|
||||||
_ = w[1] // early bounds check to guarantee safety of writes below
|
|
||||||
w[1] = 0
|
|
||||||
w[0] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"MOVD\tZR"},
|
|
||||||
neg: []string{"MOVB", "MOVH", "MOVW"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(h []uint16) {
|
|
||||||
_ = h[7] // early bounds check to guarantee safety of writes below
|
|
||||||
h[0] = 0
|
|
||||||
h[1] = 0
|
|
||||||
h[2] = 0
|
|
||||||
h[3] = 0
|
|
||||||
h[4] = 0
|
|
||||||
h[5] = 0
|
|
||||||
h[6] = 0
|
|
||||||
h[7] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"STP"},
|
|
||||||
neg: []string{"MOVB", "MOVH"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(w []uint32) {
|
|
||||||
_ = w[3] // early bounds check to guarantee safety of writes below
|
|
||||||
w[0] = 0
|
|
||||||
w[1] = 0
|
|
||||||
w[2] = 0
|
|
||||||
w[3] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"STP"},
|
|
||||||
neg: []string{"MOVB", "MOVH"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(w []uint32) {
|
|
||||||
_ = w[3] // early bounds check to guarantee safety of writes below
|
|
||||||
w[1] = 0
|
|
||||||
w[0] = 0
|
|
||||||
w[3] = 0
|
|
||||||
w[2] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"STP"},
|
|
||||||
neg: []string{"MOVB", "MOVH"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(d []uint64) {
|
|
||||||
_ = d[1] // early bounds check to guarantee safety of writes below
|
|
||||||
d[0] = 0
|
|
||||||
d[1] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"STP"},
|
|
||||||
neg: []string{"MOVB", "MOVH"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(d []uint64) {
|
|
||||||
_ = d[1] // early bounds check to guarantee safety of writes below
|
|
||||||
d[1] = 0
|
|
||||||
d[0] = 0
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"STP"},
|
|
||||||
neg: []string{"MOVB", "MOVH"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(a *[39]byte) {
|
|
||||||
*a = [39]byte{}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"MOVD"},
|
|
||||||
neg: []string{"MOVB", "MOVH", "MOVW"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fn: `
|
|
||||||
func $(a *[30]byte) {
|
|
||||||
*a = [30]byte{}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
pos: []string{"STP"},
|
|
||||||
neg: []string{"MOVB", "MOVH", "MOVW"},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var linuxMIPS64Tests = []*asmTest{
|
var linuxMIPS64Tests = []*asmTest{
|
||||||
|
|
|
||||||
|
|
@ -186,29 +186,73 @@ func store_be16_idx(b []byte, idx int) {
|
||||||
|
|
||||||
// Check that zero stores are combined into larger stores
|
// Check that zero stores are combined into larger stores
|
||||||
|
|
||||||
func zero_2(b1, b2 []byte) {
|
func zero_byte_2(b1, b2 []byte) {
|
||||||
// bounds checks to guarantee safety of writes below
|
// bounds checks to guarantee safety of writes below
|
||||||
_, _ = b1[1], b2[1]
|
_, _ = b1[1], b2[1]
|
||||||
b1[0], b1[1] = 0, 0 // arm64:"MOVH\tZR",-"MOVB"
|
b1[0], b1[1] = 0, 0 // arm64:"MOVH\tZR",-"MOVB"
|
||||||
b2[1], b2[0] = 0, 0 // arm64:"MOVH\tZR",-"MOVB"
|
b2[1], b2[0] = 0, 0 // arm64:"MOVH\tZR",-"MOVB"
|
||||||
}
|
}
|
||||||
|
|
||||||
func zero_4(b1, b2 []byte) {
|
func zero_byte_4(b1, b2 []byte) {
|
||||||
_, _ = b1[3], b2[3]
|
_, _ = b1[3], b2[3]
|
||||||
b1[0], b1[1], b1[2], b1[3] = 0, 0, 0, 0 // arm64:"MOVW\tZR",-"MOVB",-"MOVH"
|
b1[0], b1[1], b1[2], b1[3] = 0, 0, 0, 0 // arm64:"MOVW\tZR",-"MOVB",-"MOVH"
|
||||||
b2[2], b2[3], b2[1], b2[0] = 0, 0, 0, 0 // arm64:"MOVW\tZR",-"MOVB",-"MOVH"
|
b2[2], b2[3], b2[1], b2[0] = 0, 0, 0, 0 // arm64:"MOVW\tZR",-"MOVB",-"MOVH"
|
||||||
}
|
}
|
||||||
|
|
||||||
func zero_8(b []byte) {
|
func zero_byte_8(b []byte) {
|
||||||
_ = b[7]
|
_ = b[7]
|
||||||
b[0], b[1], b[2], b[3] = 0, 0, 0, 0
|
b[0], b[1], b[2], b[3] = 0, 0, 0, 0
|
||||||
b[4], b[5], b[6], b[7] = 0, 0, 0, 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
|
b[4], b[5], b[6], b[7] = 0, 0, 0, 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
|
||||||
}
|
}
|
||||||
|
|
||||||
func zero_16(b []byte) {
|
func zero_byte_16(b []byte) {
|
||||||
_ = b[15]
|
_ = b[15]
|
||||||
b[0], b[1], b[2], b[3] = 0, 0, 0, 0
|
b[0], b[1], b[2], b[3] = 0, 0, 0, 0
|
||||||
b[4], b[5], b[6], b[7] = 0, 0, 0, 0
|
b[4], b[5], b[6], b[7] = 0, 0, 0, 0
|
||||||
b[8], b[9], b[10], b[11] = 0, 0, 0, 0
|
b[8], b[9], b[10], b[11] = 0, 0, 0, 0
|
||||||
b[12], b[13], b[14], b[15] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH",-"MOVW"
|
b[12], b[13], b[14], b[15] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH",-"MOVW"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func zero_byte_30(a *[30]byte) {
|
||||||
|
*a = [30]byte{} // arm64:"STP",-"MOVB",-"MOVH",-"MOVW"
|
||||||
|
}
|
||||||
|
|
||||||
|
func zero_byte_39(a *[39]byte) {
|
||||||
|
*a = [39]byte{} // arm64:"MOVD",-"MOVB",-"MOVH",-"MOVW"
|
||||||
|
}
|
||||||
|
|
||||||
|
func zero_uint16_2(h1, h2 []uint16) {
|
||||||
|
_, _ = h1[1], h2[1]
|
||||||
|
h1[0], h1[1] = 0, 0 // arm64:"MOVW\tZR",-"MOVB",-"MOVH"
|
||||||
|
h2[1], h2[0] = 0, 0 // arm64:"MOVW\tZR",-"MOVB",-"MOVH"
|
||||||
|
}
|
||||||
|
|
||||||
|
func zero_uint16_4(h1, h2 []uint16) {
|
||||||
|
_, _ = h1[3], h2[3]
|
||||||
|
h1[0], h1[1], h1[2], h1[3] = 0, 0, 0, 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
|
||||||
|
h2[2], h2[3], h2[1], h2[0] = 0, 0, 0, 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
|
||||||
|
}
|
||||||
|
|
||||||
|
func zero_uint16_8(h []uint16) {
|
||||||
|
_ = h[7]
|
||||||
|
h[0], h[1], h[2], h[3] = 0, 0, 0, 0
|
||||||
|
h[4], h[5], h[6], h[7] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH"
|
||||||
|
}
|
||||||
|
|
||||||
|
func zero_uint32_2(w1, w2 []uint32) {
|
||||||
|
_, _ = w1[1], w2[1]
|
||||||
|
w1[0], w1[1] = 0, 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
|
||||||
|
w2[1], w2[0] = 0, 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
|
||||||
|
}
|
||||||
|
|
||||||
|
func zero_uint32_4(w1, w2 []uint32) {
|
||||||
|
_, _ = w1[3], w2[3]
|
||||||
|
w1[0], w1[1], w1[2], w1[3] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH"
|
||||||
|
w2[2], w2[3], w2[1], w2[0] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH"
|
||||||
|
}
|
||||||
|
|
||||||
|
func zero_uint64_2(d1, d2 []uint64) {
|
||||||
|
_, _ = d1[1], d2[1]
|
||||||
|
d1[0], d1[1] = 0, 0 // arm64:"STP",-"MOVB",-"MOVH"
|
||||||
|
d2[1], d2[0] = 0, 0 // arm64:"STP",-"MOVB",-"MOVH"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue