Extends avo to support most AVX-512 instruction sets.
The instruction type is extended to support suffixes. The K family of opmask
registers is added to the register package, and the operand package is updated
to support the new operand types. Move instruction deduction in `Load` and
`Store` is extended to support KMOV* and VMOV* forms.
Internal code generation packages were overhauled. Instruction database loading
required various messy changes to account for the additional complexities of the
AVX-512 instruction sets. The internal/api package was added to introduce a
separation between instruction forms in the database, and the functions avo
provides to create them. This was required since with instruction suffixes there
is no longer a one-to-one mapping between instruction constructors and opcodes.
AVX-512 bloated generated source code size substantially, initially increasing
compilation and CI test times to an unacceptable level. Two changes were made to
address this:
1. Instruction constructors in the `x86` package moved to an optab-based
approach. This compiles substantially faster than the verbose code
generation we had before.
2. The most verbose code-generated tests are moved under build tags and
limited to a stress test mode. Stress test builds are run on
schedule but not in regular CI.
An example of AVX-512 accelerated 16-lane MD5 is provided to demonstrate and
test the new functionality.
Updates #20#163#229
Co-authored-by: Vaughn Iverson <vsivsi@yahoo.com>
Adds a test for function signature memory layout by generating functions with
random signatures. This confirms that the size and offsets computed by
`gotypes` agree with `asmdecl`.
Updates #191#195
Exposes a few functions on Context that are not available globally. This
oversight suggests that #33 or #133 would be reasonable. `Signature()` is
currently excluded because it causes a conflict for users who have
dot-imported both `build` and `gotypes`. For example:
18af27c3ce/build/base64/decode_asm.go (L13-L14)a88a5ae268/asm/asm.go (L6-L7)
This fixes a bug in argument size calculation in the case where the function
has no return values. Previously it was padding the argument struct to max
alignment, but this only happens if there are return values following.
Updates #191
```
$ ./tmp/testgo161718.sh ./buildtags/ ./printer/
+ go1.16.8 test ./buildtags/ ./printer/
ok github.com/mmcloughlin/avo/buildtags 0.001s
ok github.com/mmcloughlin/avo/printer 0.002s
+ go1.17.2 test ./buildtags/ ./printer/
ok github.com/mmcloughlin/avo/buildtags 0.001s
ok github.com/mmcloughlin/avo/printer 0.002s
+ gotip test ./buildtags/ ./printer/
ok github.com/mmcloughlin/avo/buildtags 0.001s
ok github.com/mmcloughlin/avo/printer 0.002s
```
Updates #183
Uses `buildtag.Format` to format constraints in the assembly and stub file
printers. This will ensure `// + build` and `//go:build` syntax are used
consistent with the current Go version.
Updates #183
Implements formatting of constraints according to the current Go version
supported syntax. This is achieved by delegating to go/format and extracting
out the resulting comments.
Also provides functions to query for constraint syntax support, which are
mainly intended for writing version-dependent tests.
Updates #183
As part of fixing failing third-party tests, this PR significantly
rearchitects their specification and execution.
Third-party tests are now specified in a much more flexible format allowing
more customization on a per-package level. In addition, third-party tests are
now used to auto-generate a Github Actions workflow to perform the tests in
parallel. This not only gives faster feedback on PRs, but will also allow us
to more quickly narrow down on which packages are failing. An additional
workflow also confirms that local execution of third-party tests is consistent
with the Github Actions version. This workflow only runs when tests/thirdparty
itself is changed.
Update github.com/klauspost/compress version.
Add github.com/klauspost/reedsolomon and github.com/minio/md5-simd.
Add `-mod=mod` to commands due to golang/go#44129.
Currently `avo` uses `BP` as a standard general-purpose register. However, `BP` is used for the frame pointer and should be callee-save. Under some circumstances, the Go assembler will do this automatically, but not always. At the moment `avo` can produce code that clobbers the `BP` register. Since Go 1.16 this code will also fail a new `go vet` check.
This PR provides a (currently sub-optimal) fix for the issue. It introduces an `EnsureBasePointerCalleeSaved` pass which will check if the base pointer is written to by a function, and if so will artificially ensure that the function has a non-zero frame size. This will trigger the Go assembler to automatically save and restore the BP register.
In addition, we update the `asmdecl` tool to `asmvet`, which includes the `framepointer` vet check.
Updates #156
Many of the instruction functions correctly match the size of immediate values, but they only accept unsigned immediates. This PR fixes the operand check functions for intermediate types to also accept the signed variants.
Fixes#181
This makes it easier to debug avogen: when you emit invalid syntax, you can inspect the generated file to determine what went wrong, instead of having only gofmt's error to work with.
An update to gofumpt caused the lint job to start failing:
https://github.com/mmcloughlin/avo/runs/638734114?check_suite_focus=true#step:7:688
The underlying issue is that the "join parameters" rule added to gofumpt
disagrees with output from go/types. It's possible to fix, but I don't
think it's important enough to deal with right now. Instead I'll pin the
gofumpt dependency to a version before that rule was added.
Pinning tool dependencies is a good idea anyway.