aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
AgeCommit message (Collapse)Author
2019-12-24cmd/internal/obj/riscv: handle FEQ/FNEG/SEQZ/SNEZJoel Sing
Based on riscv-go port. Updates #27532 Change-Id: I5e7f45955e1dfdb9d09cc6a4e6f3ce81216d411d Reviewed-on: https://go-review.googlesource.com/c/go/+/204628 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-12-24cmd/internal/obj/riscv: handle call, jmp and branchJoel Sing
Also provide REG_LR to more clearly define the link register. Based on the riscv-go port. Updates #27532 Change-Id: I0805f373682f93b3918a01c21d4ef34eb3817c75 Reviewed-on: https://go-review.googlesource.com/c/go/+/204627 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-11[dev.link] cmd/compile, cmd/asm: delete old object file format supportCherry Zhang
There are more cleanups to do, but I want to keep this CL mostly a pure deletion. Change-Id: Icd2ff0a4b648eb4adf3d29386542617e49620818 Reviewed-on: https://go-review.googlesource.com/c/go/+/206398 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-11[dev.link] cmd: reenable newobj mode by defaultCherry Zhang
Change-Id: I6e820a77c516363f350c2aad5bc17a2d7e7501e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/206457 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-08Merge "cmd: merge branch 'dev.link' into master"Gerrit Code Review
2019-11-06cmd/asm: add encode tests for MIPS64xMeng Zhuo
This CL adds basic encode test for mips64x and most of the instructions are cross checked with 'gas' Update #35008 Change-Id: I18bb524897aa745bfe23db43fcbb44c3b009463c Reviewed-on: https://go-review.googlesource.com/c/go/+/204297 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-05cmd: merge branch 'dev.link' into masterCherry Zhang
In the dev.link branch we implemented the new object file format and (part of) the linker improvements described in https://golang.org/s/better-linker The new object file is index-based and provides random access. The linker maps the object files into read-only memory, and access symbols on-demand using indices, as opposed to reading all object files sequentially into the heap with the old format. The linker carries symbol informations using indices (as opposed to Symbol data structure). Symbols are created after the reachability analysis, and only created for reachable symbols. This reduces the linker's memory usage. Linking cmd/compile, it creates ~25% fewer Symbols, and reduces memory usage (inuse_space) by ~15%. (More results from Than.) Currently, both the old and new object file formats are supported. The old format is used by default. The new format can be turned on by using the compiler/assembler/linker's -newobj flag. Note that the flag needs to be specified consistently to all compilations, i.e. go build -gcflags=all=-newobj -asmflags=all=-newobj -ldflags=-newobj Change-Id: Ia0e35306b5b9b5b19fdc7fa7c602d4ce36fa6abd
2019-11-05[dev.link] cmd: default to old object file formatCherry Zhang
Flip back to the old object files for Go 1.14. Change-Id: I4ad499460fb7156b63fc63e9c6ea4f7099e20af2 Reviewed-on: https://go-review.googlesource.com/c/go/+/204098 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-04cmd/internal/obj/s390x: add support of SPM instructionCherry Zhang
For restoring condition code (we already support IPM instruction for saving condition code). Change-Id: I56d376df44a5f831134a130d052521cec6b5b781 Reviewed-on: https://go-review.googlesource.com/c/go/+/204104 Reviewed-by: Michael Munday <mike.munday@ibm.com>
2019-11-04cmd/asm/internal/asm/testdata/s390x: add test cases for some assembly ↵Ruixin(Peter) Bao
instructions From CL 199979, I noticed that there were some instructions not covered by the test cases. Added those in this CL. Additional tests for assembly instructions are also added based on suggestions made during the review of this CL. Previously, VSB and VSH are not included in asmz.go, they were also added in this patch. Change-Id: I6060a9813b483a161d61ad2240c30eec6de61536 Reviewed-on: https://go-review.googlesource.com/c/go/+/203721 Reviewed-by: Michael Munday <mike.munday@ibm.com>
2019-11-04cmd/internal/obj/ppc64: add support for DQ-form instructionsCarlos Eduardo Seo
POWER9 (ISA 3.0) introduced a new format of load/store instructions to implement indexed load/store quadword, using an immediate value instead of a register index. This change adds support for this new instruction encoding and adds the new load/store quadword instructions (lxv/stxv) to the assembler. This change also adds the missing XX1-form loads/stores (halfword and byte) included in ISA 3.0. Change-Id: Ibcdf53c342d7a352d64a9403c2fe7b25be9c3b24 Reviewed-on: https://go-review.googlesource.com/c/go/+/200399 Run-TryBot: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2019-11-01[dev.link] all: merge branch 'master' into dev.linkThan McIntosh
Fixed a couple of minor conflicts in lib.go and deadcode.go relating to debug logging. Change-Id: I58335fc42ab1f1f3409fd8354da4f26419e8fb22
2019-10-29cmd/internal/obj/mips: fix encoding of FCR registersCherry Zhang
The asm encoder generally assumes that the lowest 5 bits of the REG_XX constants match the machine instruction encoding, i.e. the lowest 5 bits is the register number. This was not true for FCR registers and M registers. Make it so. MOV Rx, FCRy was encoded as two machine instructions. The first is unnecessary. Remove. Change-Id: Ib988e6b109ba8f564337cdd31019c1a6f1881f5b Reviewed-on: https://go-review.googlesource.com/c/go/+/203717 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2019-10-18[dev.link] all: merge branch 'master' into dev.linkCherry Zhang
Clean merge. Change-Id: I94d5e621b98cd5b3e1f2007db83d52293edbd9ec
2019-10-18cmd/internal/obj/arm64: add support of NOOP instructiondiaxu01
This patch uses symbol NOOP to support arm64 instruction NOP. In arm64, NOP stands for that No Operation does nothing, other than advance the value of the program counter by 4. This instruction can be used for instruction alignment purposes. This patch uses NOOP to support arm64 instruction NOP, because we have a generic "NOP" instruction, which is a zero-width pseudo-instruction. In arm64, instruction NOP is an alias of HINT #0. This patch adds test cases for instruction HINT #0. Change-Id: I54e6854c46516eb652b412ef9e0f73ab7f171f8c Reviewed-on: https://go-review.googlesource.com/c/go/+/200578 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-17cmd/asm: add missing x86 instructionsArtem Alekseev
Instructions added: CLDEMOTE, CLWB, TPAUSE, UMWAIT, UMONITOR. Change-Id: I1ba550d4d5acc41a2fd97068ff5834e0412d3bcf Reviewed-on: https://go-review.googlesource.com/c/go/+/183225 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-17cmd/asm/internal/arch: delete unused s390x functionsMichael Munday
These functions are not necessary and are not called anywhere. Change-Id: I1c0d814ba3044c27e3626ac9e6052d8154140404 Reviewed-on: https://go-review.googlesource.com/c/go/+/201697 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-16[dev.link] cmd: default to new object filesCherry Zhang
Switch the default to new object files. Internal linking cgo is disabled for now, as it does not work yet in newobj mode. Shared libraries are also broken. Disable some tests that are known broken for now. Change-Id: I8ca74793423861d607a2aa7b0d89a4f4d4ca7671 Reviewed-on: https://go-review.googlesource.com/c/go/+/200161 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-15cmd/internal/obj/riscv: implement MOV pseudo-instructionsJoel Sing
Add support for rewriting MOV pseudo-instructions into appropriate RISC-V instructions. Based on the riscv-go port. Updates #27532 Change-Id: I22da6f5f12c841d56fb676ab2a37f6d0a686b033 Reviewed-on: https://go-review.googlesource.com/c/go/+/198677 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-11[dev.link] all: merge branch 'master' into dev.linkCherry Zhang
Clean merge. Change-Id: If9bfb0f27f41563fd5d386de9c1081542c3ce498
2019-10-10all: remove nacl (part 3, more amd64p32)Brad Fitzpatrick
Part 1: CL 199499 (GOOS nacl) Part 2: CL 200077 (amd64p32 files, toolchain) Part 3: stuff that arguably should've been part of Part 2, but I forgot one of my grep patterns when splitting the original CL up into two parts. This one might also have interesting stuff to resurrect for any future x32 ABI support. Updates #30439 Change-Id: I2b4143374a253a003666f3c69e776b7e456bdb9c Reviewed-on: https://go-review.googlesource.com/c/go/+/200318 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-09cmd/asm: add s390x branch-on-count instructionsMichael Munday
The branch-on-count instructions on s390x decrement the input register and then compare its value to 0. If not equal the branch is taken. These instructions are useful for implementing loops with a set number of iterations (which might be in a register). For example, this for loop: for i := 0; i < n; i++ { ... // i is not used or modified in the loop } Could be implemented using this assembly: MOVD Rn, Ri loop: ... BRCTG Ri, loop Note that i will count down from n in the assembly whereas in the original for loop it counted up to n which is why we can't use i in the loop. These instructions will only be used in hand-written codegen and assembly for now since SSA blocks cannot currently modify values. We could look into this in the future though. Change-Id: Iaab93b8aa2699513b825439b8ea20d8fe2ea1ee6 Reviewed-on: https://go-review.googlesource.com/c/go/+/199977 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-09cmd/asm: fix element size encoding for VSUMQ instruction on s390xMichael Munday
The element size for VSUMQF and VSUMQG was off by one. Fix this and add tests for VSUM* instruction encodings. Change-Id: I6de2dabb383e5bc6f85eef1e0f106ba949c9030b Reviewed-on: https://go-review.googlesource.com/c/go/+/199978 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
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-10-04[dev.link] all: merge branch 'master' into dev.linkCherry Zhang
Weekly merge. Change-Id: I98c6121f04f347df2788ac5eaf99afad5da4a039
2019-10-03cmd/asm: add VLD[1-4]R vector instructions on arm64Meng Zhuo
This change adds VLD1R, VLD2R, VLD3R, VLD4R Change-Id: Ie19e9ae02fdfc94b9344acde8c9938849efb0bf0 Reviewed-on: https://go-review.googlesource.com/c/go/+/181697 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-02[dev.link] cmd/compile, cmd/asm: assign index to symbolsCherry Zhang
We are planning to use indices for symbol references, instead of symbol names. Here we assign indices to symbols defined in the package being compiled, and propagate the indices to the dependent packages in the export data. A symbol is referenced by a tuple, (package index, symbol index). Normally, for a given symbol, this index is unique, and the symbol index is globally consistent (but with exceptions, see below). The package index is local to a compilation. For example, when compiling the fmt package, fmt.Println gets assigned index 25, then all packages that reference fmt.Println will refer it as (X, 25) with some X. X is the index for the fmt package, which may differ in different compilations. There are some symbols that do not have clear package affiliation, such as dupOK symbols and linknamed symbols. We cannot give them globally consistent indices. We categorize them as non-package symbols, assign them with package index 1 and a symbol index that is only meaningful locally. Currently nothing will consume the indices. All this is behind a flag, -newobj. The flag needs to be set for all builds (-gcflags=all=-newobj -asmflags=all=-newobj), or none. Change-Id: I18e489c531e9a9fbc668519af92c6116b7308cab Reviewed-on: https://go-review.googlesource.com/c/go/+/196029 Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-01[dev.link] cmd/compile, cmd/asm: use bio.Writer for object file writingCherry Zhang
It is convenient to have a seekable writer. A later CL will make use of Seek. Change-Id: Iba0107ce2975d9a451d97f16aa91a318dd4c90e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/196028 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-26cmd/internal/obj/riscv: require memory targets for load and store instructionsJoel Sing
This allows for `LD 4(X5), X6' rather than `LD $4, X5, X6'. Similar for other load and store instructions. It is worth noting that none of these are likely to be used directly once the MOV pseudo-instructions are implemented. Updates #27532 Change-Id: Ie043c2dedd2cdaceb258b27976cfb3f74aa1cc1d Reviewed-on: https://go-review.googlesource.com/c/go/+/196842 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-26cmd/internal/obj/riscv: implement control transfer instructionsJoel Sing
Add support for assembling control transfer instructions. Based on the riscv-go port. Updates #27532 Change-Id: I205d3ccd0a48deeaace0f20fca8516f382a83fae Reviewed-on: https://go-review.googlesource.com/c/go/+/196841 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-26cmd/internal/obj/riscv: implement AUIPC and LUI instructionsJoel Sing
Add support for assembling AUIPC and LUI instructions. Based on the riscv-go port. Updates #27532 Change-Id: I178868b6dcc6fdc6b8527454569a3538ed50723e Reviewed-on: https://go-review.googlesource.com/c/go/+/196840 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-25cmd/asm: add masked branch and conditional load instructions to s390xMichael Munday
The branch-relative-on-condition (BRC) instruction allows us to use an immediate to specify under what conditions the branch is taken. For example, `BRC $7, L1` is equivalent to `BNE L1`. It is sometimes useful to specify branches in this way when either we don't have an extended mnemonic for a particular mask value or we want to generate the condition code mask programmatically. The new load-on-condition (LOCR and LOCGR) and compare-and-branch (CRJ, CGRJ, CLRJ, CLGRJ, CIJ, CGIJ, CLIJ and CLGIJ) instructions provide the same flexibility for conditional loads and combined compare and branch instructions. Change-Id: Ic6f5d399b0157e278b39bd3645f4ee0f4df8e5fc Reviewed-on: https://go-review.googlesource.com/c/go/+/196558 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-25cmd/internal/obj/riscv: implement floating point instructionsJoel Sing
Add support for assembling various single-precision and double-precision floating point instructions. Based on the riscv-go port. Updates #27532 Change-Id: Iac1aec9b03bb6cbf116b229daeef944d4df550fa Reviewed-on: https://go-review.googlesource.com/c/go/+/196839 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-24cmd/internal/obj/riscv: implement RV64I integer computational instructionsJoel Sing
Add support for assembling RV64I integer computational instructions. Based on the riscv-go port. Updates #27532 Integer Computational Instructions (RV64I) Change-Id: I1a082b3901c997da309d737d081f57ea2821bc62 Reviewed-on: https://go-review.googlesource.com/c/go/+/196838 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-24cmd/internal/obj/riscv: add environment call/breakpoint and base ↵Joel Sing
counter/timer instructions This implements assembler support for ECALL/EBREAK, along with base counter/timer instructions. Based on riscv-go port. Updates #27532 Change-Id: I690a9fd835eeddee1fe9a5616d2b2f856d3952b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/195918 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-20cmd/internal/obj/riscv: add load, store and multiplication instructionsJoel Sing
Add support for assembling load, store and multiplication instructions. Based on the riscv-go port. Updates #27532 Change-Id: Ia7b6e60ae45416a82f240e7b7fc101a36ce18886 Reviewed-on: https://go-review.googlesource.com/c/go/+/195917 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-18cmd/asm,cmd/compile: clean up isel codegen on ppc64xLynn Boger
This cleans up the isel code generation in ssa for ppc64x. Current there is no isel op and the isel code is only generated from pseudo ops in ppc64/ssa.go, and only using operands with values 0 or 1. When the isel is generated, there is always a load of 1 into the temp register before it. This change implements the isel op so it can be used in PPC64.rules, and can recognize operand values other than 0 or 1. This also eliminates the forced load of 1, so it will be loaded only if needed. This will make the isel code generation consistent with other ops, and allow future rule changes that can take advantage of having a more general purpose isel rule. Change-Id: I363e1dbd3f7f5dfecb53187ad51cce409a8d1f8d Reviewed-on: https://go-review.googlesource.com/c/go/+/195057 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
2019-09-17cmd/asm,cmd/internal/obj/riscv: implement integer computational instructionsJoel Sing
Add support for assembling integer computational instructions. Based on the riscv-go port. Updates #27532 Change-Id: Ibf02649eebd65ce96002a9ca0624266d96def2cd Reviewed-on: https://go-review.googlesource.com/c/go/+/195079 Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-13cmd/compile: add math/bits.Mul64 intrinsic on s390xRuixin Bao
This change adds an intrinsic for Mul64 on s390x. To achieve that, a new assembly instruction, MLGR, is introduced in s390x/asmz.go. This assembly instruction directly uses an existing instruction on Z and supports multiplication of two 64 bit unsigned integer and stores the result in two separate registers. In this case, we require the multiplcand to be stored in register R3 and the output result (the high and low 64 bit of the product) to be stored in R2 and R3 respectively. A test case is also added. Benchmark: name old time/op new time/op delta Mul-18 11.1ns ± 0% 1.4ns ± 0% -87.39% (p=0.002 n=8+10) Mul32-18 2.07ns ± 0% 2.07ns ± 0% ~ (all equal) Mul64-18 11.1ns ± 1% 1.4ns ± 0% -87.42% (p=0.000 n=10+10) Change-Id: Ieca6ad1f61fff9a48a31d50bbd3f3c6d9e6675c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/194572 Reviewed-by: Michael Munday <mike.munday@ibm.com> Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-12cmd/asm,cmd/internal/obj: initial support for riscv64 assemblerJoel Sing
Provide the initial framework for the riscv64 assembler. For now this only supports raw WORD instructions, but at least allows for basic testing. Additional functionality will be added in separate changes. Based on the riscv-go port. Updates #27532 Change-Id: I181ffb2d37a34764a3e91eded177d13a89c69f9a Reviewed-on: https://go-review.googlesource.com/c/go/+/194117 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-12cmd/internal/obj/s390x: use 12 bit load and store instruction when possible ↵Ruixin Bao
on s390x Originally, we default to use load and store instruction with 20 bit displacement. However, that is not necessary. Some instructions have a displacement smaller than 12 bit. This CL allows the usage of 12 bit load and store instruction when that happens. This change also reduces the size of .text section in go binary by 19 KB. Some tests are also added to verify the functionality of the change. Change-Id: I13edea06ca653d4b9ffeaefe8d010bc2f065c2ba Reviewed-on: https://go-review.googlesource.com/c/go/+/194857 Reviewed-by: Michael Munday <mike.munday@ibm.com> Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-11cmd/compile/internal/s390x: replace 4-byte NOP with a 2-byte NOP on s390xRuixin(Peter) Bao
Added a new instruction, NOPH, with the encoding [0x0700](i.e: bcr 0, 0) and replace the current 4-byte nop that was encoded using the WORD instruction. This reduces the size of .text section in go binary by around 17KB and make generated code easier to read. Change-Id: I6a756df39e93c4415ea6d038ba4af001b8ccb286 Reviewed-on: https://go-review.googlesource.com/c/go/+/194344 Reviewed-by: Michael Munday <mike.munday@ibm.com> Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-07cmd/asm/internal/arch: consolidate LinkArch handlingJoel Sing
Rather than manually setting the LinkArch for each case, pass the correct *obj.LinkArch to the arch* function, as is already done for archX86(). Change-Id: I4cf950780aa30a1385e785fb1d26edacb99bda79 Reviewed-on: https://go-review.googlesource.com/c/go/+/193818 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-29cmd/internal/obj/ppc64: add support for vmrgow,vmrgewLynn Boger
This adds support for ppc64 instructions vmrgow and vmrgew which are needed for an improved implementation of chacha20. Change-Id: I967a2de54236bcc573a99f7e2b222d5a8bb29e03 Reviewed-on: https://go-review.googlesource.com/c/go/+/192117 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
2019-08-28cmd/asm: add V[LD|ST][2-4] vector instructions on arm64Meng Zhuo
This change adds VLD2, VLD3, VLD4, VST2, VST3, VST4 (multiple structures) for image or multi media optimazation. Change-Id: Iae3538ef4434e436e3fb2f19153c58f918f773af Reviewed-on: https://go-review.googlesource.com/c/go/+/166518 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-08-28cmd/internal/obj/arm64: add support for most system registersfanzha02
This patch supports the EL0 and EL1 system registers used in MRS/MSR instructions. This patch refactors the assembler code, allowing the assembler to read system register information from the automatically generated sysRegEnc.go file and move existing declared system registers to the sysRegEnc.go file. This patch adds 431 system registers, it is worth noting that the number of special registers is initialized to less than 1024 in the list7.go file. This CL also adds some test cases to test the newly added system registers. The test cases are contributed by Dianhong Xu <Dianhong.Xu@arm.com> Change-Id: Ic09a937eaaeefe82bd08b5dd726808f8ff6cebf6 Reviewed-on: https://go-review.googlesource.com/c/go/+/189577 Reviewed-by: Ben Shi <powerman1st@163.com> Run-TryBot: Ben Shi <powerman1st@163.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-09cmd/asm: accept TEXT f+0(SB) in -gensymabis modeRuss Cox
f+0(SB) is a non-standard but acceptable alias for f(SB). Fixes #30968. Change-Id: I499ccee4d3ff3ab4e47f75d99407aace858e59aa Reviewed-on: https://go-review.googlesource.com/c/go/+/174537 Reviewed-by: Austin Clements <austin@google.com>
2019-05-06cmd/internal/obj: write package path at compile time if possibleCherry Zhang
Currently, when the compiler emits a symbol name in the object file, it uses "". for the package path of the package being compiled. This is then expanded in the linker to the actual package path. With CL 173938, it does not need an allocation if the symbol name does not need expansion. In many cases, the compiler actually knows the package path (through the -p flag), so we could just write it out in compile time, without fixing it up in the linker. This reduces allocations in the linker. In case that the package path is not known (compiler's -p flag is missing, or the object file is generated by the assembler), the linker still does the expansion. This reduces ~100MB allocations (~10% inuse_space) in linking k8s.io/kubernetes/cmd/kube-apiserver on Linux/AMD64. Also makes the linker a little faster: linking cmd/go on Linux/AMD64: Real 1.13 ± 1% 1.11 ± 1% -2.13% (p=0.000 n=10+10) User 1.17 ± 3% 1.14 ± 5% -3.14% (p=0.003 n=10+10) Sys 0.34 ±15% 0.34 ±15% ~ (p=0.986 n=10+10) The caveat is that the object files get slightly bigger. On Linux/AMD64, runtime.a gets 2.1% bigger, cmd/compile/internal/ssa (which has a longer import path) gets 2.8% bigger. This reveals that when building an unnamed plugin (e.g. go build -buildmode=plugin x.go), the go command passes different package paths to the compiler and to the linker. Before this CL there seems nothing obviously broken, but given that the compiler already emits the package's import path in various places (e.g. debug info), I guess it is possible that this leads to some unexpected behavior. Now that the compiler writes the package path in more places, this disagreement actually leads to unresolved symbols. Adjust the go command to use the same package path for both compiling and linking. Change-Id: I19f08981f51db577871c906e08d9e0fd588a2dd8 Reviewed-on: https://go-review.googlesource.com/c/go/+/174657 Reviewed-by: Austin Clements <austin@google.com>
2019-05-03cmd/compile: add math/bits.{Add,Sub}64 intrinsics on s390xMichael Munday
This CL adds intrinsics for the 64-bit addition and subtraction functions in math/bits. These intrinsics use the condition code to propagate the carry or borrow bit. To make the carry chains more efficient I've removed the 'clobberFlags' property from most of the load and store operations. Originally these ops did clobber flags when using offsets that didn't fit in a signed 20-bit integer, however that is no longer true. As with other platforms the intrinsics are faster when executed in a chain rather than a loop because currently we need to spill and restore the carry bit between each loop iteration. We may be able to reduce the need to do this on s390x (e.g. by using compare-and-branch instructions that do not clobber flags) in the future. name old time/op new time/op delta Add64 1.21ns ± 2% 2.03ns ± 2% +67.18% (p=0.000 n=7+10) Add64multiple 2.98ns ± 3% 1.03ns ± 0% -65.39% (p=0.000 n=10+9) Sub64 1.23ns ± 4% 2.03ns ± 1% +64.85% (p=0.000 n=10+10) Sub64multiple 3.73ns ± 4% 1.04ns ± 1% -72.28% (p=0.000 n=10+8) Change-Id: I913bbd5e19e6b95bef52f5bc4f14d6fe40119083 Reviewed-on: https://go-review.googlesource.com/c/go/+/174303 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-04-30cmd/asm: reject BSWAPW on amd64Iskander Sharipov
Since BSWAP operation on 16-bit registers is undefined, forbid the usage of BSWAPW. Users should rely on XCHGB instead. This behavior is consistent with what GAS does. Fixes #29167 Change-Id: I3b31e3dd2acfd039f7564a1c17e6068617bcde8d Reviewed-on: https://go-review.googlesource.com/c/go/+/174312 Run-TryBot: Iskander Sharipov <quasilyte@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>