aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorWayne Zuo <wdvxdr@golangcn.org>2022-06-10 19:06:30 +0800
committerKeith Randall <khr@google.com>2022-08-15 16:19:21 +0000
commit09932f95f5619f44fa874c780dbbddc073be990a (patch)
tree37139fd57f663b71e375d9928e0fd431b5013438 /test/codegen
parent8adc63b3eb21e8bbacd13335bcf8d6b3a9a507c4 (diff)
downloadgo-09932f95f5619f44fa874c780dbbddc073be990a.tar.xz
cmd/compile: combine more constant stores on amd64
Fixes #53324 Change-Id: I06149d860f858b082235e9d80bf0ea494679b386 Reviewed-on: https://go-review.googlesource.com/c/go/+/411614 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/memcombine.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go
index 6e0132744c..8143b6bed5 100644
--- a/test/codegen/memcombine.go
+++ b/test/codegen/memcombine.go
@@ -377,6 +377,11 @@ func store_le64_idx2(dst []byte, d, length, offset int) []byte {
return dst
}
+func store_le64_idx_const(b []byte, idx int) {
+ // amd64:`MOVQ\s\$123, \(.*\)\(.*\*1\)$`
+ binary.LittleEndian.PutUint64(b[idx:], 123)
+}
+
func store_le64_load(b []byte, x *[8]byte) {
_ = b[8]
// amd64:-`MOV[BWL]`
@@ -402,6 +407,11 @@ func store_le32_idx(b []byte, x uint32, idx int) {
binary.LittleEndian.PutUint32(b[idx:], x)
}
+func store_le32_idx_const(b []byte, idx int) {
+ // amd64:`MOVL\s\$123, \(.*\)\(.*\*1\)$`
+ binary.LittleEndian.PutUint32(b[idx:], 123)
+}
+
func store_le16(b []byte, x uint16) {
// amd64:`MOVW\s`
// arm64:`MOVH`,-`MOVB`
@@ -418,6 +428,11 @@ func store_le16_idx(b []byte, x uint16, idx int) {
binary.LittleEndian.PutUint16(b[idx:], x)
}
+func store_le16_idx_const(b []byte, idx int) {
+ // amd64:`MOVW\s\$123, \(.*\)\(.*\*1\)$`
+ binary.LittleEndian.PutUint16(b[idx:], 123)
+}
+
func store_be64(b []byte, x uint64) {
// amd64/v1,amd64/v2:`BSWAPQ`,-`SHR.`
// amd64/v3: `MOVBEQ`