]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: add rule to coalesce writes
authorAlejandro GarcĂ­a Montoro <alejandro.garciamontoro@gmail.com>
Wed, 30 Dec 2020 17:41:36 +0000 (18:41 +0100)
committerJosh Bleecher Snyder <josharian@gmail.com>
Wed, 24 Feb 2021 19:25:49 +0000 (19:25 +0000)
commitbf48163e8f2b604f3b9e83951e331cd11edd8495
treef331bc8eb53e8fd69fb722384958cbff86695ab0
parentb7f62daa59ea5983d5825e166abc527d4ea69777
cmd/compile: add rule to coalesce writes

The code generated when storing eight bytes loaded from memory created a
series of small writes instead of a single, large one. The specific
pattern of instructions generated stored 1 byte, then 2 bytes, then 4
bytes, and finally 1 byte.

The new rules match this specific pattern both for amd64 and for s390x,
and convert it into a single instruction to store the 8 bytes. arm64 and
ppc64le already generated the right code, but the new codegen test
covers also those architectures.

Fixes #41663

Change-Id: Ifb9b464be2d59c2ed5034acf7b9c3e473f344030
Reviewed-on: https://go-review.googlesource.com/c/go/+/280456
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/gen/S390X.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssa/rewriteS390X.go
test/codegen/memcombine.go