aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>2024-12-16 10:53:00 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-03-13 17:18:49 -0700
commit80f068928fd957935df3d61da319331e76a73b49 (patch)
tree172aa181be950ba51541db85259e652793e11ddd /src/cmd/internal/obj
parent937368f84e545db15d3f39c2b33a267ba8ead4a4 (diff)
downloadgo-80f068928fd957935df3d61da319331e76a73b49.tar.xz
cmd/internal/obj/loong64: add {V,XV}{FSQRT/FRECIP/FRSQRT}.{S/D} instructions support
Go asm syntax: V{FSQRT/FRECIP/FRSQRT}{F/D} VJ, VD XV{FSQRT/FRECIP/FRSQRT}{F/D} XJ, XD Equivalent platform assembler syntax: v{fsqrt/frecip/frsqrt}.{s/d} vd, vj xv{fsqrt/frecip/frsqrt}.{s/d} xd, xj Change-Id: I3fdbe3193659d7532164451b087ccf725053172f Reviewed-on: https://go-review.googlesource.com/c/go/+/636395 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Diffstat (limited to 'src/cmd/internal/obj')
-rw-r--r--src/cmd/internal/obj/loong64/a.out.go14
-rw-r--r--src/cmd/internal/obj/loong64/anames.go12
-rw-r--r--src/cmd/internal/obj/loong64/asm.go36
3 files changed, 62 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/loong64/a.out.go b/src/cmd/internal/obj/loong64/a.out.go
index 55ca273455..9df63de388 100644
--- a/src/cmd/internal/obj/loong64/a.out.go
+++ b/src/cmd/internal/obj/loong64/a.out.go
@@ -936,6 +936,20 @@ const (
AXVMUHWU
AXVMUHVU
+ // LSX and LASX floating point instructions
+ AVFSQRTF
+ AVFSQRTD
+ AVFRECIPF
+ AVFRECIPD
+ AVFRSQRTF
+ AVFRSQRTD
+ AXVFSQRTF
+ AXVFSQRTD
+ AXVFRECIPF
+ AXVFRECIPD
+ AXVFRSQRTF
+ AXVFRSQRTD
+
ALAST
// aliases
diff --git a/src/cmd/internal/obj/loong64/anames.go b/src/cmd/internal/obj/loong64/anames.go
index b91bb93d0a..bc7948eb00 100644
--- a/src/cmd/internal/obj/loong64/anames.go
+++ b/src/cmd/internal/obj/loong64/anames.go
@@ -437,5 +437,17 @@ var Anames = []string{
"XVMUHHU",
"XVMUHWU",
"XVMUHVU",
+ "VFSQRTF",
+ "VFSQRTD",
+ "VFRECIPF",
+ "VFRECIPD",
+ "VFRSQRTF",
+ "VFRSQRTD",
+ "XVFSQRTF",
+ "XVFSQRTD",
+ "XVFRECIPF",
+ "XVFRECIPD",
+ "XVFRSQRTF",
+ "XVFRSQRTD",
"LAST",
}
diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go
index 306a309cac..3186791791 100644
--- a/src/cmd/internal/obj/loong64/asm.go
+++ b/src/cmd/internal/obj/loong64/asm.go
@@ -1653,11 +1653,23 @@ func buildop(ctxt *obj.Link) {
opset(AVPCNTH, r0)
opset(AVPCNTW, r0)
opset(AVPCNTV, r0)
+ opset(AVFSQRTF, r0)
+ opset(AVFSQRTD, r0)
+ opset(AVFRECIPF, r0)
+ opset(AVFRECIPD, r0)
+ opset(AVFRSQRTF, r0)
+ opset(AVFRSQRTD, r0)
case AXVPCNTB:
opset(AXVPCNTH, r0)
opset(AXVPCNTW, r0)
opset(AXVPCNTV, r0)
+ opset(AXVFSQRTF, r0)
+ opset(AXVFSQRTD, r0)
+ opset(AXVFRECIPF, r0)
+ opset(AXVFRECIPD, r0)
+ opset(AXVFRSQRTF, r0)
+ opset(AXVFRSQRTD, r0)
case AVADDB:
opset(AVADDH, r0)
@@ -3330,6 +3342,30 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
return 0x1da70a << 10 // xvpcnt.w
case AXVPCNTV:
return 0x1da70b << 10 // xvpcnt.v
+ case AVFSQRTF:
+ return 0x1ca739 << 10 // vfsqrt.s
+ case AVFSQRTD:
+ return 0x1ca73a << 10 // vfsqrt.d
+ case AVFRECIPF:
+ return 0x1ca73d << 10 // vfrecip.s
+ case AVFRECIPD:
+ return 0x1ca73e << 10 // vfrecip.d
+ case AVFRSQRTF:
+ return 0x1ca741 << 10 // vfrsqrt.s
+ case AVFRSQRTD:
+ return 0x1ca742 << 10 // vfrsqrt.d
+ case AXVFSQRTF:
+ return 0x1da739 << 10 // xvfsqrt.s
+ case AXVFSQRTD:
+ return 0x1da73a << 10 // xvfsqrt.d
+ case AXVFRECIPF:
+ return 0x1da73d << 10 // xvfrecip.s
+ case AXVFRECIPD:
+ return 0x1da73e << 10 // xvfrecip.d
+ case AXVFRSQRTF:
+ return 0x1da741 << 10 // xvfrsqrt.s
+ case AXVFRSQRTD:
+ return 0x1da742 << 10 // xvfrsqrt.d
}
c.ctxt.Diag("bad rr opcode %v", a)