These instructions were recently added to asm9 so should
be included in golang.org/x/arch/ppc64.
lxvh8x
lxvb16x
stxv8x
stxvb16x
xxbrd
xxbrw
xxbrh
Change-Id: I51a08366f9bc81081bc95f9c28726ebd3f749373
Reviewed-on: https://go-review.googlesource.com/c/arch/+/260617
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
This adds some new instructions, mostly power9, to
the ppc64 instruction tables. This also fixes some
issues with the ppc64 disassembler's ordering of
operands and improves the test examples.
Change-Id: Ib9a2e9722897bc25556d0c9ae5189cb6cbdfc6a1
Reviewed-on: https://go-review.googlesource.com/c/arch/+/230957
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
The vendor directory was added in CL 13968, as part of the Go 1.5
vendor experiment (golang.org/s/go15vendor), before the module mode
was in existence to achieve these properties.
The version of the rsc.io/pdf dependency can be determined from the
go.mod file, resulting in reproducible builds.
The content of the rsc.io/pdf dependency can be fetched from origin,
proxy.golang.org, or another proxy, resulting in available builds.
The checksum of the rsc.io/pdf dependency is written down in the
go.sum file, as well as in sum.golang.org, resulting in secure builds.
I am not aware of a reason for the vendor directory to exist in this
repository anymore, so delete it in order to have fewer files.
Change-Id: Ib97b8ff164f9f5e6565cf5b49fb794f3e4aab43c
Reviewed-on: https://go-review.googlesource.com/c/arch/+/222539
Reviewed-by: Bryan C. Mills <bcmills@google.com>
The rsc.io/pdf package was added to the vendor directory 5 years ago
in CL 13968, back when the vendor directory was a part of the Go 1.5
vendor experiment.
The vendor.json file was written by hand in a format compatible with
the govendor tool. By now, that tool has been deprecated in favor of
the go command in module mode.
A go.mod file requiring a newer version of rsc.io/pdf was added in
CL 167137. Modify the vendor directory to use the newer rsc.io/pdf
version by recreating vendor directory using go command in Go 1.14:
rm -rf vendor
go mod vendor
It's possible the vendor directory isn't needed anymore and can be
safely deleted in a future change. The scope of this CL is only to
migrate from the deprecated govendor tool to the supported go tool;
deleting the vendor directory can still be done in a future change.
Remove the explicit mention of Go 1.5 vendor experiment from README
since it's old, and not relevant by now. Add a contributing section.
Updates golang/go#30228
Updates golang/go#33848
Change-Id: I95de95a3b2d81faf7235c675e5b8d425141f8d7a
Reviewed-on: https://go-review.googlesource.com/c/arch/+/222538
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This patch sets NOOP symbol to represent NOP which is equal to armv8
NOP instruction. because go assembler syntax uses NOOP instead of NOP.
Change-Id: I262a9901835128cead900fd9711616f46ae67fd1
Reviewed-on: https://go-review.googlesource.com/c/arch/+/204417
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: eric fang <eric.fang@arm.com>
This patch gets the readable and writeable property of system register from the
generator sysreggen.go and writes it to the sysRegEnc.go file. This attribute
would be used by assembler to check the correctness of system register's
read/write access for MRS/MSR instruction.
Change-Id: I637f86710c9f53e9e621d1dd6b7c4142f7bd4c11
Reviewed-on: https://go-review.googlesource.com/c/arch/+/194937
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The assembler needs to support the EL0 and EL1 system registers used
in the MSR/MRS instructions. Because there are many system registers,
this patch adds a generator sysreggen.go. The generator parses the
system register XML files to get the encoding information and writes
them to a $filename file (default "sysRegEnc.go" file). The automatically
generated file is moved to $GOROOT/src/cmd/internal/obj/arm64/ folder
and used by the assembler.
Change-Id: Ia5ee6b85c0a972fdaf3b28c194c36d6cfe4b5b10
Reviewed-on: https://go-review.googlesource.com/c/arch/+/191222
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The following improvements are included in this change:
- Display common special purpose registers for mtlr,mflr,mtctr,mfctr,
mtxer,mfxer,mftb; for others use mtspr and mfspr.
- Provide branch condition information (lt, gt, eq, ne, ge, le).
- Add cr number if cr1-cr7 is used.
- Pass pc to gnuArg to generate branch targets that are not relative.
Change-Id: Ia3ef6cb248c484a3ad72545e68d1ca59e32ae645
Reviewed-on: https://go-review.googlesource.com/c/arch/+/194597
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Moves initialization of the decoderCover variable from happening
unconditionally to only being initialized by the test code using it so
that it does not cause a data race when not being used and Decode is
called in parallel.
Fixesgolang/go#33532
Change-Id: I64d748f94d135f0c1f55f1456ff770ac5205c85a
GitHub-Last-Rev: 679e78ed1d
GitHub-Pull-Request: golang/arch#4
Reviewed-on: https://go-review.googlesource.com/c/arch/+/189919
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
All three test cases used to cause a panic.
Change-Id: I2874c1fb6f09e6c3678d0b8d469f2c582dd8f50b
Reviewed-on: https://go-review.googlesource.com/c/155939
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
The current output for the Go objdump on ppc64 is not correct
in many cases, generating opcodes that are not acceptable by the
Go assembler, and generating operands in the wrong order.
This adds some changes to generate an objdump for ppc64 code so that
the instructions generated are acceptable by the Go assembler,
and where some of the non-obvious operands have more meaningful names.
This includes the following changes:
- Correct some errors in ppc64map to make it work.
- Make a minor update to ppc64.csv to add the Go opcodes that have been
added to the Go assembler that were not in the table.
- Fix ppc64map to generate correct Go opcodes for ppc64 opcodes that end with '.'
indicating condition codes are set. The previous ppc64map was adding '_' at the end
for this case, but then had to be translated in plan9.go to 'CC' and many were not
being translated. This generates the correct suffix in the first step when
generating tables.go.
- Handle compare instructions correctly, since the names don't quite match
and the CR was not always handled correctly.
- Handle index loads and stores correctly, including VMX and VSX.
- Add mappings for all the names where the Go opcode does not match the ppc64 opcode.
- Handle all CR values, not just CR0 for those instructions that use them.
- Provide more information on BC instructions and generate the correct
branch mnemonic (BEQ, BNE, etc.) where possible.
- Make the output more consistent in spacing.
- Add some more testcases to testdata/decode.txt.
- If the instruction word is all 0s, the Go assembler will output WORD $0,
otherwise unrecognized instructions will be identified with '?'. For GNU,
all 0s will decode to .long 0x0 like the binutils objdump. This can happen
following a call to a panic or throw as a trap, or at the end of a function
for alignment purposes.
Note: the decoder does not handle extended opcodes correctly yet. I will add
that support in the next release and add the corresponding testcases.
We are working on an updated ppc64.csv, but I believe what is
there now covers the opcodes that are supported by the Go assembler.
Change-Id: If7fe1a2205512b476f4fb6b29a21f5459430e50c
Reviewed-on: https://go-review.googlesource.com/c/148574
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Now generates both VEX and EVEX encoded optabs.
Encoder based on these optabs passes tests added in
https://golang.org/cl/107217.
This version uses XED datafiles directly instead of x86.csv.
Also moves x86/x86spec/xeddata package to x86/xeddata to make it
usable from x86 packages.
Ported x86spec pattern set type to xeddata.
Updates golang/go#22779
Change-Id: I304267d888dcda4f776d1241efa524f397a8b7b3
Reviewed-on: https://go-review.googlesource.com/107216
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
The patch complements the unimplemented go syntax for SIMD instructions
and adds the test cases.
Change-Id: I2682b03f197373fb44c4daedbc3a2a0a8e3f5f49
Reviewed-on: https://go-review.googlesource.com/101175
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Because some instructions like ADD(extended register) have been handled
by assembler, but disassembler still has incorrect Go syntax for those
instructions.
This patch complements the unimplemented Go syntax in disassembler and
separates the cases.txt into two test files (gnucases.txt and
plan9cases.txt), so that the Go syntax test will be easier. The cases
added in the plan9cases.txt file can handled by current
disassembler.
Change-Id: Ie3e0d04700fc85da8bd1758a249ec7a7f7a5a117
Reviewed-on: https://go-review.googlesource.com/98398
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Fix bad field name and add new method that is going to be used
in XED-based x86spec generator.
Change-Id: I7932e095f74a3354402b566a3f750b25b7bb7def
Reviewed-on: https://go-review.googlesource.com/104475
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
VSIB is already supported by Go asm (it can encode AVX GATHERs),
Intel XED can handle it as well.
Change-Id: I0a0d2dbd35f3cb8d0e02adc0623470911d9795fe
Reviewed-on: https://go-review.googlesource.com/104495
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
xeddata package implements Intel XED datafiles reader.
The implementation is very x86spec-specific as it implements
only a few data types, enumerations and file format parsers
that are required to generate "x86.csv" from XED tables.
See "doc.go" for detailed package overview.
The XED version (commit hash) specified in doc.go is not strict dependency,
but rather a hint that helps to select revision that
is guaranteed to work.
Change-Id: I848eeb159d9353d533f13bbf0e83a47a5f7772ce
Reviewed-on: https://go-review.googlesource.com/88015
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Updates golang/go#24185
Change-Id: I6bd8b9a38e9a22793a2791a2d46e7ea4087bff7a
Reviewed-on: https://go-review.googlesource.com/100676
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The addends in FMADD/FMSUB/FNMADD/FNMSUB should come second, in
accordance with MADD/MSUB. This CL fixes that issue.
fixesgolang/go#23775
Change-Id: I139397f38ba02901cf840ed34bb0d1180e9bba36
Reviewed-on: https://go-review.googlesource.com/93336
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Objdump (2.29) generates new format of comments starting with "//"
instead of original ";", e.g: "csinv x23, x2, x19, cc // cc = lo, ul, last".
Improve test generation framework to recognize and strip such comments.
Fixesgolang/go#23237
Change-Id: I0ccf70791f43d696b0e20ded7f284eb277bea31c
Reviewed-on: https://go-review.googlesource.com/85476
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
x86avxgen tool generates code that is required
to implement full AVX1 and AVX2 support in Go asm.
The main effects of this utility are:
- emits AVX instructions optabs
- updates instructions enum (adds new entries)
- uncomments test cases for added instructions from amd64enc.s
It can be extended to support AVX512,
but that requires, among other things,
EVEX prefix support in asm6.go.
Note: some changes in obj/x86 are required
in order to use this tool.
Current CL sends the tool itself on the review,
prerequisites will come later (if x86avxgen passes the review).
Change-Id: I4691b16327bbafedfd5a297115b673c551f28484
Reviewed-on: https://go-review.googlesource.com/66972
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
x86csv package provides simple CSV reader
that serializes rows into spec row objects.
This way, it is more convenient to build tools
that rely on x86.csv and it is easier to
control x86.csv version changes over time
(at least there will be no dependency on columns order, or their count).
Row type fields documentation is taken from x86spec/spec.go
package comment.
It is implied that Row represents layout of the most
recent x86.csv version.
x86/x86avxgen depends on this package.
Change-Id: Icde4f6c1e80aeb69d34bd4e38fbfd3bbd7165c62
Reviewed-on: https://go-review.googlesource.com/66971
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Add x86spec package that is capable to generate x86.csv
version 0.2.
New x86.csv does not replace v0.1 to avoid unexpected
code breaks (x86/x86map depends on v0.1).
This can be solved in another CL.
The rationale behind this is x86avxgen tool that
requires v0.2 spec.
See https://go-review.googlesource.com/#/c/arch/+/18840/
Change-Id: Iea93e1174a5a79b9b50bf99f626e3c48b19ad5c1
Reviewed-on: https://go-review.googlesource.com/66970
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
a -> an
Change-Id: I6917aff4eb36ad1cd46b159391f39c1a70b54452
Reviewed-on: https://go-review.googlesource.com/63990
Reviewed-by: Ian Lance Taylor <iant@golang.org>
PC relative addresses are hard to understand and this is already done
in GoSyntax.
Change-Id: I7edcffb54059291c638b633a2e62f6555f7df79c
Reviewed-on: https://go-review.googlesource.com/45097
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TestObjdumpARM64* is fuzzy test which randomly generates instructions for
decoder and uses host objdump to compare results. Some old objdump wrongly
decodes ldur*/stur*/prfum as ldr*/str*/prfm. Refine allowedMismatchObjdump
function to allow the mismatches to avoid false alarm.
Fixesgolang/go#21486
Change-Id: I8909ca2657bd86ec5287e1ade7b17fe87f4ced22
Reviewed-on: https://go-review.googlesource.com/56810
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Especially log.Fatal(err) where err came back from exec.Command.Run.
It prints no additional information and is very confusing for the test
to die printing 'exit status 1'.
For golang/go#21486.
Change-Id: I8675667838319a4d5697e596244bea514509894d
Reviewed-on: https://go-review.googlesource.com/56971
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
More decoding tests are added. Most of them are
in gnu syntax and a few are in plan9 syntax.
Change-Id: Ifb96f5149f7f7c947f35948889a33f5dee50dbfc
Reviewed-on: https://go-review.googlesource.com/49190
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Though MRS is correctly disassembled, MSR can not be recognized.
This patch fixes this issue and adds corresponding tests.
Fixesgolang/go#20762
Change-Id: I59292f2a267d18cac7c012efaf0727bd9b8d5bb1
Reviewed-on: https://go-review.googlesource.com/48310
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Currently UDIV and SDIV can not be correctly decoded. This patch
adds support for them and corresponding tests.
fixes#20096
Change-Id: I8818c29bc03aa9f0aaf157bfa03cd39114e0925e
Reviewed-on: https://go-review.googlesource.com/41891
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
- Add support for all basic instructions (except for the following
6 system instructions: AT, DC, HVC, SMC, SYS and TLBI)
- Add support for all FP basic instructions
- Add support for all SIMD instructions (plan9 syntax refer to CL 41654)
- Add cases for testing all instructions and comparing disassembly result
with external disassembler (by gnu syntax)
Disassembler framework is mainly contributed by Zheng Xu <zheng.xu@arm.com>
Testing and bug fixing are mainly contributed by Fannie Zhang <fannie.zhang@arm.com>
Other parts (such as decoder table and argument) are mainly contributed by Wei Xiao <wei.xiao@arm.com>
Fixes#19157
Change-Id: I76b6b075f487857124c8ca774a12d764d4ee85c7
Reviewed-on: https://go-review.googlesource.com/43651
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
SMLABT/SMLATB/SMLATT/SMLAD/SMLSD are MLA(mul&add) like instructions,
which need the third register to be the addend. But currently the addend
is placed in the first position in the decoded register list.
This patch fixes it and adds corresponding tests.
Change-Id: I57f3e96876c54497badf1a12ae7dae18fe6fcc11
Reviewed-on: https://go-review.googlesource.com/47890
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
There are two issues in decoding to arm plan9 syntax.
1. Though "0xe7912e29" is correctly decoded to "MOVW (R1)(R0>>28), R2",
"0xe7112e20" is also decoded to the same text, which is expected to
"MOVW.U (R1)(R0>>28), R2".
2. Both 0xe5d21000 and 0xe1d210d0 are decoded to "MOVB (R2), R1".
The first one is LDRB and should be decoded to "MOVBU (R2), R1". And
the second one is LDRSB and should be decoded to "MOVBS (R2), R1".
This patch fixes them and adds more decoding tests.
fixgolang/go#20766
Change-Id: If3479c200fb250af1e1efb546576acb399eba7c1
Reviewed-on: https://go-review.googlesource.com/46493
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Though "0xe0243192" can be correctly disassembled to
"MLA R1, R2, R3, R4", "0xe0243192" is disassembled to
"MLA.S R3, R1, R2, R4", which should be "MLA.S R1, R2, R3, R4".
This patch fix it.
fixgolang/go#20752
Change-Id: I2b4627b822715954923429688bccb21c081b7d0e
Reviewed-on: https://go-review.googlesource.com/46456
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>