[go] cmd/compile/internal/amd64: use X15 for 4- and 8-byte zero stores

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Aug 10, 2026, 1:59:56 PM (16 hours ago) Aug 10
to Egon Elbre, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Keith Randall, Dmitri Shuralyov, Dmitri Shuralyov, golang...@luci-project-accounts.iam.gserviceaccount.com, Jorropo, Keith Randall, Martin Möhrmann, Michael Pratt, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
cmd/compile/internal/amd64: use X15 for 4- and 8-byte zero stores

MOVQ $0, mem encodes two bytes longer than MOVQ X15, mem, and
MOVL $0, mem encodes one byte longer than MOVL X15, mem. In
ABIInternal functions on amd64, X15 is maintained as zero except on
Plan 9.

Use the XMM forms of MOVQ and MOVL when emitting plain and indexed
zero stores. Selecting the encoding during emission leaves the
existing SSA operations available to store-combining rules. Retain
immediate stores for ABI0 and Plan 9, where X15 is not known to
contain zero.

This replaces 5,598 stores when compiling the standard library,
reducing text by 11,004 bytes with no change in instruction count.
Change-Id: Ibccdce5fd17f81be8c2cf505c8144fa612e71101
Reviewed-by: Jorropo <jorro...@gmail.com>
Auto-Submit: Jorropo <jorro...@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Reviewed-by: Keith Randall <k...@google.com>
Files:
  • M src/cmd/compile/internal/amd64/ssa.go
  • M src/runtime/unsafepoint_test.go
  • M test/codegen/math.go
  • M test/codegen/memcombine.go
  • M test/codegen/memops.go
  • M test/codegen/structs.go
  • M test/codegen/zerosize.go
Change size: M
Delta: 7 files changed, 60 insertions(+), 16 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ibccdce5fd17f81be8c2cf505c8144fa612e71101
Gerrit-Change-Number: 810120
Gerrit-PatchSet: 4
Gerrit-Owner: Egon Elbre <egon...@gmail.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Jorropo <jorro...@gmail.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages