Skip to content

Commit 9fc8436

Browse files
author
eric fang
committed
cmd/asm: fix encoding errors for FMOVD and FMOVS instructions on arm64
The encoding of instructions "FMOVD F1, ZR" and "FMOVS F1, ZR" is wrong, the assembler encodes them as "FMOVD F1, F31" and "FMOVS F1, F31". This CL fixes the bug. Change-Id: I2d31520b58f9950ce2534a04f4a3275bf103a673 Reviewed-on: https://go-review.googlesource.com/c/go/+/503135 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]> Run-TryBot: Eric Fang <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent da94586 commit 9fc8436

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/cmd/asm/internal/asm/testdata/arm64.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
238238
FMOVS $0, F0 // e003271e
239239
FMOVD ZR, F0 // e003679e
240240
FMOVS ZR, F0 // e003271e
241+
FMOVD F1, ZR // 3f00669e
242+
FMOVS F1, ZR // 3f00261e
241243
VUADDW V9.B8, V12.H8, V14.H8 // 8e11292e
242244
VUADDW V13.H4, V10.S4, V11.S4 // 4b116d2e
243245
VUADDW V21.S2, V24.D2, V29.D2 // 1d13b52e

src/cmd/internal/obj/arm64/asm7.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3880,7 +3880,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
38803880
case 29: /* op Rn, Rd */
38813881
fc := c.aclass(&p.From)
38823882
tc := c.aclass(&p.To)
3883-
if (p.As == AFMOVD || p.As == AFMOVS) && (fc == C_REG || fc == C_ZREG || tc == C_REG) {
3883+
if (p.As == AFMOVD || p.As == AFMOVS) && (fc == C_REG || fc == C_ZREG || tc == C_REG || tc == C_ZREG) {
38843884
// FMOV Rx, Fy or FMOV Fy, Rx
38853885
o1 = FPCVTI(0, 0, 0, 0, 6)
38863886
if p.As == AFMOVD {

0 commit comments

Comments
 (0)