]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: declare no output register for loong64 LoweredAtomic{And,Or}32 ops
authorWANG Xuerui <git@xen0n.name>
Thu, 9 Oct 2025 07:52:02 +0000 (15:52 +0800)
committerabner chenc <chenguoqi@loongson.cn>
Fri, 10 Oct 2025 01:07:03 +0000 (18:07 -0700)
commit954fdcc51a678a2b84edb29ef4c3743b318a6fd8
treee17148113cee6f7b58ff0561a2ef05f273a13002
parent19a30ea3f250f8d6258f3e08aa3561f1193fdd38
cmd/compile: declare no output register for loong64 LoweredAtomic{And,Or}32 ops

The ICE seen on loong64 while compiling the `(*gcWork).tryStealSpan`
function was due to an `LoweredAtomicAnd32` op (inlined from the
`(pMask).clear` implementation) being incorrectly assigned an output
register while it shouldn't have. Because the op is of mem type, it has
needRegister() == false; hence in the shuffle phase of regalloc, its
bogus output register has no associated `orig` value recorded. The bug
was introduced in CL 482756, but only recently exposed by CL 696035.

Since the old-style atomic ops need no return value (and is even
documented so besides the loong64 ssa op definition), just fix the
register info for both.

While at it, add a note in the ssa op definition file about the
architectural necessity of resultNotInArgs for loong64 atomic ops,
because the practice is not seen in several other arches I have
checked.

Updates #75776

Change-Id: I087f51b8a2825d7b00fc3965b0afcc8b02cad277
Reviewed-on: https://go-review.googlesource.com/c/go/+/710475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go
src/cmd/compile/internal/ssa/opGen.go