runtime: remove duff support for arm64

Change-Id: Ib290079a77a746a8512cd4638310b24164f6a930
Reviewed-on: https://go-review.googlesource.com/c/go/+/679456
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Keith Randall 2025-06-05 21:01:52 -07:00 committed by Gopher Robot
parent 15d6dbc05c
commit e4291e484c
4 changed files with 4 additions and 418 deletions

View file

@ -892,8 +892,6 @@ var optab = []Optab{
{obj.ANOP, C_LCON, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0}, // nop variants, see #40689 {obj.ANOP, C_LCON, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0}, // nop variants, see #40689
{obj.ANOP, C_ZREG, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0}, {obj.ANOP, C_ZREG, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0},
{obj.ANOP, C_VREG, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0}, {obj.ANOP, C_VREG, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0},
{obj.ADUFFZERO, C_NONE, C_NONE, C_NONE, C_SBRA, C_NONE, 5, 4, 0, 0, 0}, // same as AB/ABL
{obj.ADUFFCOPY, C_NONE, C_NONE, C_NONE, C_SBRA, C_NONE, 5, 4, 0, 0, 0}, // same as AB/ABL
{obj.APCALIGN, C_LCON, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0}, // align code {obj.APCALIGN, C_LCON, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0, 0}, // align code
{obj.APCALIGNMAX, C_LCON, C_NONE, C_NONE, C_LCON, C_NONE, 0, 0, 0, 0, 0}, // align code, conditional {obj.APCALIGNMAX, C_LCON, C_NONE, C_NONE, C_LCON, C_NONE, 0, 0, 0, 0, 0}, // align code, conditional
} }
@ -3297,9 +3295,7 @@ func buildop(ctxt *obj.Link) {
obj.AFUNCDATA, obj.AFUNCDATA,
obj.APCALIGN, obj.APCALIGN,
obj.APCALIGNMAX, obj.APCALIGNMAX,
obj.APCDATA, obj.APCDATA:
obj.ADUFFZERO,
obj.ADUFFCOPY:
break break
} }
} }
@ -6971,7 +6967,7 @@ func (c *ctxt7) opbra(p *obj.Prog, a obj.As) uint32 {
case AB: case AB:
return 0<<31 | 5<<26 /* imm26 */ return 0<<31 | 5<<26 /* imm26 */
case obj.ADUFFZERO, obj.ADUFFCOPY, ABL: case ABL:
return 1<<31 | 5<<26 return 1<<31 | 5<<26
} }

View file

@ -319,11 +319,7 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
// Rewrite BR/BL to symbol as TYPE_BRANCH. // Rewrite BR/BL to symbol as TYPE_BRANCH.
switch p.As { switch p.As {
case AB, case AB, ABL, obj.ARET:
ABL,
obj.ARET,
obj.ADUFFZERO,
obj.ADUFFCOPY:
if p.To.Sym != nil { if p.To.Sym != nil {
p.To.Type = obj.TYPE_BRANCH p.To.Type = obj.TYPE_BRANCH
} }
@ -400,39 +396,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
// Rewrite p, if necessary, to access global data via the global offset table. // Rewrite p, if necessary, to access global data via the global offset table.
func (c *ctxt7) rewriteToUseGot(p *obj.Prog) { func (c *ctxt7) rewriteToUseGot(p *obj.Prog) {
if p.As == obj.ADUFFCOPY || p.As == obj.ADUFFZERO {
// ADUFFxxx $offset
// becomes
// MOVD runtime.duffxxx@GOT, REGTMP
// ADD $offset, REGTMP
// CALL REGTMP
var sym *obj.LSym
if p.As == obj.ADUFFZERO {
sym = c.ctxt.LookupABI("runtime.duffzero", obj.ABIInternal)
} else {
sym = c.ctxt.LookupABI("runtime.duffcopy", obj.ABIInternal)
}
offset := p.To.Offset
p.As = AMOVD
p.From.Type = obj.TYPE_MEM
p.From.Name = obj.NAME_GOTREF
p.From.Sym = sym
p.To.Type = obj.TYPE_REG
p.To.Reg = REGTMP
p.To.Name = obj.NAME_NONE
p.To.Offset = 0
p.To.Sym = nil
p1 := obj.Appendp(p, c.newprog)
p1.As = AADD
p1.From.Type = obj.TYPE_CONST
p1.From.Offset = offset
p1.To.Type = obj.TYPE_REG
p1.To.Reg = REGTMP
p2 := obj.Appendp(p1, c.newprog)
p2.As = obj.ACALL
p2.To.Type = obj.TYPE_REG
p2.To.Reg = REGTMP
}
// We only care about global data: NAME_EXTERN means a global // We only care about global data: NAME_EXTERN means a global
// symbol in the Go sense, and p.Sym.Local is true for a few // symbol in the Go sense, and p.Sym.Local is true for a few
@ -543,9 +506,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
case obj.ATEXT: case obj.ATEXT:
p.Mark |= LEAF p.Mark |= LEAF
case ABL, case ABL:
obj.ADUFFZERO,
obj.ADUFFCOPY:
c.cursym.Func().Text.Mark &^= LEAF c.cursym.Func().Text.Mark &^= LEAF
} }
} }
@ -912,110 +873,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
p.From.Reg = REGSP p.From.Reg = REGSP
} }
case obj.ADUFFCOPY:
// ADR ret_addr, R27
// STP (FP, R27), -24(SP)
// SUB 24, SP, FP
// DUFFCOPY
// ret_addr:
// SUB 8, SP, FP
q1 := p
// copy DUFFCOPY from q1 to q4
q4 := obj.Appendp(p, c.newprog)
q4.Pos = p.Pos
q4.As = obj.ADUFFCOPY
q4.To = p.To
q1.As = AADR
q1.From.Type = obj.TYPE_BRANCH
q1.To.Type = obj.TYPE_REG
q1.To.Reg = REG_R27
q2 := obj.Appendp(q1, c.newprog)
q2.Pos = p.Pos
q2.As = ASTP
q2.From.Type = obj.TYPE_REGREG
q2.From.Reg = REGFP
q2.From.Offset = int64(REG_R27)
q2.To.Type = obj.TYPE_MEM
q2.To.Reg = REGSP
q2.To.Offset = -24
// maintain FP for DUFFCOPY
q3 := obj.Appendp(q2, c.newprog)
q3.Pos = p.Pos
q3.As = ASUB
q3.From.Type = obj.TYPE_CONST
q3.From.Offset = 24
q3.Reg = REGSP
q3.To.Type = obj.TYPE_REG
q3.To.Reg = REGFP
q5 := obj.Appendp(q4, c.newprog)
q5.Pos = p.Pos
q5.As = ASUB
q5.From.Type = obj.TYPE_CONST
q5.From.Offset = 8
q5.Reg = REGSP
q5.To.Type = obj.TYPE_REG
q5.To.Reg = REGFP
q1.From.SetTarget(q5)
p = q5
case obj.ADUFFZERO:
// ADR ret_addr, R27
// STP (FP, R27), -24(SP)
// SUB 24, SP, FP
// DUFFZERO
// ret_addr:
// SUB 8, SP, FP
q1 := p
// copy DUFFZERO from q1 to q4
q4 := obj.Appendp(p, c.newprog)
q4.Pos = p.Pos
q4.As = obj.ADUFFZERO
q4.To = p.To
q1.As = AADR
q1.From.Type = obj.TYPE_BRANCH
q1.To.Type = obj.TYPE_REG
q1.To.Reg = REG_R27
q2 := obj.Appendp(q1, c.newprog)
q2.Pos = p.Pos
q2.As = ASTP
q2.From.Type = obj.TYPE_REGREG
q2.From.Reg = REGFP
q2.From.Offset = int64(REG_R27)
q2.To.Type = obj.TYPE_MEM
q2.To.Reg = REGSP
q2.To.Offset = -24
// maintain FP for DUFFZERO
q3 := obj.Appendp(q2, c.newprog)
q3.Pos = p.Pos
q3.As = ASUB
q3.From.Type = obj.TYPE_CONST
q3.From.Offset = 24
q3.Reg = REGSP
q3.To.Type = obj.TYPE_REG
q3.To.Reg = REGFP
q5 := obj.Appendp(q4, c.newprog)
q5.Pos = p.Pos
q5.As = ASUB
q5.From.Type = obj.TYPE_CONST
q5.From.Offset = 8
q5.Reg = REGSP
q5.To.Type = obj.TYPE_REG
q5.To.Reg = REGFP
q1.From.SetTarget(q5)
p = q5
} }
if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 { if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
f := c.cursym.Func() f := c.cursym.Func()
if f.FuncFlag&abi.FuncFlagSPWrite == 0 { if f.FuncFlag&abi.FuncFlagSPWrite == 0 {

View file

@ -1,267 +0,0 @@
// Code generated by mkduff.go; DO NOT EDIT.
// Run go generate from src/runtime to update.
// See mkduff.go for comments.
#include "textflag.h"
TEXT runtime·duffzero<ABIInternal>(SB), NOSPLIT|NOFRAME, $0-0
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP.P (ZR, ZR), 16(R20)
STP (ZR, ZR), (R20)
RET
TEXT runtime·duffcopy<ABIInternal>(SB), NOSPLIT|NOFRAME, $0-0
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
LDP.P 16(R20), (R26, R27)
STP.P (R26, R27), 16(R21)
RET

View file

@ -35,7 +35,6 @@ func main() {
gen("amd64", notags, zeroAMD64, copyAMD64) gen("amd64", notags, zeroAMD64, copyAMD64)
gen("386", notags, zero386, copy386) gen("386", notags, zero386, copy386)
gen("arm", notags, zeroARM, copyARM) gen("arm", notags, zeroARM, copyARM)
gen("arm64", notags, zeroARM64, copyARM64)
gen("loong64", notags, zeroLOONG64, copyLOONG64) gen("loong64", notags, zeroLOONG64, copyLOONG64)
gen("ppc64x", tagsPPC64x, zeroPPC64x, copyPPC64x) gen("ppc64x", tagsPPC64x, zeroPPC64x, copyPPC64x)
gen("mips64x", tagsMIPS64x, zeroMIPS64x, copyMIPS64x) gen("mips64x", tagsMIPS64x, zeroMIPS64x, copyMIPS64x)