cmd/internal/obj/loong64: add support for instructions F{MAX/NIN}.{S/D}

Go asm syntax:
	F{MAX/MIN}{F/D}		FK, FJ, FD

Equivalent platform assembler syntax:
	f{max/min}.{s/d}	fd, fj, fk

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

Change-Id: Ib11fed1fe3700be5ebba33b5818661c4071b7b7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/590676
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
This commit is contained in:
Xiaolin Zhao 2024-04-10 11:37:56 +08:00 committed by Gopher Robot
parent 9abd11440c
commit e761921688
4 changed files with 31 additions and 0 deletions

View file

@ -269,3 +269,12 @@ lable2:
AMMAXDBVU R14, (R13), R12 // acb97038 AMMAXDBVU R14, (R13), R12 // acb97038
AMMINDBWU R14, (R13), R12 // ac397138 AMMINDBWU R14, (R13), R12 // ac397138
AMMINDBVU R14, (R13), R12 // acb97138 AMMINDBVU R14, (R13), R12 // acb97138
FMINF F4, F5, F6 // a6900a01
FMINF F4, F5 // a5900a01
FMIND F4, F5, F6 // a6100b01
FMIND F4, F5 // a5100b01
FMAXF F4, F5, F6 // a6900801
FMAXF F4, F5 // a5900801
FMAXD F4, F5, F6 // a6100901
FMAXD F4, F5 // a5100901

View file

@ -440,6 +440,12 @@ const (
ARDTIMED ARDTIMED
ACPUCFG ACPUCFG
// 3.2.1.3
AFMINF
AFMIND
AFMAXF
AFMAXD
ALAST ALAST
// aliases // aliases

View file

@ -179,5 +179,9 @@ var Anames = []string{
"RDTIMEHW", "RDTIMEHW",
"RDTIMED", "RDTIMED",
"CPUCFG", "CPUCFG",
"FMINF",
"FMIND",
"FMAXF",
"FMAXD",
"LAST", "LAST",
} }

View file

@ -1052,6 +1052,10 @@ func buildop(ctxt *obj.Link) {
opset(ASUBF, r0) opset(ASUBF, r0)
opset(ASUBD, r0) opset(ASUBD, r0)
opset(AADDD, r0) opset(AADDD, r0)
opset(AFMINF, r0)
opset(AFMIND, r0)
opset(AFMAXF, r0)
opset(AFMAXD, r0)
case AAND: case AAND:
opset(AOR, r0) opset(AOR, r0)
@ -1872,6 +1876,14 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
return 0x0c2<<20 | 0x3<<15 // FCMP.SLT.D return 0x0c2<<20 | 0x3<<15 // FCMP.SLT.D
case ACMPGTF: case ACMPGTF:
return 0x0c1<<20 | 0x3<<15 // FCMP.SLT.S return 0x0c1<<20 | 0x3<<15 // FCMP.SLT.S
case AFMINF:
return 0x215 << 15 // fmin.s
case AFMIND:
return 0x216 << 15 // fmin.d
case AFMAXF:
return 0x211 << 15 // fmax.s
case AFMAXD:
return 0x212 << 15 // fmax.d
} }
if a < 0 { if a < 0 {