1
0
mirror of https://github.com/golang/go synced 2024-11-11 18:31:38 -07:00

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 <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
eric fang 2023-06-13 10:02:33 +00:00 committed by Eric Fang
parent da94586aa3
commit 9fc84363d1
2 changed files with 3 additions and 1 deletions

View File

@ -238,6 +238,8 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
FMOVS $0, F0 // e003271e
FMOVD ZR, F0 // e003679e
FMOVS ZR, F0 // e003271e
FMOVD F1, ZR // 3f00669e
FMOVS F1, ZR // 3f00261e
VUADDW V9.B8, V12.H8, V14.H8 // 8e11292e
VUADDW V13.H4, V10.S4, V11.S4 // 4b116d2e
VUADDW V21.S2, V24.D2, V29.D2 // 1d13b52e

View File

@ -3880,7 +3880,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
case 29: /* op Rn, Rd */
fc := c.aclass(&p.From)
tc := c.aclass(&p.To)
if (p.As == AFMOVD || p.As == AFMOVS) && (fc == C_REG || fc == C_ZREG || tc == C_REG) {
if (p.As == AFMOVD || p.As == AFMOVS) && (fc == C_REG || fc == C_ZREG || tc == C_REG || tc == C_ZREG) {
// FMOV Rx, Fy or FMOV Fy, Rx
o1 = FPCVTI(0, 0, 0, 0, 6)
if p.As == AFMOVD {