aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
diff options
context:
space:
mode:
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>2025-11-21 17:22:05 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-11-26 16:46:52 -0800
commitc6d64f85565e6a934110c4928ca95fea0045ebaa (patch)
tree0ff8ab80c722371c902d2c65b808aaac4236c5e3 /src/cmd/internal
parentc048a9a11f21e879a76e328b7a92f3a47f298b37 (diff)
downloadgo-c6d64f85565e6a934110c4928ca95fea0045ebaa.tar.xz
cmd/internal/obj/loong64: remove the incorrect unsigned instructions
The loong64 ISA does not support the 32-bit unsigned arithmetic instructions ADDU, SUBU and MULU. Change-Id: Ifa67de9c59aa12d08844189ed23e6daad0cc11ea Reviewed-on: https://go-review.googlesource.com/c/go/+/722760 Reviewed-by: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/internal')
-rw-r--r--src/cmd/internal/obj/loong64/a.out.go3
-rw-r--r--src/cmd/internal/obj/loong64/anames.go3
-rw-r--r--src/cmd/internal/obj/loong64/asm.go20
-rw-r--r--src/cmd/internal/obj/loong64/obj.go7
4 files changed, 5 insertions, 28 deletions
diff --git a/src/cmd/internal/obj/loong64/a.out.go b/src/cmd/internal/obj/loong64/a.out.go
index 38d4b74959..2a3ead55ea 100644
--- a/src/cmd/internal/obj/loong64/a.out.go
+++ b/src/cmd/internal/obj/loong64/a.out.go
@@ -429,7 +429,6 @@ const (
AADD
AADDD
AADDF
- AADDU
AADDW
AAND
@@ -495,7 +494,6 @@ const (
AMUL
AMULD
AMULF
- AMULU
AMULH
AMULHU
AMULW
@@ -531,7 +529,6 @@ const (
ASUBD
ASUBF
- ASUBU
ASUBW
ADBAR
ASYSCALL
diff --git a/src/cmd/internal/obj/loong64/anames.go b/src/cmd/internal/obj/loong64/anames.go
index b1fcbce196..4fe9a35b27 100644
--- a/src/cmd/internal/obj/loong64/anames.go
+++ b/src/cmd/internal/obj/loong64/anames.go
@@ -10,7 +10,6 @@ var Anames = []string{
"ADD",
"ADDD",
"ADDF",
- "ADDU",
"ADDW",
"AND",
"BEQ",
@@ -63,7 +62,6 @@ var Anames = []string{
"MUL",
"MULD",
"MULF",
- "MULU",
"MULH",
"MULHU",
"MULW",
@@ -92,7 +90,6 @@ var Anames = []string{
"SUB",
"SUBD",
"SUBF",
- "SUBU",
"SUBW",
"DBAR",
"SYSCALL",
diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go
index e5f2014e95..3fcd6eafd7 100644
--- a/src/cmd/internal/obj/loong64/asm.go
+++ b/src/cmd/internal/obj/loong64/asm.go
@@ -1431,7 +1431,6 @@ func buildop(ctxt *obj.Link) {
opset(AADDW, r0)
opset(ASGT, r0)
opset(ASGTU, r0)
- opset(AADDU, r0)
case AADDV:
opset(AADDVU, r0)
@@ -1514,13 +1513,11 @@ func buildop(ctxt *obj.Link) {
case ASUB:
opset(ASUBW, r0)
- opset(ASUBU, r0)
opset(ANOR, r0)
opset(ASUBV, r0)
opset(ASUBVU, r0)
opset(AMUL, r0)
opset(AMULW, r0)
- opset(AMULU, r0)
opset(AMULH, r0)
opset(AMULHU, r0)
opset(AREM, r0)
@@ -2296,8 +2293,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
o5 := uint32(0)
o6 := uint32(0)
- add := AADDU
- add = AADDVU
+ add := AADDVU
switch o.type_ {
default:
@@ -2428,7 +2424,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
v := c.regoff(&p.From)
a := AOR
if v < 0 {
- a = AADDU
+ a = AADD
}
o1 = OP_12IRR(c.opirr(a), uint32(v), uint32(0), uint32(REGTMP))
r := int(p.Reg)
@@ -2687,7 +2683,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
case 34: // mov $con,fr
v := c.regoff(&p.From)
- a := AADDU
+ a := AADD
if v > 0 {
a = AOR
}
@@ -3317,8 +3313,6 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
switch a {
case AADD, AADDW:
return 0x20 << 15
- case AADDU:
- return 0x20 << 15
case ASGT:
return 0x24 << 15 // SLT
case ASGTU:
@@ -3337,9 +3331,7 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
return 0x2c << 15 // orn
case AANDN:
return 0x2d << 15 // andn
- case ASUB, ASUBW:
- return 0x22 << 15
- case ASUBU, ANEGW:
+ case ASUB, ASUBW, ANEGW:
return 0x22 << 15
case ANOR:
return 0x28 << 15
@@ -3370,8 +3362,6 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
case AMUL, AMULW:
return 0x38 << 15 // mul.w
- case AMULU:
- return 0x38 << 15 // mul.w
case AMULH:
return 0x39 << 15 // mulh.w
case AMULHU:
@@ -4684,7 +4674,7 @@ func (c *ctxt0) opir(a obj.As) uint32 {
func (c *ctxt0) opirr(a obj.As) uint32 {
switch a {
- case AADD, AADDW, AADDU:
+ case AADD, AADDW:
return 0x00a << 22
case ASGT:
return 0x008 << 22
diff --git a/src/cmd/internal/obj/loong64/obj.go b/src/cmd/internal/obj/loong64/obj.go
index a97217d316..51a28d130c 100644
--- a/src/cmd/internal/obj/loong64/obj.go
+++ b/src/cmd/internal/obj/loong64/obj.go
@@ -64,12 +64,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
p.As = AADD
}
- case ASUBU:
- if p.From.Type == obj.TYPE_CONST {
- p.From.Offset = -p.From.Offset
- p.As = AADDU
- }
-
case ASUBV:
if p.From.Type == obj.TYPE_CONST {
p.From.Offset = -p.From.Offset
@@ -453,7 +447,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
q.Link = q1
case AADD,
- AADDU,
AADDV,
AADDVU:
if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.From.Type == obj.TYPE_CONST {