1
0
mirror of https://github.com/golang/go synced 2024-11-22 23:50:03 -07:00

test/codegen: add more combined load/store test cases

This CL adds more combined load/store test cases for 386/amd64.

Change-Id: I0a483a6ed0212b65c5e84d67ed8c9f50c389ce2d
Reviewed-on: https://go-review.googlesource.com/c/142878
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Ben Shi 2018-10-17 10:24:28 +00:00
parent 361cf4a880
commit 4158734097

View File

@ -114,17 +114,21 @@ func load_be16_idx(b []byte, idx int) {
func load_le_byte2_uint16(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR`,-`MOVB`
// 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`ORL`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`ORL`
return uint16(s[0]) | uint16(s[1])<<8
}
func load_le_byte2_uint16_inv(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR`,-`MOVB`
// 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`ORL`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`ORL`
return uint16(s[1])<<8 | uint16(s[0])
}
func load_le_byte4_uint32(s []byte) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
// 386:`MOVL\s\([A-Z]+\)`,-`MOVB`,-`OR`-`MOVW`
// amd64:`MOVL\s\([A-Z]+\)`,-`MOVB`,-`OR`-`MOVW`
return uint32(s[0]) | uint32(s[1])<<8 | uint32(s[2])<<16 | uint32(s[3])<<24
}
@ -135,21 +139,25 @@ func load_le_byte4_uint32_inv(s []byte) uint32 {
func load_le_byte8_uint64(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
// amd64:`MOVQ\s\([A-Z]+\),\s[A-Z]+`
return uint64(s[0]) | uint64(s[1])<<8 | uint64(s[2])<<16 | uint64(s[3])<<24 | uint64(s[4])<<32 | uint64(s[5])<<40 | uint64(s[6])<<48 | uint64(s[7])<<56
}
func load_le_byte8_uint64_inv(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
// amd64:`MOVQ\s\([A-Z]+\),\s[A-Z]+`
return uint64(s[7])<<56 | uint64(s[6])<<48 | uint64(s[5])<<40 | uint64(s[4])<<32 | uint64(s[3])<<24 | uint64(s[2])<<16 | uint64(s[1])<<8 | uint64(s[0])
}
func load_be_byte2_uint16(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`ORL`
return uint16(s[0])<<8 | uint16(s[1])
}
func load_be_byte2_uint16_inv(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`ORL`
return uint16(s[1]) | uint16(s[0])<<8
}
@ -160,33 +168,39 @@ func load_be_byte4_uint32(s []byte) uint32 {
func load_be_byte4_uint32_inv(s []byte) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,`REVW`,-`ORR`,-`REV16W`,-`MOV[BH]`
// amd64:`MOVL\s\([A-Z]+\)`,-`MOVB`,-`OR`,-`MOVW`
return uint32(s[3]) | uint32(s[2])<<8 | uint32(s[1])<<16 | uint32(s[0])<<24
}
func load_be_byte8_uint64(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]`
// amd64:`MOVQ\s\([A-Z]+\),\s[A-Z]+`
return uint64(s[0])<<56 | uint64(s[1])<<48 | uint64(s[2])<<40 | uint64(s[3])<<32 | uint64(s[4])<<24 | uint64(s[5])<<16 | uint64(s[6])<<8 | uint64(s[7])
}
func load_be_byte8_uint64_inv(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]`
// amd64:`MOVQ\s\([A-Z]+\),\s[A-Z]+`
return uint64(s[7]) | uint64(s[6])<<8 | uint64(s[5])<<16 | uint64(s[4])<<24 | uint64(s[3])<<32 | uint64(s[2])<<40 | uint64(s[1])<<48 | uint64(s[0])<<56
}
func load_le_byte2_uint16_idx(s []byte, idx int) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOVB`
// 386:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`ORL`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`OR`,-`MOVB`
return uint16(s[idx]) | uint16(s[idx+1])<<8
}
func load_le_byte2_uint16_idx_inv(s []byte, idx int) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOVB`
// 386:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`ORL`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`OR`,-`MOVB`
return uint16(s[idx+1])<<8 | uint16(s[idx])
}
func load_le_byte4_uint32_idx(s []byte, idx int) uint32 {
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
// amd64:`MOVL\s\([A-Z]+\)\([A-Z]+`,-`OR`,-`MOVB`,-`MOVW`
return uint32(s[idx]) | uint32(s[idx+1])<<8 | uint32(s[idx+2])<<16 | uint32(s[idx+3])<<24
}
@ -197,6 +211,7 @@ func load_le_byte4_uint32_idx_inv(s []byte, idx int) uint32 {
func load_le_byte8_uint64_idx(s []byte, idx int) uint64 {
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
// amd64:`MOVQ\s\([A-Z]+\)\([A-Z]+`
return uint64(s[idx]) | uint64(s[idx+1])<<8 | uint64(s[idx+2])<<16 | uint64(s[idx+3])<<24 | uint64(s[idx+4])<<32 | uint64(s[idx+5])<<40 | uint64(s[idx+6])<<48 | uint64(s[idx+7])<<56
}
@ -207,11 +222,13 @@ func load_le_byte8_uint64_idx_inv(s []byte, idx int) uint64 {
func load_be_byte2_uint16_idx(s []byte, idx int) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`OR`,-`MOVB`
return uint16(s[idx])<<8 | uint16(s[idx+1])
}
func load_be_byte2_uint16_idx_inv(s []byte, idx int) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`OR`,-`MOVB`
return uint16(s[idx+1]) | uint16(s[idx])<<8
}
@ -410,6 +427,7 @@ func store_le_byte_2(b []byte, val uint16) {
_ = b[2]
// arm64:`MOVH\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`
// 386:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
// amd64:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
b[1], b[2] = byte(val), byte(val>>8)
}
@ -422,30 +440,36 @@ func store_le_byte_2_inv(b []byte, val uint16) {
func store_le_byte_4(b []byte, val uint32) {
_ = b[4]
// arm64:`MOVW\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`
// 386:`MOVL\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`
// amd64:`MOVL\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`
b[1], b[2], b[3], b[4] = byte(val), byte(val>>8), byte(val>>16), byte(val>>24)
}
func store_le_byte_8(b []byte, val uint64) {
_ = b[8]
// arm64:`MOVD\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`,-`MOVW`
// amd64:`MOVQ\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`,-`MOVL`
b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8] = byte(val), byte(val>>8), byte(val>>16), byte(val>>24), byte(val>>32), byte(val>>40), byte(val>>48), byte(val>>56)
}
func store_be_byte_2(b []byte, val uint16) {
_ = b[2]
// arm64:`REV16W`,`MOVH\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`
// amd64:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
b[1], b[2] = byte(val>>8), byte(val)
}
func store_be_byte_4(b []byte, val uint32) {
_ = b[4]
// arm64:`REVW`,`MOVW\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`,-`REV16W`
// amd64:`MOVL\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`
b[1], b[2], b[3], b[4] = byte(val>>24), byte(val>>16), byte(val>>8), byte(val)
}
func store_be_byte_8(b []byte, val uint64) {
_ = b[8]
// arm64:`REV`,`MOVD\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`,-`MOVW`,-`REV16W`,-`REVW`
// amd64:`MOVQ\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`,-`MOVL`
b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8] = byte(val>>56), byte(val>>48), byte(val>>40), byte(val>>32), byte(val>>24), byte(val>>16), byte(val>>8), byte(val)
}
@ -513,14 +537,22 @@ func store_le_byte_4_idx4_inv(b []byte, idx int, val uint32) {
func zero_byte_2(b1, b2 []byte) {
// bounds checks to guarantee safety of writes below
_, _ = b1[1], b2[1]
b1[0], b1[1] = 0, 0 // arm64:"MOVH\tZR",-"MOVB"
b2[1], b2[0] = 0, 0 // arm64:"MOVH\tZR",-"MOVB"
// arm64:"MOVH\tZR",-"MOVB"
// amd64:`MOVW\s[$]0,\s\([A-Z]+\)`
// 386:`MOVW\s[$]0,\s\([A-Z]+\)`
b1[0], b1[1] = 0, 0
// arm64:"MOVH\tZR",-"MOVB"
b2[1], b2[0] = 0, 0
}
func zero_byte_4(b1, b2 []byte) {
_, _ = b1[3], b2[3]
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"
// arm64:"MOVW\tZR",-"MOVB",-"MOVH"
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)`
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
}
func zero_byte_8(b []byte) {
@ -559,14 +591,21 @@ func zero_byte_2_idx2(b []byte, idx int) {
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"
// arm64:"MOVW\tZR",-"MOVB",-"MOVH"
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)`
h1[0], h1[1] = 0, 0
// arm64:"MOVW\tZR",-"MOVB",-"MOVH"
h2[1], h2[0] = 0, 0
}
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"
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
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
}
func zero_uint16_8(h []uint16) {
@ -577,8 +616,11 @@ func zero_uint16_8(h []uint16) {
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"
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
w1[0], w1[1] = 0, 0
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
w2[1], w2[0] = 0, 0
}
func zero_uint32_4(w1, w2 []uint32) {