1
0
mirror of https://github.com/golang/go synced 2024-11-11 19:01:37 -07:00

cmd/internal/obj/loong64: add support for instructions FCOPYSIGN.{S/D} and FCLASS.{S/D}

Go asm syntax:
	FCOPYSG{F/D}	FK, FJ, FD
	FCLASSF{F/D}	FJ, FD

Equivalent platform assembler syntax:
	fcopysign.{s/d}	fd, fj, fk
	fclass.{s/d}	fd, fj

Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: Ied34b71c9d0b34456ac5782a59d29d2d0229e326
Reviewed-on: https://go-review.googlesource.com/c/go/+/590675
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Xiaolin Zhao 2024-06-05 10:52:08 +08:00 committed by Gopher Robot
parent 2ffcfcef55
commit b874005a84
4 changed files with 29 additions and 0 deletions

View File

@ -278,3 +278,8 @@ lable2:
FMAXF F4, F5 // a5900801
FMAXD F4, F5, F6 // a6100901
FMAXD F4, F5 // a5100901
FCOPYSGF F4, F5, F6 // a6901201
FCOPYSGD F4, F5, F6 // a6101301
FCLASSF F4, F5 // 85341401
FCLASSD F4, F5 // 85381401

View File

@ -446,6 +446,14 @@ const (
AFMAXF
AFMAXD
// 3.2.1.7
AFCOPYSGF
AFCOPYSGD
// 3.2.1.8
AFCLASSF
AFCLASSD
ALAST
// aliases

View File

@ -183,5 +183,9 @@ var Anames = []string{
"FMIND",
"FMAXF",
"FMAXD",
"FCOPYSGF",
"FCOPYSGD",
"FCLASSF",
"FCLASSD",
"LAST",
}

View File

@ -1028,6 +1028,8 @@ func buildop(ctxt *obj.Link) {
opset(ATRUNCFW, r0)
opset(ASQRTF, r0)
opset(ASQRTD, r0)
opset(AFCLASSF, r0)
opset(AFCLASSD, r0)
case AMOVVF:
opset(AMOVVD, r0)
@ -1056,6 +1058,8 @@ func buildop(ctxt *obj.Link) {
opset(AFMIND, r0)
opset(AFMAXF, r0)
opset(AFMAXD, r0)
opset(AFCOPYSGF, r0)
opset(AFCOPYSGD, r0)
case AAND:
opset(AOR, r0)
@ -1884,6 +1888,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
return 0x211 << 15 // fmax.s
case AFMAXD:
return 0x212 << 15 // fmax.d
case AFCOPYSGF:
return 0x225 << 15 // fcopysign.s
case AFCOPYSGD:
return 0x226 << 15 // fcopysign.d
}
if a < 0 {
@ -1952,6 +1960,10 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
return 0x4511 << 10
case ASQRTD:
return 0x4512 << 10
case AFCLASSF:
return 0x450d << 10 // fclass.s
case AFCLASSD:
return 0x450e << 10 // fclass.d
}
c.ctxt.Diag("bad rr opcode %v", a)