mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
19a30ea3f2
commit
954fdcc51a
2 changed files with 9 additions and 8 deletions
|
|
@ -143,6 +143,7 @@ func init() {
|
|||
gp2load = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{gp}}
|
||||
gpstore = regInfo{inputs: []regMask{gpspsbg, gpg}}
|
||||
gpstore2 = regInfo{inputs: []regMask{gpspsbg, gpg, gpg | rz}}
|
||||
gpoldatom = regInfo{inputs: []regMask{gpspsbg, gpg}}
|
||||
gpxchg = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{gp}}
|
||||
gpcas = regInfo{inputs: []regMask{gpspsbg, gpg, gpg}, outputs: []regMask{gp}}
|
||||
preldreg = regInfo{inputs: []regMask{gpspg}}
|
||||
|
|
@ -431,6 +432,12 @@ func init() {
|
|||
faultOnNilArg1: true,
|
||||
},
|
||||
|
||||
// Atomic operations.
|
||||
//
|
||||
// resultNotInArgs is needed by all ops lowering to LoongArch
|
||||
// atomic memory access instructions, because these instructions
|
||||
// are defined to require rd != rj && rd != rk per the ISA spec.
|
||||
|
||||
// atomic loads.
|
||||
// load from arg0. arg1=mem.
|
||||
// returns <value,memory> so they can be properly ordered with other loads.
|
||||
|
|
@ -500,8 +507,8 @@ func init() {
|
|||
|
||||
// Atomic 32 bit AND/OR.
|
||||
// *arg0 &= (|=) arg1. arg2=mem. returns nil.
|
||||
{name: "LoweredAtomicAnd32", argLength: 3, reg: gpxchg, asm: "AMANDDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
|
||||
{name: "LoweredAtomicOr32", argLength: 3, reg: gpxchg, asm: "AMORDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
|
||||
{name: "LoweredAtomicAnd32", argLength: 3, reg: gpoldatom, asm: "AMANDDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
|
||||
{name: "LoweredAtomicOr32", argLength: 3, reg: gpoldatom, asm: "AMORDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
|
||||
|
||||
// Atomic 32,64 bit AND/OR.
|
||||
// *arg0 &= (|=) arg1. arg2=mem. returns <old content of *arg0, memory>. auxint must be zero.
|
||||
|
|
|
|||
|
|
@ -26392,9 +26392,6 @@ var opcodeTable = [...]opInfo{
|
|||
{1, 1073741816}, // R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 g R23 R24 R25 R26 R27 R28 R29 R31
|
||||
{0, 4611686019501129724}, // SP R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 g R23 R24 R25 R26 R27 R28 R29 R31 SB
|
||||
},
|
||||
outputs: []outputInfo{
|
||||
{0, 1071644664}, // R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 R23 R24 R25 R26 R27 R28 R29 R31
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -26409,9 +26406,6 @@ var opcodeTable = [...]opInfo{
|
|||
{1, 1073741816}, // R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 g R23 R24 R25 R26 R27 R28 R29 R31
|
||||
{0, 4611686019501129724}, // SP R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 g R23 R24 R25 R26 R27 R28 R29 R31 SB
|
||||
},
|
||||
outputs: []outputInfo{
|
||||
{0, 1071644664}, // R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 R23 R24 R25 R26 R27 R28 R29 R31
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue