aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorJunyang Shao <shaojunyang@google.com>2025-03-31 17:50:10 +0000
committerGopher Robot <gobot@golang.org>2025-05-20 13:00:16 -0700
commit113b25774ed8d1d915ae4e1adf9222865ccb0695 (patch)
treed8793709e28fbc23f01ec7e5136b2eed841837e5 /test/codegen
parentfa42585dadb8d70191820549435820cb70691cf6 (diff)
downloadgo-113b25774ed8d1d915ae4e1adf9222865ccb0695.tar.xz
cmd/compile: memcombine different size stores
This CL implements the TODO in combineStores to allow combining stores of different sizes, as long as the total size aligns to 2, 4, 8. Fixes #72832. Change-Id: I6d1d471335da90d851ad8f3b5a0cf10bdcfa17c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/661855 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Junyang Shao <shaojunyang@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/issue72832.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/codegen/issue72832.go b/test/codegen/issue72832.go
new file mode 100644
index 0000000000..a7f6ca8c5c
--- /dev/null
+++ b/test/codegen/issue72832.go
@@ -0,0 +1,41 @@
+// asmcheck
+
+// Copyright 2025 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package codegen
+
+type tile1 struct {
+ a uint16
+ b uint16
+ c uint32
+}
+
+func store_tile1(t *tile1) {
+ // amd64:`MOVQ`
+ t.a, t.b, t.c = 1, 1, 1
+}
+
+type tile2 struct {
+ a, b, c, d, e int8
+}
+
+func store_tile2(t *tile2) {
+ // amd64:`MOVW`
+ t.a, t.b = 1, 1
+ // amd64:`MOVW`
+ t.d, t.e = 1, 1
+}
+
+type tile3 struct {
+ a, b uint8
+ c uint16
+}
+
+func store_shifted(t *tile3, x uint32) {
+ // amd64:`MOVL`
+ t.a = uint8(x)
+ t.b = uint8(x >> 8)
+ t.c = uint16(x >> 16)
+}