-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/internal/obj/arm64: fix VMOVQ instruction encoding error
The VMOVQ instruction moves a 128-bit constant into a V register, as 128-bit constant can't be loaded into a register directly, we split it into two 64-bit constants and load it from constant pool. Currently we add the 128-bit constant to literal pool by calling the 'addpool' function twice, this is not the right way because it doesn't guarantee the two DWORD instructions are consecutive, and the second call of addpool will overwrite the p.Pool field,resulting in a wrong PC-relative offset value of the Prog. This CL renames the flag LFROM3 to LFROM128, and adds a new function addpool128 to add a 128-bit constant to the literal pool. Change-Id: I616f043c99a9a18a663f8768842cc980de2e6f79 Reviewed-on: https://go-review.googlesource.com/c/go/+/282334 Reviewed-by: eric fang <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> Run-TryBot: eric fang <[email protected]> Trust: eric fang <[email protected]>
- Loading branch information
eric fang
committed
Jan 23, 2021
1 parent
66ee8b1
commit cd99385
Showing
3 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2021 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
#include "textflag.h" | ||
|
||
// testvmovq() (r1, r2 uint64) | ||
TEXT ·testvmovq(SB), NOSPLIT, $0-16 | ||
VMOVQ $0x7040201008040201, $0x3040201008040201, V1 | ||
VMOV V1.D[0], R0 | ||
VMOV V1.D[1], R1 | ||
MOVD R0, r1+0(FP) | ||
MOVD R1, r2+8(FP) | ||
RET |