aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
diff options
context:
space:
mode:
authorGuoqi Chen <chenguoqi@loongson.cn>2025-04-23 10:30:39 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-04-24 18:28:42 -0700
commitfb2c88147d0aab656b7a8ae109b3d1241de402ab (patch)
tree6b1188caf2ad7b727093169f14b09acafcaf12da /src/cmd/internal
parent06f96a598eb6ee1679624f955fe5e1e837e4c49c (diff)
downloadgo-fb2c88147d0aab656b7a8ae109b3d1241de402ab.tar.xz
cmd/internal/obj: add new assembly format for BFPT and BFPF on loong64
On loong64, BFPT and BFPF are mapped to the platform assembly as follows: Go asm syntax: BFPT FCCx, offs21 BFPF FCCx, offs21 Equivalent platform assembler syntax: bcnez cj, offs21 bceqz cj, offs21 If the condition register is not specified, it defaults to FCC0. Change-Id: I2cc3df62a9c55d4b5eb124789358983c6737319c Reviewed-on: https://go-review.googlesource.com/c/go/+/667456 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Meidan Li <limeidan@loongson.cn>
Diffstat (limited to 'src/cmd/internal')
-rw-r--r--src/cmd/internal/obj/loong64/asm.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go
index 1254695be8..7fdba0c6c2 100644
--- a/src/cmd/internal/obj/loong64/asm.go
+++ b/src/cmd/internal/obj/loong64/asm.go
@@ -308,7 +308,8 @@ var optab = []Optab{
{ABEQ, C_REG, C_REG, C_NONE, C_BRAN, C_NONE, 6, 4, 0, 0},
{ABEQ, C_REG, C_NONE, C_NONE, C_BRAN, C_NONE, 6, 4, 0, 0},
{ABLEZ, C_REG, C_NONE, C_NONE, C_BRAN, C_NONE, 6, 4, 0, 0},
- {ABFPT, C_NONE, C_NONE, C_NONE, C_BRAN, C_NONE, 6, 4, 0, NOTUSETMP},
+ {ABFPT, C_NONE, C_NONE, C_NONE, C_BRAN, C_NONE, 6, 4, 0, 0},
+ {ABFPT, C_FCCREG, C_NONE, C_NONE, C_BRAN, C_NONE, 6, 4, 0, 0},
{AJMP, C_NONE, C_NONE, C_NONE, C_BRAN, C_NONE, 11, 4, 0, 0}, // b
{AJAL, C_NONE, C_NONE, C_NONE, C_BRAN, C_NONE, 11, 4, 0, 0}, // bl
@@ -1985,7 +1986,9 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
width = 21
// FCC0 is the implicit source operand, now that we
// don't register-allocate from the FCC bank.
- rj = REG_FCC0
+ if rj == 0 {
+ rj = REG_FCC0
+ }
case ABEQ, ABNE:
if rd == 0 || rd == REGZERO || rj == REGZERO {
// BEQZ/BNEZ can be encoded with 21-bit offsets.