From a813be86df74bf2a9c5b272c0b0934d196ac665d Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Fri, 9 Sep 2022 18:43:08 -0400 Subject: [PATCH] cmd/compile: don't use R25 as input for LoweredMove on ARM64 The rule uses R25 as a scratch register. If the input is R25 it will be clobbered on the way, causing wrong result. Change-Id: I464eadbdef0f3a5e90f9ef8c818393baa4335b87 Reviewed-on: https://go-review.googlesource.com/c/go/+/430015 Run-TryBot: Cherry Mui Reviewed-by: Jenny Rakoczy TryBot-Result: Gopher Robot Reviewed-by: Eric Fang --- src/cmd/compile/internal/ssa/gen/ARM64Ops.go | 2 +- src/cmd/compile/internal/ssa/opGen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/ssa/gen/ARM64Ops.go b/src/cmd/compile/internal/ssa/gen/ARM64Ops.go index 5aeaf3ad96f..0e6e6e4a5f3 100644 --- a/src/cmd/compile/internal/ssa/gen/ARM64Ops.go +++ b/src/cmd/compile/internal/ssa/gen/ARM64Ops.go @@ -593,7 +593,7 @@ func init() { name: "LoweredMove", argLength: 4, reg: regInfo{ - inputs: []regMask{buildReg("R17"), buildReg("R16"), gp}, + inputs: []regMask{buildReg("R17"), buildReg("R16"), gp &^ buildReg("R25")}, clobbers: buildReg("R16 R17 R25"), }, clobberFlags: true, diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index 7755ee3c154..4a3abc2b6ae 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -22309,7 +22309,7 @@ var opcodeTable = [...]opInfo{ inputs: []inputInfo{ {0, 131072}, // R17 {1, 65536}, // R16 - {2, 670826495}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 R30 + {2, 637272063}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R26 R30 }, clobbers: 33751040, // R16 R17 R25 },