From 09932f95f5619f44fa874c780dbbddc073be990a Mon Sep 17 00:00:00 2001 From: Wayne Zuo Date: Fri, 10 Jun 2022 19:06:30 +0800 Subject: 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 Run-TryBot: Wayne Zuo Reviewed-by: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- test/codegen/memcombine.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/codegen') 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` -- cgit v1.3