Skip to content

Conversation

@kddnewton
Copy link

@kddnewton kddnewton commented Aug 9, 2022

When we lower Op::Load for a memory address, we use LDUR, which only allows you to specify a displacement from a memory address up to 9 bits wide.

If it's longer than that, we now split that instruction into an Op::Lea (to load the memory address into a register) and then create a new memory operand with that register as the base.

When we then in turn lower Op::Lea, we use ADD to add the base register with the displacement. The add instruction in this case accepts a 12-bit immediate optionally shifted left by 12 bits. If the displacement cannot be encoded into the ADD instruction, we then split again into loading the displacement value into a register (the normal MOVZ/MOVKs), then perform the ADD with a register.

Copy link

@maximecb maximecb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done. Thanks for adding tests.

@maximecb maximecb merged commit 9fba674 into yjit_backend_ir Aug 9, 2022
@maximecb maximecb deleted the load-mem-disp branch August 9, 2022 14:27
noahgibbs pushed a commit that referenced this pull request Aug 24, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
noahgibbs pushed a commit that referenced this pull request Aug 24, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit

PR: #382
noahgibbs pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit

PR: #382
noahgibbs pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit

PR: #382
noahgibbs pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit

PR: #382
noahgibbs pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit

PR: #382
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit

PR: #382
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
k0kubun pushed a commit that referenced this pull request Aug 25, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
k0kubun pushed a commit that referenced this pull request Aug 26, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
noahgibbs pushed a commit that referenced this pull request Aug 26, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
k0kubun pushed a commit that referenced this pull request Aug 26, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
k0kubun pushed a commit that referenced this pull request Aug 29, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
k0kubun pushed a commit that referenced this pull request Aug 29, 2022
* LDR instruction for AArch64

* Split loads in arm64_split when memory address displacements do not fit
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.

2 participants