diff options
| author | Xiaolin Zhao <zhaoxiaolin@loongson.cn> | 2024-04-03 15:13:04 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-07-29 02:47:00 +0000 |
| commit | f95ae3d68989505fcac9ec23cacc03d602ec6739 (patch) | |
| tree | 47486a96eafcdcf29411b1a6dc66df726dc0efcc /src/cmd/internal | |
| parent | aec5cc52add9d8da0b5ac4e51758d10ee35589db (diff) | |
| download | go-f95ae3d68989505fcac9ec23cacc03d602ec6739.tar.xz | |
cmd/asm: change register type for loong64 floating-point
On Loong64, the two input operands and one output operand of the ADDF
instruction are both floating-point registers; and the floating-point
comparison instruction CMPEQ{F,D}, CMPGE{F,D}, CMPGT{F,D} both input
operands are floating-point registers, and the output operation is a
floating-point condition register, currently, only FCC0 is used as the
floating-point condition register.
Example:
ADDF F0, F1, F0
CMPEQF F0, F1, FCC0
Change-Id: I4c1c453e522d43f294a8dcab7b6b5247f41c9c68
Reviewed-on: https://go-review.googlesource.com/c/go/+/580281
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/internal')
| -rw-r--r-- | src/cmd/internal/obj/loong64/asm.go | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go index 9ce63c1f58..8325cbf905 100644 --- a/src/cmd/internal/obj/loong64/asm.go +++ b/src/cmd/internal/obj/loong64/asm.go @@ -82,13 +82,14 @@ var optab = []Optab{ {ACLO, C_REG, C_NONE, C_NONE, C_REG, C_NONE, 9, 4, 0, 0}, {AADDF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 32, 4, 0, 0}, - {AADDF, C_FREG, C_REG, C_NONE, C_FREG, C_NONE, 32, 4, 0, 0}, - {ACMPEQF, C_FREG, C_REG, C_NONE, C_NONE, C_NONE, 32, 4, 0, 0}, + {AADDF, C_FREG, C_FREG, C_NONE, C_FREG, C_NONE, 32, 4, 0, 0}, {AABSF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 33, 4, 0, 0}, {AMOVVF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 33, 4, 0, 0}, {AMOVF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 33, 4, 0, 0}, {AMOVD, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 33, 4, 0, 0}, + {ACMPEQF, C_FREG, C_FREG, C_NONE, C_FCCREG, C_NONE, 29, 4, 0, 0}, + {AMOVW, C_REG, C_NONE, C_NONE, C_SEXT, C_NONE, 7, 4, 0, 0}, {AMOVWU, C_REG, C_NONE, C_NONE, C_SEXT, C_NONE, 7, 4, 0, 0}, {AMOVV, C_REG, C_NONE, C_NONE, C_SEXT, C_NONE, 7, 4, 0, 0}, @@ -850,6 +851,21 @@ func (c *ctxt0) aclass(a *obj.Addr) int { return C_GOK } +func (c *ctxt0) rclass(r int16) int { + switch { + case REG_R0 <= r && r <= REG_R31: + return C_REG + case REG_F0 <= r && r <= REG_F31: + return C_FREG + case REG_FCC0 <= r && r <= REG_FCC31: + return C_FCCREG + case REG_FCSR0 <= r && r <= REG_FCSR31: + return C_FCSRREG + } + + return C_GOK +} + func prasm(p *obj.Prog) { fmt.Printf("%v\n", p) } @@ -883,7 +899,7 @@ func (c *ctxt0) oplook(p *obj.Prog) *Optab { // 2nd source operand a2 := C_NONE if p.Reg != 0 { - a2 = C_REG + a2 = c.rclass(p.Reg) } // 2nd destination operand @@ -1620,6 +1636,9 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) { o1 = OP_12IRR(c.opirr(a), uint32(v), uint32(r), uint32(p.From.Reg)) } + case 29: // fcmp.cond.x fj, fk, fcc + o1 = OP_RRR(c.oprrr(p.As), uint32(p.From.Reg), uint32(p.Reg), uint32(p.To.Reg)) + case 30: // movw r,fr a := OP_TEN(8, 1321) // movgr2fr.w o1 = OP_RR(a, uint32(p.From.Reg), uint32(p.To.Reg)) |
