aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm/internal/asm/testdata/arm64error.s
AgeCommit message (Collapse)Author
2023-12-08cmd/internal/obj/arm64: fix invalid register pair for LDPeric fang
ZR register can be used in register pair of LDP, LDPW and LDPSW instructions, but now it's not allowed. This CL fixes this issue. Change-Id: I8467502de4664214e0b7dad0295c44f6cff16ee6 Reviewed-on: https://go-review.googlesource.com/c/go/+/547815 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com>
2023-07-27cmd/asm: add the fifth argument of the instruction to Optab on arm64erifan01
Currently the Optab structure contains four arguments of an instruction, excludes the fifth argument p.RegTo2. It does not participate in instruction matching and is usually handled separately. Instructions with five operands are common in the newer arm instruction set, so this CL adds the fifth argument to Optab, so that instruction matching is easier. This caused the oplook function also needs to be updated synchronously, this CL also made some cleaning and modifications to this function. Change-Id: I1d95ad99e72a44dfad1e00db182cfc369a0e55c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/505975 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com>
2023-05-22cmd/asm: encode instructions like SHA1SU0 with a separate case for arm64Ruinan
Before this CL, instructions such as SHA1SU0, AESD and AESE are encoded in case 1 together with FMOV/ADD, and some error checking is missing, for example: SHA1SU0 V1.B16, V2.B16, V3.B16 // wrong data arrangement SHA1SU0 V1.4S, V2.S4, V3.S4 // correct Both will be accepted by the assembler, but the first one is totally incorrect. This CL fixes these potential encoding issues by moving them into separate cases, adds some error tests, and also fixes a wrong encoding operand for ASHA1C. Change-Id: Ic778321a567735d48bc34a1247ee005c4ed9e11f Reviewed-on: https://go-review.googlesource.com/c/go/+/493195 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-02-28cmd/asm: remove the incorrect check of LDADDx-like instructionsfanzha02
According to the ARM Architecture Reference Manual, LDADDx-like instructions can take rt as zr when the encode A bit is 0. They are used by the alias STADDx-like instructions. The current assembler adds incorrect constraints for them, which is rt can't be zr when field.enc A is 0. This patch removes it. Add test cases. Reported by Matt Horsnell <matt.horsnell@arm.com> The reference: https://developer.arm.com/documentation/ddi0602/2022-12/Base-Instructions Change-Id: Ia2487a5e3900e32994fc14edaf03deeb245e70c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/462295 Reviewed-by: Matt Horsnell <matthew.horsnell@gmail.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01cmd/asm: add DC instruction on arm64erifan01
There was only a placeholder for DC instruction in the previous code. gVisor needs this instruction. This CL completes its support. This patch is a copy of CL 250858, contributed by Junchen Li(junchen.li@arm.com). Co-authored-by: Junchen Li(junchen.li@arm.com) CustomizedGitHooks: yes Change-Id: I76098048a227fbd08aa42c4173b028f0ab4f66e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/302851 Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: Eric Fang <eric.fang@arm.com> Run-TryBot: Eric Fang <eric.fang@arm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01cmd/asm: add TLBI instruction on arm64erifan01
There was only a placeholder for TLBI instruction in the previous code. gVisor needs this instruction. This CL completes its support. This patch is a copy of CL 250758, contributed by Junchen Li(junchen.li@arm.com). Co-authored-by: Junchen Li(junchen.li@arm.com) Change-Id: I69e893d2c1f75e227475de9e677548e14870f3cd Reviewed-on: https://go-review.googlesource.com/c/go/+/302850 Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: Eric Fang <eric.fang@arm.com> Run-TryBot: Eric Fang <eric.fang@arm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-15cmd/internal/obj/arm64: refactor the handling of shifted RSPeric fang
Some arithmetic operation instructions such as ADD and SUB support two formats of left shift (<<) operation, namely shifted register format and extended register format. And the encoding, supported registers and shifted amount are both different. The assembly parser doesn't distinguish them and parses them into TYPE_SHIFT type, because the parser can't tell them apart and in most cases extended left-shift can be replaced by shifted left-shift. The only exception is when the second source register or the destination register is RSP. This CL converts this case into the extended format in the preprocess stage, which helps to simplify some of the logic of the new assembler implementation and also makes this situation look more reasonable. Change-Id: I2cd7d2d663b38a7ba77a9fef1092708b8cb9bc3d Reviewed-on: https://go-review.googlesource.com/c/go/+/311709 Trust: Eric Fang <eric.fang@arm.com> Run-TryBot: Eric Fang <eric.fang@arm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-30cmd/asm: add error check for move constant instructions on arm64fanzha02
The current Go assembler encodes "MOVK $(0<<16|32|48), Rd" as the same binary with "MOVK $0, Rd", but for arm64 move constant instructions MOVK, MOVN and MOVZ, "op $0, Rd" and "op $(0<<16|32|48), Rd" have different semantics. In order not to change the way the assembler frontend parses constants, this patch adds a check for the zero shifts. Change-Id: Ia844c419ce49f63605b549e3a2e98d9075dd1cf1 Reviewed-on: https://go-review.googlesource.com/c/go/+/275812 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: fannie zhang <Fannie.Zhang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-09cmd/internal/obj/arm64: add checks for incorrect use of REGTMP registerfanzha02
The current assembler uses REGTMP as a temporary destination register, when optimizing one instruction into a multi-instruction sequence. But in some cases, when the source register is REGTMP, this behavior is incorrect. For example: ADD $0x1234567, R27, R3 The current assembler encodes it into MOVD $17767, R27 MOVK $(291<<16), R27 ADD R27, R27, R3 It is illegal to overwrite R27. This CL adds the related checks. Add test cases. Change-Id: I0af373d9fd23d8f067c093778dd4cc76748faf38 Reviewed-on: https://go-review.googlesource.com/c/go/+/344689 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: fannie zhang <Fannie.Zhang@arm.com>
2021-08-20cmd/internal/obj/arm64: disable the pre and post index formats for pseudo ↵eric fang
registers When using the FP or SP pseudo-register to load or store, pre-index and post-index formats are not supported because the RSP and pseudo registers are not allowed to be modified in this way. This CL deletes the related entries in optab and adds a few test cases. Change-Id: Ie30d27d0e7b959242f0e6298b950489669d07989 Reviewed-on: https://go-review.googlesource.com/c/go/+/342770 Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: eric fang <eric.fang@arm.com> Trust: Michael Knyszek <mknyszek@google.com>
2021-08-18cmd/internal/obj/arm64: fix the encoding error when operating with ZReric fang
Some arm64 instructions accept ZR as its destination register, such as MOVD, AND, ADD etc. although it doesn't seem to make much sense, but we should make sure the encoding is correct. However there exists some encoding mistakes in the current assembler, they are: 1, 'MOVD $1, ZR' is incorrectly encoded as 'MOVD $1, ZR' + '0x00000000'. 2, 'AND $1, R2, ZR' is incorrectly encoded as 'MOVD $1, R27' + 'AND R27, R2, ZR' + '0x00000000'. 3, 'AND $1, ZR' is incorrectly encoded as 'AND $1, ZR, RSP'. Obviously the first two encoding errors can cause SIGILL, and the third one will rewrite RSP. At the same time, I found some weird encodings but they don't cause errors. 4, 'MOVD $0x0001000100010001, ZR' is encoded as 'MOVW $1, ZR' + 'MOVKW $(1<<16), ZR'. 5, 'AND $0x0001000100010001, R2, ZR' is encoded as 'MOVD $1, R27' + 'MOVK $(1<<16), R27' + 'MOVK $(1<<32), R27'. Some of these issues also apply to 32-bit versions of these instructions. These problems are not very complicated, and are basically caused by the improper adaptation of the class of the constant to the entry in the optab. But the relationship between these constant classes is a bit complicated, so I don't know how to deal with issue 4 and 5, because they won't cause errors, so this CL didn't deal with them. This CL fixed the first three issues. Issue 1: before: 'MOVD $1, ZR' => 'MOVD $1, ZR' + '0x00000000'. after: 'MOVD $1, ZR' => 'MOVD $1, ZR'. Issue 2: before: 'AND $1, R2, ZR' => 'MOVD $1, R27' + 'AND R27, R2, ZR' + '0x00000000'. after: 'AND $1, R2, ZR' => 'ORR $1, ZR, R27' + 'AND R27, R2, ZR'. Issue 3: before: 'AND $1, ZR' => 'AND $1, ZR, RSP'. after: 'AND $1, ZR' => 'ORR $1, ZR, R27' + 'AND R27, ZR, ZR'. Change-Id: I3c889079229f847b863ad56c88966be12d947202 Reviewed-on: https://go-review.googlesource.com/c/go/+/329750 Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: eric fang <eric.fang@arm.com> Run-TryBot: eric fang <eric.fang@arm.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-05-14cmd/internal/obj/arm64: disable AL and NV for some condition operation ↵eric fang
instructions According to the armv8-a reference manual, conditions AL and NV are not allowed for instructions CINC, CINV, CNEG, CSET and CSETM. This CL adds this check and the corresponding test cases. Change-Id: Icb496b7b13a353f41491f2de4d939a5cd88abb04 Reviewed-on: https://go-review.googlesource.com/c/go/+/317912 Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: eric fang <eric.fang@arm.com> Run-TryBot: eric fang <eric.fang@arm.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-28cmd/asm: add check for register and shift/extension combination on arm64eric fang
The current code lacks a check on whether the register and shift/extension combination is valid, for example the follow instructions also compiles. ADD F1<<1, R1, R3 ADD V1<<1, R1, R3 MOVW (R9)(F8.SXTW<<2), R19 VST1 R4.D[1], (R0) Actually only general registers can perform shift operations, and element and arrangement extensions are only applicable to vector registers. This CL adds a check for the register and shift/extension combination on arm64. Change-Id: I93dd9343e92a66899cba8eaf4e0ac5430e94692b Reviewed-on: https://go-review.googlesource.com/c/go/+/312571 Trust: eric fang <eric.fang@arm.com> Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: eric fang <eric.fang@arm.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-28cmd/internal/obj/arm64: fix the wrong error message of out-of-range checkingeric fang
The error message of checking whether the offset value of load/store instruction is out of range is wrong. The right range is [-256, 255], not [-255, 254]. The CL fixes it. Change-Id: Ia342957f1f6bcec65eceb45944221d3972641bed Reviewed-on: https://go-review.googlesource.com/c/go/+/313891 Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Trust: eric fang <eric.fang@arm.com> Run-TryBot: eric fang <eric.fang@arm.com>
2021-04-22cmd/internal/obj/arm64: fix the wrong ROR operator of some instructionseric fang
Instructions such as ADD, SUB, CMP do not support ROR shift operations, but we have not checked this at present. This CL adds this check. Change-Id: Icac461f61ad6ddb60886a59ba34dddd29df1cc0f Reviewed-on: https://go-review.googlesource.com/c/go/+/310035 Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Trust: eric fang <eric.fang@arm.com> Run-TryBot: eric fang <eric.fang@arm.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-15cmd/internal/obj/arm64: fix the wrong sp dst register of ADDS/SUBS instructionseric fang
According the armv8-a specification, the destination register of the ADDS/ADDSW/ SUBS/SUBSW instructions can not be RSP, the current implementation does not check this and encodes this wrong instruction format as a CMN instruction. This CL adds a check and test cases for this situation. Change-Id: I92cc2f8e17dbda70f0dce8fddf1ca6d5d7730589 Reviewed-on: https://go-review.googlesource.com/c/go/+/309989 Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Trust: eric fang <eric.fang@arm.com> Run-TryBot: eric fang <eric.fang@arm.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-03-12cmd/internal/obj/arm64: add support for op(extended register) with RSP argumentsfanzha02
Refer to ARM reference manual, like add(extended register) instructions, the extension is encoded in the "option" field. If "Rd" or "Rn" is RSP and "option" is "010" then LSL is preferred. Therefore, the instrution "add Rm<<imm, RSP, RSP" or "add Rm<<imm RSP" is valid and can be encoded as add(extended register) instruction. But the current assembler can not handle like "op R1<<1, RSP, RSP" instructions, this patch adds the support. Because MVN(extended register) does not exist, remove it. Add test cases. Change-Id: I968749d75c6b93a4f297b39c73cc292e6b1035ad Reviewed-on: https://go-review.googlesource.com/c/go/+/284900 Trust: fannie zhang <Fannie.Zhang@arm.com> Run-TryBot: fannie zhang <Fannie.Zhang@arm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-03-04cmd/asm: add arm64 instructions VUMAX and VUMINeric fang
This CL adds support for arm64 fp&simd instructions VUMAX and VUMIN. Fixes #42326 Change-Id: I3757ba165dc31ce1ce70f3b06a9e5b94c14d2ab9 Reviewed-on: https://go-review.googlesource.com/c/go/+/271497 Trust: eric fang <eric.fang@arm.com> Run-TryBot: eric fang <eric.fang@arm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: fannie zhang <Fannie.Zhang@arm.com> Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-03-04cmd/asm: add 128-bit FLDPQ and FSTPQ instructions for arm64eric fang
This CL adds assembly support for 128-bit FLDPQ and FSTPQ instructions. This CL also deletes some wrong pre/post-indexed LDP and STP instructions, such as {ALDP, C_UAUTO4K, C_NONE, C_NONE, C_PAIR, 74, 8, REGSP, 0, C_XPRE}, because when the offset type is C_UAUTO4K, pre and post don't work. Change-Id: Ifd901d4440eb06eb9e86c9dd17518749fdf32848 Reviewed-on: https://go-review.googlesource.com/c/go/+/273668 Trust: eric fang <eric.fang@arm.com> Run-TryBot: eric fang <eric.fang@arm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-11-04cmd/asm: rename arm64 instructions LDANDx to LDCLRxJonathan Swinney
The LDANDx instructions were misleading because they correspond to the mnemonic LDCLRx as defined in the Arm Architecture Reference Manual for Armv8. This changes the assembler to use the same mnemonic as the GNU assembler and the manual. The instruction has the form: LDCLRx Rs, (Rb), Rt: *Rb -> Rt, Rs AND NOT(*Rb) -> *Rb Change-Id: I94ae003e99e817209bba1afe960e612bf3a0b410 Reviewed-on: https://go-review.googlesource.com/c/go/+/267138 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: fannie zhang <Fannie.Zhang@arm.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: fannie zhang <Fannie.Zhang@arm.com>
2020-10-29cmd/internal/obj/arm64: add CASx/CASPx instructionsfanzha02
This patch adds support for CASx and CASPx atomic instructions. go syntax gnu syntax CASD Rs, (Rn|RSP), Rt => cas Xs, Xt, (Xn|SP) CASALW Rs, (Rn|RSP), Rt => casal Ws, Wt, (Xn|SP) CASPD (Rs, Rs+1), (Rn|RSP), (Rt, Rt+1) => casp Xs, Xs+1, Xt, Xt+1, (Xn|SP) CASPW (Rs, Rs+1), (Rn|RSP), (Rt, Rt+1) => casp Ws, Ws+1, Wt, Wt+1, (Xn|SP) This patch changes the type of prog.RestArgs from "[]Addr" to "[]struct{Addr, Pos}", Pos is a enum, indicating the position of the operand. This patch also adds test cases. Change-Id: Ib971cfda7890b7aa895d17bab22dea326c7fcaa4 Reviewed-on: https://go-review.googlesource.com/c/go/+/233277 Trust: fannie zhang <Fannie.Zhang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-10-29cmd/asm: add several arm64 SIMD instructionsfanzha02
This patch enables VSLI, VUADDW(2), VUSRA and FMOVQ SIMD instructions required by the issue #40725. And the GNU syntax of 'FMOVQ' is 128-bit ldr/str(immediate, simd&fp). Add test cases. Fixes #40725 Change-Id: Ide968ef4a9385ce4cd8f69bce854289014d30456 Reviewed-on: https://go-review.googlesource.com/c/go/+/258397 Trust: fannie zhang <Fannie.Zhang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-09-10cmd/asm: add more SIMD instructions on arm64Junchen Li
This CL adds USHLL, USHLL2, UZP1, UZP2, and BIF instructions requested by #40725. And since UXTL* are aliases of USHLL*, this CL also merges them into one case. Updates #40725 Change-Id: I404a4fdaf953319f72eea548175bec1097a2a816 Reviewed-on: https://go-review.googlesource.com/c/go/+/253659 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-09-10cmd/internal/obj/arm64: enable some SIMD instructionsfanzha02
Enable VBSL, VBIT, VCMTST, VUXTL VUXTL2 and FMOVQ SIMD instructions required by the issue #40725. And FMOVQ instrucion is used to move a large constant to a Vn register. Add test cases. Fixes #40725 Change-Id: I1cac1922a0a0165d698a4b73a41f7a5f0a0ad549 Reviewed-on: https://go-review.googlesource.com/c/go/+/249758 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-09-07cmd/asm: fix the error of checking the post-index offset of VLD[1-4]R ↵fanzha02
instructions of arm64 The post-index offset of VLD[1-4]R instructions is decided by the "size" field not "Q" field, the current assembler uses "Q" fileld to check the correctness of post-index offset which is not correct. This patch fixes it. Fixes #40725 Change-Id: If1cde7f21c6b3ee0e491649eb567700bd1475c84 Reviewed-on: https://go-review.googlesource.com/c/go/+/249757 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-25cmd/asm: add asimd instruction 'rev16' on arm64Xiangdong Ji
Add support to the asimd instruction rev16 which reverses elements in 16-bit halfwords. syntax: VREV16 <Vn>.<T>, <Vd>.<T> <T> should be either B8 or B16. Change-Id: I7a7b8e772589c51ca9eb6dca98bab1aac863c6c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/213738 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-08cmd/internal/obj/arm64: add error checking for system registers.diaxu01
This CL adds system register error checking test cases. There're two kinds of error test cases: 1. illegal combination. MRS should be used in this way: MRS <system register>, <general register>. MSR should be used in this way: MSR <general register>, <system register>. Error usage examples: MRS R8, VTCR_EL2 // ERROR "illegal combination" MSR VTCR_EL2, R8 // ERROR "illegal combination" 2. illegal read or write access. Error usage examples: MSR R7, MIDR_EL1 // ERROR "expected writable system register or pstate" MRS OSLAR_EL1, R3 // ERROR "expected readable system register" This CL reads system registers readable and writeable property to check whether they're used with legal read or write access. This property is named AccessFlags in sysRegEnc.go, and it is automatically generated by modifing the system register generator. Change-Id: Ic83d5f372de38d1ecd0df1ca56b354ee157f16b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/194917 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-06cmd/asm: add arm64 v8.1 atomic instructionserifan01
This change adds several arm64 v8.1 atomic instructions and test cases. They are LDADDAx, LDADDLx, LDANDAx, LDANDALx, LDANDLx, LDEORAx, LDEORALx, LDEORLx, LDORAx, LDORALx, LDORLx, SWPAx and SWPLx. Their form is consistent with the form of the existing atomic instructions. For instructions STXRx, STLXRx, STXPx and STLXPx, the second destination register can't be RSP. This CL also adds a check for this. LDADDx Rs, (Rb), Rt: *Rb -> Rt, Rs + *Rb -> *Rb LDANDx Rs, (Rb), Rt: *Rb -> Rt, Rs AND NOT(*Rb) -> *Rb LDEORx Rs, (Rb), Rt: *Rb -> Rt, Rs EOR *Rb -> *Rb LDORx Rs, (Rb), Rt: *Rb -> Rt, Rs OR *Rb -> *Rb Change-Id: I9f9b0245958cb57ab7d88c66fb9159b23b9017fd Reviewed-on: https://go-review.googlesource.com/c/go/+/157001 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-09-12cmd/internal/obj/arm64: add error report for invalid base registerfanzha02
The current assembler accepts the non-integer register as the base register, which should be an illegal combination. Add the test cases. Change-Id: Ia21596bbb5b1e212e34bd3a170748ae788860422 Reviewed-on: https://go-review.googlesource.com/134575 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-09-06cmd/internal/obj/arm64: add CONSTRAINED UNPREDICTABLE behavior check for ↵fanzha02
some load/store According to ARM64 manual, it is "constrained unpredictable behavior" if the src and dst registers of some load/store instructions are same. In order to completely prevent such unpredictable behavior, adding the check for load/store instructions that are supported by the assembler in the assembler. Add test cases. Update #25823 Change-Id: I64c14ad99ee543d778e7ec8ae6516a532293dbb3 Reviewed-on: https://go-review.googlesource.com/120660 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-08-24cmd/internal/obj: support more arm64 FP instructionsBen Shi
ARM64 also supports float point LDP(load pair) & STP (store pair). The CL adds implementation and corresponding test cases for FLDPD/FLDPS/FSTPD/FSTPS. Change-Id: I45f112012a4e097bfaf023d029b36e6cbc7a5859 Reviewed-on: https://go-review.googlesource.com/125438 Run-TryBot: Ben Shi <powerman1st@163.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-07-30cmd/internal/obj/arm64: reject incorrect form of LDP/STPBen Shi
"LDP (R0), (F0, F1)" and "STP (F1, F2), (R0)" are silently accepted by the arm64 assembler without any error message. And this CL fixes that bug. fixes #26556. Change-Id: Ib6fae81956deb39a4ffd95e9409acc8dad3ab2d2 Reviewed-on: https://go-review.googlesource.com/125637 Run-TryBot: Ben Shi <powerman1st@163.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-06-01cmd/internal/obj/arm64: fix two issues in the assemblerBen Shi
There are two issues in the arm64 assembler. 1. "CMPW $0x22220000, RSP" is encoded to 5b44a4d2ff031b6b, which is the combination of "MOVD $0x22220000, Rtmp" and "NEGSW Rtmp, ZR". The right encoding should be a combination of "MOVD $0x22220000, Rtmp" and "CMPW Rtmp, RSP". 2. "AND $0x22220000, R2, RSP" is encoded to 5b44a4d25f601b00, which is the combination of "MOVD $0x22220000, Rtmp" and an illegal instruction. The right behavior should be an error report of "illegal combination", since "AND Rtmp, RSP, RSP" is invalid in armv8. This CL fixes the above 2 issues and adds more test cases. fixes #25557 Change-Id: Ia510be26b58a229f5dfe8a5fa0b35569b2d566e7 Reviewed-on: https://go-review.googlesource.com/114796 Run-TryBot: Ben Shi <powerman1st@163.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-05-07cmd/internal/obj/arm64: fix illegal 4-operand instructions accepted arm64 bugfanzha02
Current assmbler accepts MUL* related instructions with 4 operands, such as instruction "MUL R1, R2, R3, R4", which is illegal. The fix adds an actual field informantion to Optab, which has value of C_NONE, C_REG, etc, so assembler can use p.From3Type for checking in oplook. Add test cases. Fixes #25059 Change-Id: I0656319383c460696b392197bf5960b987f8fc97 Reviewed-on: https://go-review.googlesource.com/109295 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com>
2018-04-19cmd/asm: add rev64 instruction on ARM64Fangming.Fang
This change provides VREV64 instruction for AES-GCM implementation. Change-Id: Icdf278862b03556388586f459964b025c47b8c19 Reviewed-on: https://go-review.googlesource.com/107696 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-11cmd/internal/obj/arm64: add support for a series of load/store with register ↵fanzha02
offset instrucitons The patch adds support for arm64 instructions LDRB, LDRH, LDRSB, LDRSH, LDRSW, STR, STRB and STRH with register offset. Test cases are also added. Change-Id: I8d17fddd2963c0bc366e12b00bac49b93f3f0957 Reviewed-on: https://go-review.googlesource.com/91575 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-09cmd/internal/obj/arm64: add assembler support for load with register offsetfanzha02
The patch adds support for LDR(register offset) instruction. And add the test cases and negative tests. Change-Id: I5b32c6a5065afc4571116d4896f7ebec3c0416d3 Reviewed-on: https://go-review.googlesource.com/87955 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-04-03cmd/asm: add essential instructions for AES-GCM on ARM64Fangming.Fang
This change adds VLD1, VST1, VPMULL{2}, VEXT, VRBIT, VUSHR and VSHL instructions for supporting AES-GCM implementation later. Fixes #24400 Change-Id: I556feb88067f195cbe25629ec2b7a817acc58709 Reviewed-on: https://go-review.googlesource.com/101095 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-19cmd/asm: add ARM64 assembler check for incorrect inputfanzha02
Current ARM64 assembler has no check for the invalid value of both shift amount and post-index immediate offset of LD1/ST1. This patch adds the check. This patch also fixes the printing error of register number equals to 31, which should be printed as ZR instead of R31. Test cases are also added. Change-Id: I476235f3ab3a3fc91fe89c5a3149a4d4529c05c7 Reviewed-on: https://go-review.googlesource.com/100255 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com>
2018-03-13cmd/internal/obj/arm64: support logical instructions targeting RSPCherry Zhang
Logical instructions can have RSP as its destination. Support it. Note that the two-operand form, like "AND $1, RSP", which is equivalent to the three-operand form "AND $1, RSP, RSP", is invalid, because the source register is not allowed to be RSP. Also note that instructions that set the conditional flags, like ANDS, cannot target RSP. Because of this, we split out the optab entries of AND et al. and ANDS et al. Merge the optab entries of BIC et al. to AND et al., because they are same. Fixes #24332. Change-Id: I3584d6f2e7cea98a659a1ed9fdf67c353e090637 Reviewed-on: https://go-review.googlesource.com/100217 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-02-22cmd/asm: add arm64 instructions for math optimizationerifan01
Add arm64 HW instructions FMADDD, FMADDS, FMSUBD, FMSUBS, FNMADDD, FNMADDS, FNMSUBD, FNMSUBS, VFMLA, VFMLS, VMOV (element) for math optimization. Add check on register element index and test cases. Change-Id: Ice07c50b1a02d488ad2cde2a4e8aea93f3e3afff Reviewed-on: https://go-review.googlesource.com/90876 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-02-06cmd/internal/obj/arm64: fix assemble add/adds/sub/subs/cmp/cmn(extended ↵fanzha02
register) bug The current code encodes the wrong option value in the binary. The fix reconstructs the function opxrrr() that does not encode the option value into the binary value when arguments is sign or zero-extended register. Add the relevant test cases and negative tests. Fixes #23501 Change-Id: Ie5850ead2ad08d9a235a5664869aac5051762f1f Reviewed-on: https://go-review.googlesource.com/88876 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-01-23cmd/internal/obj/arm64: fix assemble VLD1/VST1 bugfanzha02
The current code misassembles VLD1/VST1 instruction with non-zero offset. The offset is dropped silently without any error message. The cause of the misassembling is the current code treats argument (Rn)(Rm) as ZOREG type. The fix changes the matching rules and considers (Rn)(Rm) as ROFF type. The fix will report error information when assembles VLD1/VST1 (R8)(R13), [V1.16B]. The fix enables the ARM64Errors test. Fixes #23448 Change-Id: I3dd518b91e9960131ffb8efcb685cb8df84b70eb Reviewed-on: https://go-review.googlesource.com/87956 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>