1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:14:40 -07:00

cmd/internal/obj/loong64: add support for instructions FTINT{RM/RP/RZ/RNE}.{W/L}.{S/D}

These instructions convert floating-point numbers to fixed-point numbers
with the specified rounding pattern.

Go asm syntax:
            FTINT{RM/RP/RZ/RNE}{W/V}{F/D}	FJ, FD

Equivalent platform assembler syntax:
            ftint{rm/rp/rz/rne}.{w/l}.{s/d}	fd, fj

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

Change-Id: I6d650d1b48b10296d01a98fadf9d806206f9b96e
Reviewed-on: https://go-review.googlesource.com/c/go/+/590995
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
This commit is contained in:
Xiaolin Zhao 2024-06-06 14:25:38 +08:00 committed by Gopher Robot
parent 4087624473
commit 3ae819ad1c
4 changed files with 99 additions and 0 deletions

View File

@ -292,3 +292,20 @@ lable2:
FTINTWD F0, F1 // 01081b01
FTINTVF F0, F1 // 01241b01
FTINTVD F0, F1 // 01281b01
FTINTRMWF F0, F2 // 02041a01
FTINTRMWD F0, F2 // 02081a01
FTINTRMVF F0, F2 // 02241a01
FTINTRMVD F0, F2 // 02281a01
FTINTRPWF F0, F2 // 02441a01
FTINTRPWD F0, F2 // 02481a01
FTINTRPVF F0, F2 // 02641a01
FTINTRPVD F0, F2 // 02681a01
FTINTRZWF F0, F2 // 02841a01
FTINTRZWD F0, F2 // 02881a01
FTINTRZVF F0, F2 // 02a41a01
FTINTRZVD F0, F2 // 02a81a01
FTINTRNEWF F0, F2 // 02c41a01
FTINTRNEWD F0, F2 // 02c81a01
FTINTRNEVF F0, F2 // 02e41a01
FTINTRNEVD F0, F2 // 02e81a01

View File

@ -464,6 +464,24 @@ const (
AFTINTVF
AFTINTVD
// 3.2.3.3
AFTINTRPWF
AFTINTRPWD
AFTINTRPVF
AFTINTRPVD
AFTINTRMWF
AFTINTRMWD
AFTINTRMVF
AFTINTRMVD
AFTINTRZWF
AFTINTRZWD
AFTINTRZVF
AFTINTRZVD
AFTINTRNEWF
AFTINTRNEWD
AFTINTRNEVF
AFTINTRNEVD
ALAST
// aliases

View File

@ -195,5 +195,21 @@ var Anames = []string{
"FTINTWD",
"FTINTVF",
"FTINTVD",
"FTINTRPWF",
"FTINTRPWD",
"FTINTRPVF",
"FTINTRPVD",
"FTINTRMWF",
"FTINTRMWD",
"FTINTRMVF",
"FTINTRMVD",
"FTINTRZWF",
"FTINTRZWD",
"FTINTRZVF",
"FTINTRZVD",
"FTINTRNEWF",
"FTINTRNEWD",
"FTINTRNEVF",
"FTINTRNEVD",
"LAST",
}

View File

@ -1045,6 +1045,22 @@ func buildop(ctxt *obj.Link) {
opset(AFTINTWD, r0)
opset(AFTINTVF, r0)
opset(AFTINTVD, r0)
opset(AFTINTRPWF, r0)
opset(AFTINTRPWD, r0)
opset(AFTINTRPVF, r0)
opset(AFTINTRPVD, r0)
opset(AFTINTRMWF, r0)
opset(AFTINTRMWD, r0)
opset(AFTINTRMVF, r0)
opset(AFTINTRMVD, r0)
opset(AFTINTRZWF, r0)
opset(AFTINTRZWD, r0)
opset(AFTINTRZVF, r0)
opset(AFTINTRZVD, r0)
opset(AFTINTRNEWF, r0)
opset(AFTINTRNEWD, r0)
opset(AFTINTRNEVF, r0)
opset(AFTINTRNEVD, r0)
case AADD:
opset(ASGT, r0)
@ -1988,6 +2004,38 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
return 0x46c9 << 10 // ftint.l.s
case AFTINTVD:
return 0x46ca << 10 // ftint.l.d
case AFTINTRMWF:
return 0x4681 << 10 // ftintrm.w.s
case AFTINTRMWD:
return 0x4682 << 10 // ftintrm.w.d
case AFTINTRMVF:
return 0x4689 << 10 // ftintrm.l.s
case AFTINTRMVD:
return 0x468a << 10 // ftintrm.l.d
case AFTINTRPWF:
return 0x4691 << 10 // ftintrp.w.s
case AFTINTRPWD:
return 0x4692 << 10 // ftintrp.w.d
case AFTINTRPVF:
return 0x4699 << 10 // ftintrp.l.s
case AFTINTRPVD:
return 0x469a << 10 // ftintrp.l.d
case AFTINTRZWF:
return 0x46a1 << 10 // ftintrz.w.s
case AFTINTRZWD:
return 0x46a2 << 10 // ftintrz.w.d
case AFTINTRZVF:
return 0x46a9 << 10 // ftintrz.l.s
case AFTINTRZVD:
return 0x46aa << 10 // ftintrz.l.d
case AFTINTRNEWF:
return 0x46b1 << 10 // ftintrne.w.s
case AFTINTRNEWD:
return 0x46b2 << 10 // ftintrne.w.d
case AFTINTRNEVF:
return 0x46b9 << 10 // ftintrne.l.s
case AFTINTRNEVD:
return 0x46ba << 10 // ftintrne.l.d
}
c.ctxt.Diag("bad rr opcode %v", a)