Commit Graph

52 Commits

Author SHA1 Message Date
Michael McLoughlin
6c0ed1c4e8 tests/thirdparty: add filippo.io/edwards25519 (#227)
Updates #226
2021-11-07 18:29:47 -08:00
Michael McLoughlin
1de006d741 tests/thirdparty: use shallow clone (#224)
When trying to add a test case from the standard library, cloning golang/go
was taking forever. This PR switches to a shallow clone.
2021-11-07 16:30:50 -08:00
Michael McLoughlin
f355d27b13 tests/thirdparty: package metadata (#223)
Fetches third-party package metadata from Github.
2021-11-07 16:13:33 -08:00
Michael McLoughlin
afe2d539b8 tests/thirdparty: golang.org/x/crypto/curve25519 (#222) 2021-11-07 01:39:03 -07:00
Michael McLoughlin
14c87c7da2 tests/thirdparty: add oasisprotocol/curve25519-voi (#220)
Fixes #202
2021-11-06 22:42:31 -07:00
Michael McLoughlin
2ca6e5e9f6 tests/thirdparty: add ericlagergren/lwcrypto (#219)
Fixes #188
2021-11-06 22:30:43 -07:00
Michael McLoughlin
6acd6a048d tests: test functions with random signatures (#216)
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
2021-10-30 18:22:24 -07:00
Michael McLoughlin
4f7179b08e gotypes,tests: test case for issue #195 (#214)
Adds test cases for the bug in #195, similar to #212.

Updates #195
Updates #191
2021-10-30 13:47:55 -07:00
Michael McLoughlin
7de02518a2 gotypes: fix argument size for signatures without return types (#212)
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
2021-10-30 13:32:25 -07:00
Michael McLoughlin
9c70781236 all: go 1.17 (#197)
Bump CI Go versions to 1.16 and 1.17.
Update build tags with `go:build` equivalents.
Upgrade asmfmt tool for new `go:build` support.

Updates #183
2021-10-29 01:18:34 -07:00
Michael McLoughlin
9c815a0581 tests/thirdparty: fix phoreproject-bls (#204)
This started failing under Go 1.17.2 due to a missing go mod tidy in the
root of the respository.
2021-10-27 23:03:23 -07:00
Michael McLoughlin
5e686673b2 tests/thirdparty: add segmentio/asm (#201)
Adds third-party test for https://github.com/segmentio/asm.

Fixes #200
2021-09-15 23:49:08 -07:00
Michael McLoughlin
8ff8e3b751 tests/thirdparty: fix and run as github workflow (#198)
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.
2021-09-15 23:25:51 -07:00
Michael McLoughlin
6bad393fdc ci: bump to go 1.16 (#166)
Required updates to the thirdparty test suite due to modules changes in go toolchain.
2021-04-19 14:34:35 -07:00
Klaus Post
f798093d69 tests/thirdparty: update/add packages, fix modules (#186)
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.
2021-04-19 12:38:24 -07:00
Michael McLoughlin
c32f24fb1e pass: de-prioritize base pointer in register allocation (#184)
Updates #156
2021-04-18 19:22:09 -07:00
Michael McLoughlin
f295bde84c pass: ensure frame pointer register is saved (#174)
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
2021-04-18 18:37:56 -07:00
Michael McLoughlin
4439b6b2c0 build: -pkg flag to specify package name (#150)
Allows override in the case where package name is incorrectly deduced from directory name.

Fixes #68
Fixes #147
2020-05-23 12:07:32 -07:00
Michael McLoughlin
6df701fe67 tests/thirdparty: lukechampine/us/merkle/blake2b (#140)
Fixes #139
2020-03-02 20:22:53 -08:00
Michael McLoughlin
1859174b62 tests/thirdparty: blake3 (#137)
Adds blake3 to suite of third party tests.

Closes #136
2020-02-26 18:15:39 -08:00
Michael McLoughlin
d51141dc8f tests/thirdparty: add klauspost/compress/s2 (#131)
Adds @klauspost's S2 implementation to the third party test suite.

The full klauspost/compress tests are slow but we only care about the S2 sub-package. Therefore this PR also adds the option to only run a subset of the package tests, controlled by a "test" parameter in the JSON configuration.

Closes #130
2020-01-28 23:27:12 -05:00
Michael McLoughlin
e089a6c93c tests/fixedbugs: regression test for issue 100 (#129)
Adds a regression test based on klauspost/compress#186. This necessitated some related changes:

* Mark "RET" as a terminal instruction
* printer refactor to maintain compatibility with asmfmt
* Tweaks to other regression tests to ensure they are run correctly in CI

Updates #100 #65 #8
2020-01-27 21:05:33 -08:00
Michael McLoughlin
f40d602170 reg,pass: refactor allocation of aliased registers (#121)
Issue #100 demonstrated that register allocation for aliased registers is
fundamentally broken. The root of the issue is that currently accesses to the
same virtual register with different masks are treated as different registers.
This PR takes a different approach:

* Liveness analysis is masked: we now properly consider which parts of a register are live
* Register allocation produces a mapping from virtual to physical ID, and aliasing is applied later

In addition, a new pass ZeroExtend32BitOutputs accounts for the fact that 32-bit writes in 64-bit mode should actually be treated as 64-bit writes (the result is zero-extended).

Closes #100
2020-01-22 22:50:40 -08:00
Michael McLoughlin
ff7a160610 pass: allow consecutive labels (#123)
Fixes #122
2020-01-19 22:06:52 -08:00
Michael McLoughlin
cde7e9483b pass,printer: display required ISA features (#120)
Fixes #119
2020-01-19 16:45:09 -08:00
Michael McLoughlin
205fc6a3d7 tests: integration tests for third-party packages (#112)
Closes #103
2020-01-06 22:56:38 -05:00
Michael McLoughlin
cfc6ecac41 tests/alloc/gp8: allocator test using all 8-bit registers (#102)
Updates #43
2019-12-20 15:31:35 -08:00
Koichi Shiraishi
15d6a9a17e attr,build: add TOPFRAME attribute (#98)
Go added the TOPFRAME attribute in https://golang.org/cl/169726/. This diff adds the new attribute to avo, and also updates handling of the REFLECTMETHOD attribute.
2019-09-26 21:11:50 -07:00
Michael McLoughlin
d43efabdbe inst,ir: cancelling inputs (#92)
Adds support for a `CancellingInputs` instruction flag, to indicate cases like `XORQ R10, R10` where the instruction actually does not depend on the value of `R10` at all.

Closes #89
2019-07-28 17:58:49 -07:00
Michael McLoughlin
2e7d06bc7a pass: remove redundant jumps and dangling labels (#81)
In jump-table-like constructs, the natural way of writing the code can sometimes produce redundant jumps or labels. Therefore some basic cleanup steps have been proposed. This diff adds two transforms:

1. Remove unconditional jumps to a label immediately following.
2. Remove labels with no references at all.

Fixes #75
2019-04-15 19:42:11 -07:00
Michael McLoughlin
57c23b967e pass: add PruneSelfMoves cleanup pass (#80)
In some cases natural use of abstraction in avo programs can lead to redundant move instructions, specifically self-moves such as MOVQ AX, AX. This does not produce incorrect code but it is incorrect and inelegant.

This diff introduces a PruneSelfMoves pass that removes such unnecessary instructions.

Closes #76
2019-04-14 14:26:28 -07:00
Michael McLoughlin
1735441939 all: apply gofumpt (#79)
Apply @mvdan's opinionated gofumpt formatter across the codebase.
2019-04-13 22:53:13 -05:00
Michael McLoughlin
3cfe40e76c build: load package in LoadAllSyntax mode (#63)
Fixes #62
2019-02-20 21:17:28 +00:00
Michael McLoughlin
9c913ee847 lint: linter for package docstrings (#59)
Fixes #38
2019-01-22 21:14:59 -08:00
Michael McLoughlin
4bc8de39bb tests/fixedbugs/issue50: fix asmdecl complaint
Updates #50
2019-01-20 23:19:06 -08:00
Michael McLoughlin
2d7a9ddb6c internal/load: rerun code generation
Updates #50
2019-01-20 22:43:14 -08:00
Michael McLoughlin
220969f8c8 internal/load: support additional MOVQ forms
The Go assembler merges MOVD/MOVQ instruction forms. The logic in the
avo instruction loader was discarding the MOVD forms. This diff should
merge them correctly.

Updates #50
2019-01-20 22:34:52 -08:00
Michael McLoughlin
475a241446 operand: include '+0' in named symbol references
Intended to address an asmdecl error.

  [amd64] Butterfly: use of unnamed argument 0(FP); offset 0 is x0+0(FP)

Updates #24
2019-01-13 12:00:57 -08:00
Michael McLoughlin
16c602d345 tests/attrtest: move decl to non-test file
Solves the asmdecl error:

  [amd64] AttrTest: function AttrTest missing Go declaration

Updates #24
2019-01-13 11:53:04 -08:00
Michael McLoughlin
284ee13ada build: support comments in functions (#41) 2019-01-11 10:33:41 -08:00
Michael McLoughlin
27cea3be8b tests/textflag: fix formatting 2019-01-10 21:56:33 -08:00
Michael McLoughlin
7a22924b14 lint: ensure conformity with asmfmt
Run asmfmt suring linting and confirm git repository isn't dirty.
This introduces a developer tools dependency on asmfmt, but not a
runtime dependency.

Updates #8
2019-01-10 21:31:04 -08:00
Michael McLoughlin
f77a2e3b9e printer: use tabwriter to align instructions (#8) 2019-01-10 21:21:41 -08:00
Michael McLoughlin
304c7425d2 build: add attributes argument to TEXT
Brings the TEXT() function signature closer to how the directive works
in assembly.

Also update almost all examples to use NOSPLIT.

Closes #11
2019-01-06 20:04:51 -08:00
Michael McLoughlin
49b1691ac0 doc: description of examples/ and tests/ 2019-01-06 14:25:05 -08:00
Michael McLoughlin
602bb5197c build: unify Label function signatures
The Context.Label method and LABEL global function did not agree. Also
breaks the convention I'd like to set that capitalized functions must
agree with existing Go assembly syntax.

To help avoid a conflict with `avo.Label`, attributes were moved to
their own package.

Fixes #35
2019-01-05 18:18:49 -08:00
Michael McLoughlin
5c67547d67 doc: add package-level doc comments (#9) 2019-01-05 17:23:56 -08:00
Michael McLoughlin
672b77a441 reg,build: remove "v" from virtual register ctors
Fixes #30
2019-01-04 18:23:44 -08:00
Michael McLoughlin
f2315d539c tests: autogenerated test to confirm attribute strings
Test helps verify our attribute types match the macros in textflag.h.
Discovered https://golang.org/issue/29487 in the process.

Updates #2
2018-12-31 17:30:06 -08:00
Michael McLoughlin
c62e40f8d2 pass: add textflags.h if required
Closes #12
2018-12-31 00:23:27 -08:00