aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorlimeidan <limeidan@loongson.cn>2025-09-01 09:21:13 +0800
committerGopher Robot <gobot@golang.org>2025-09-04 09:24:12 -0700
commit4f7bbc62c791d7e82218dbc097294649352de684 (patch)
treec1726ab5919c96bfed8ddb506a4e795bcabb2e1c /src/cmd
parentb8cc907425c4b851d2b941cf689cf8177ea8a153 (diff)
downloadgo-4f7bbc62c791d7e82218dbc097294649352de684.tar.xz
runtime, cmd/compile, cmd/internal/obj: remove duff support for loong64
Change-Id: I44d6452933c8010f7dfbf821a32053f9d1cf151e Reviewed-on: https://go-review.googlesource.com/c/go/+/700096 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/loong64/ssa.go13
-rw-r--r--src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go37
-rw-r--r--src/cmd/compile/internal/ssa/opGen.go28
-rw-r--r--src/cmd/internal/obj/loong64/a.out.go2
-rw-r--r--src/cmd/internal/obj/loong64/asm.go10
-rw-r--r--src/cmd/internal/obj/loong64/obj.go44
6 files changed, 4 insertions, 130 deletions
diff --git a/src/cmd/compile/internal/loong64/ssa.go b/src/cmd/compile/internal/loong64/ssa.go
index 3959f8a7c1..134575c85c 100644
--- a/src/cmd/compile/internal/loong64/ssa.go
+++ b/src/cmd/compile/internal/loong64/ssa.go
@@ -552,13 +552,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpLOONG64DUFFZERO:
- // runtime.duffzero expects start address in R20
- p := s.Prog(obj.ADUFFZERO)
- p.To.Type = obj.TYPE_MEM
- p.To.Name = obj.NAME_EXTERN
- p.To.Sym = ir.Syms.Duffzero
- p.To.Offset = v.AuxInt
case ssa.OpLOONG64LoweredZero:
ptrReg := v.Args[0].Reg()
n := v.AuxInt
@@ -652,12 +645,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
zero8(s, ptrReg, off+n-8)
}
- case ssa.OpLOONG64DUFFCOPY:
- p := s.Prog(obj.ADUFFCOPY)
- p.To.Type = obj.TYPE_MEM
- p.To.Name = obj.NAME_EXTERN
- p.To.Sym = ir.Syms.Duffcopy
- p.To.Offset = v.AuxInt
case ssa.OpLOONG64LoweredMove:
dstReg := v.Args[0].Reg()
srcReg := v.Args[1].Reg()
diff --git a/src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go b/src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go
index cc6ae8fb8e..bee619f6d9 100644
--- a/src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go
+++ b/src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go
@@ -360,24 +360,6 @@ func init() {
{name: "CALLclosure", argLength: -1, reg: regInfo{inputs: []regMask{gpsp, buildReg("R29"), 0}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true}, // call function via closure. arg0=codeptr, arg1=closure, last arg=mem, auxint=argsize, returns mem
{name: "CALLinter", argLength: -1, reg: regInfo{inputs: []regMask{gp}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true}, // call fn by pointer. arg0=codeptr, last arg=mem, auxint=argsize, returns mem
- // duffzero
- // arg0 = address of memory to zero
- // arg1 = mem
- // auxint = offset into duffzero code to start executing
- // returns mem
- // R20 aka loong64.REGRT1 changed as side effect
- {
- name: "DUFFZERO",
- aux: "Int64",
- argLength: 2,
- reg: regInfo{
- inputs: []regMask{buildReg("R20")},
- clobbers: buildReg("R20 R1"),
- },
- typ: "Mem",
- faultOnNilArg0: true,
- },
-
// medium zeroing
// arg0 = address of memory to zero
// arg1 = mem
@@ -393,25 +375,6 @@ func init() {
faultOnNilArg0: true,
},
- // duffcopy
- // arg0 = address of dst memory (in R21, changed as side effect)
- // arg1 = address of src memory (in R20, changed as side effect)
- // arg2 = mem
- // auxint = offset into duffcopy code to start executing
- // returns mem
- {
- name: "DUFFCOPY",
- aux: "Int64",
- argLength: 3,
- reg: regInfo{
- inputs: []regMask{buildReg("R21"), buildReg("R20")},
- clobbers: buildReg("R20 R21 R1"),
- },
- typ: "Mem",
- faultOnNilArg0: true,
- faultOnNilArg1: true,
- },
-
// large zeroing
// arg0 = address of memory to zero
// arg1 = mem
diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go
index f42d64228f..4aef2d2aa1 100644
--- a/src/cmd/compile/internal/ssa/opGen.go
+++ b/src/cmd/compile/internal/ssa/opGen.go
@@ -1924,9 +1924,7 @@ const (
OpLOONG64CALLtail
OpLOONG64CALLclosure
OpLOONG64CALLinter
- OpLOONG64DUFFZERO
OpLOONG64LoweredZero
- OpLOONG64DUFFCOPY
OpLOONG64LoweredZeroLoop
OpLOONG64LoweredMove
OpLOONG64LoweredMoveLoop
@@ -25935,18 +25933,6 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "DUFFZERO",
- auxType: auxInt64,
- argLen: 2,
- faultOnNilArg0: true,
- reg: regInfo{
- inputs: []inputInfo{
- {0, 524288}, // R20
- },
- clobbers: 524290, // R1 R20
- },
- },
- {
name: "LoweredZero",
auxType: auxInt64,
argLen: 2,
@@ -25958,20 +25944,6 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "DUFFCOPY",
- auxType: auxInt64,
- argLen: 3,
- faultOnNilArg0: true,
- faultOnNilArg1: true,
- reg: regInfo{
- inputs: []inputInfo{
- {0, 1048576}, // R21
- {1, 524288}, // R20
- },
- clobbers: 1572866, // R1 R20 R21
- },
- },
- {
name: "LoweredZeroLoop",
auxType: auxInt64,
argLen: 2,
diff --git a/src/cmd/internal/obj/loong64/a.out.go b/src/cmd/internal/obj/loong64/a.out.go
index 8e651cdfef..7ab85a2f23 100644
--- a/src/cmd/internal/obj/loong64/a.out.go
+++ b/src/cmd/internal/obj/loong64/a.out.go
@@ -225,8 +225,6 @@ const (
REGZERO = REG_R0 // set to zero
REGLINK = REG_R1
REGSP = REG_R3
- REGRT1 = REG_R20 // reserved for runtime, duffzero and duffcopy
- REGRT2 = REG_R21 // reserved for runtime, duffcopy
REGCTXT = REG_R29 // context for closures
REGG = REG_R22 // G in loong64
REGTMP = REG_R30 // used by the assembler
diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go
index 35b33b9376..848d77fd0d 100644
--- a/src/cmd/internal/obj/loong64/asm.go
+++ b/src/cmd/internal/obj/loong64/asm.go
@@ -440,8 +440,6 @@ var optab = []Optab{
{obj.ANOP, C_DCON, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0}, // nop variants, see #40689
{obj.ANOP, C_REG, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0},
{obj.ANOP, C_FREG, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0, 0},
- {obj.ADUFFZERO, C_NONE, C_NONE, C_NONE, C_BRAN, C_NONE, 11, 4, 0, 0}, // same as AJMP
- {obj.ADUFFCOPY, C_NONE, C_NONE, C_NONE, C_BRAN, C_NONE, 11, 4, 0, 0}, // same as AJMP
}
var atomicInst = map[obj.As]uint32{
@@ -1526,9 +1524,7 @@ func buildop(ctxt *obj.Link) {
obj.ATEXT,
obj.AFUNCDATA,
obj.APCALIGN,
- obj.APCDATA,
- obj.ADUFFZERO,
- obj.ADUFFCOPY:
+ obj.APCDATA:
break
case ARDTIMELW:
@@ -4040,9 +4036,7 @@ func (c *ctxt0) opirr(a obj.As) uint32 {
case AJMP:
return 0x14 << 26
- case AJAL,
- obj.ADUFFZERO,
- obj.ADUFFCOPY:
+ case AJAL:
return 0x15 << 26
case AJIRL:
diff --git a/src/cmd/internal/obj/loong64/obj.go b/src/cmd/internal/obj/loong64/obj.go
index a1eb786da3..a97217d316 100644
--- a/src/cmd/internal/obj/loong64/obj.go
+++ b/src/cmd/internal/obj/loong64/obj.go
@@ -17,11 +17,7 @@ import (
func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
// Rewrite JMP/JAL to symbol as TYPE_BRANCH.
switch p.As {
- case AJMP,
- AJAL,
- ARET,
- obj.ADUFFZERO,
- obj.ADUFFCOPY:
+ case AJMP, AJAL, ARET:
if p.To.Sym != nil {
p.To.Type = obj.TYPE_BRANCH
}
@@ -93,40 +89,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
}
func rewriteToUseGot(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
- // ADUFFxxx $offset
- // becomes
- // MOVV runtime.duffxxx@GOT, REGTMP
- // ADD $offset, REGTMP
- // JAL REGTMP
- if p.As == obj.ADUFFCOPY || p.As == obj.ADUFFZERO {
- var sym *obj.LSym
- if p.As == obj.ADUFFZERO {
- sym = ctxt.LookupABI("runtime.duffzero", obj.ABIInternal)
- } else {
- sym = ctxt.LookupABI("runtime.duffcopy", obj.ABIInternal)
- }
- offset := p.To.Offset
- p.As = AMOVV
- p.From.Type = obj.TYPE_MEM
- p.From.Sym = sym
- p.From.Name = obj.NAME_GOTREF
- 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, newprog)
- p1.As = AADDV
- p1.From.Type = obj.TYPE_CONST
- p1.From.Offset = offset
- p1.To.Type = obj.TYPE_REG
- p1.To.Reg = REGTMP
- p2 := obj.Appendp(p1, newprog)
- p2.As = AJAL
- p2.To.Type = obj.TYPE_MEM
- p2.To.Reg = REGTMP
- }
-
// 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
// internally defined symbols.
@@ -256,9 +218,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
}
}
- case AJAL,
- obj.ADUFFZERO,
- obj.ADUFFCOPY:
+ case AJAL:
c.cursym.Func().Text.Mark &^= LEAF
fallthrough