Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for AArch64 #338

Merged
merged 5 commits into from
Jul 22, 2022
Merged

Fixes for AArch64 #338

merged 5 commits into from
Jul 22, 2022

Conversation

kddnewton
Copy link

  • All of the data processing -- immediate instructions accept both an immediate and an optional flag to shift left by 12 bits. Previously we always set that to 0, but this PR adds support for attempting to encode a u64 as this value. That's encapsulated in the ShiftedImmediate struct implementing a TryFrom<u64>. Now all of those instructions accept an instance of this struct and use that to encode instead of two different arguments (value + shift). This allows us to encode more immediate values. Believe it or not, this actually came up because of a bootstrap test failing, and it passed after this encoding was in place. Because we can now check if this will encode properly ahead of time, we now split on all places that accept a ShiftedImmediate. If it can be encoded, we use the value. Otherwise we split it into a load first. This applies to ADD, ADDS, CMP, SUB, and SUBS.
  • When we invoke an STUR instruction, the displacement for the memory address must fit into 9 bits. This works in most cases, but one of the bootstrap tests was failing with a large displacement. Now we split when the value is too large to first load the address into a register with Op::Lea (lowers to ADD) and then replace it with a new memory operand with a 0 displacement. To use this we split on all Op::Store instructions and the Op::Mov instructions that would lower to a store.
  • Previously we were incorrectly splitting the Op::Sub instruction as if subtraction were commutative 😔. We now properly maintain ordering of the operands and lower them appropriately.
  • We now do smarter splitting of the Op::Add instruction by moving around the operands as necessary. For example, if you were to add an immediate with a register (as opposed to a register with an immediate) we swap the order of the operands instead of loading the first into a register.

@maximecb maximecb merged commit c49da8d into yjit_backend_ir Jul 22, 2022
@maximecb maximecb deleted the fixers branch July 22, 2022 18:01
maximecb pushed a commit that referenced this pull request Jul 25, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
noahgibbs pushed a commit that referenced this pull request Aug 23, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
noahgibbs pushed a commit that referenced this pull request Aug 24, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
noahgibbs pushed a commit that referenced this pull request Aug 24, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow

PR: #338
noahgibbs pushed a commit that referenced this pull request Aug 25, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow

PR: #338
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow

PR: #338
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
k0kubun pushed a commit that referenced this pull request Aug 26, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
noahgibbs pushed a commit that referenced this pull request Aug 26, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
k0kubun pushed a commit that referenced this pull request Aug 26, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
k0kubun pushed a commit that referenced this pull request Aug 29, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
k0kubun pushed a commit that referenced this pull request Aug 29, 2022
* Better splitting for Op::Add, Op::Sub, and Op::Cmp

* Split stores if the displacement is too large

* Use a shifted immediate argument

* Split all places where shifted immediates are used

* Add more tests to the cirrus workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants