diff options
| author | Wayne Zuo <wdvxdr@golangcn.org> | 2022-03-30 19:27:21 +0800 |
|---|---|---|
| committer | Emmanuel Odeke <emmanuel@orijtech.com> | 2022-04-03 23:48:16 +0000 |
| commit | ba6df85c7c94c7b26d4979e92fdb9ec7fa4cc1e4 (patch) | |
| tree | e84c8c1e99d11b196c61d36bfcc973d11a514631 /test/codegen | |
| parent | 345184496ce358e663b0150f679d5e5cf1337b41 (diff) | |
| download | go-ba6df85c7c94c7b26d4979e92fdb9ec7fa4cc1e4.tar.xz | |
cmd/compile: add MOVBEWstore support for GOAMD64>=3
This CL add MOVBE support for 16-bit version, but MOVBEWload is
excluded because it does not satisfy zero extented.
For #51724
Change-Id: I3fadf20bcbb9b423f6355e6a1e340107e8e621ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/396617
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/memcombine.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go index 97e1d4bdfb..ad42538dcd 100644 --- a/test/codegen/memcombine.go +++ b/test/codegen/memcombine.go @@ -105,20 +105,20 @@ func load_be32_idx(b []byte, idx int) { sink32 = binary.BigEndian.Uint32(b[idx:]) } -func load_be16(b []byte) { +func load_be16(b []byte) uint16 { // amd64:`ROLW\s\$8`,-`MOVB`,-`OR` // arm64:`REV16W`,`MOVHU\s\(R[0-9]+\),`,-`MOVB` // ppc64le:`MOVHBR` // s390x:`MOVHZ\s\(.*\),`,-`OR`,-`ORW`,-`SLD`,-`SLW` - sink16 = binary.BigEndian.Uint16(b) + return binary.BigEndian.Uint16(b) } -func load_be16_idx(b []byte, idx int) { +func load_be16_idx(b []byte, idx int) uint16 { // amd64:`ROLW\s\$8`,-`MOVB`,-`OR` // arm64:`REV16W`,`MOVHU\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOVB` // ppc64le:`MOVHBR` // s390x:`MOVHZ\s\(.*\)\(.*\*1\),`,-`OR`,-`ORW`,-`SLD`,-`SLW` - sink16 = binary.BigEndian.Uint16(b[idx:]) + return binary.BigEndian.Uint16(b[idx:]) } func load_le_byte2_uint16(s []byte) uint16 { @@ -463,7 +463,8 @@ func store_be32_idx(b []byte, idx int) { } func store_be16(b []byte) { - // amd64:`ROLW\s\$8`,-`SHR.` + // amd64/v1,amd64/v2:`ROLW\s\$8`,-`SHR.` + // amd64/v3:`MOVBEW`,-`ROLW` // arm64:`MOVH`,`REV16W`,-`MOVB` // ppc64le:`MOVHBR` // s390x:`MOVH\s.*\(.*\)$`,-`SRW\s`,-`SRD\s` @@ -471,7 +472,8 @@ func store_be16(b []byte) { } func store_be16_idx(b []byte, idx int) { - // amd64:`ROLW\s\$8`,-`SHR.` + // amd64/v1,amd64/v2:`ROLW\s\$8`,-`SHR.` + // amd64/v3: `MOVBEW` // arm64:`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`MOVB` // ppc64le:`MOVHBR` // s390x:`MOVH\s.*\(.*\)\(.*\*1\)$`,-`SRW\s`,-`SRD\s` @@ -511,7 +513,8 @@ func store_le_byte_8(b []byte, val uint64) { 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` + // amd64/v1,amd64/v2:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB` + // amd64/v3: `MOVBEW` b[1], b[2] = byte(val>>8), byte(val) } |
