[all-commits] [llvm/llvm-project] d22417: [PowerPC][LLD] Extend R2 save stub to support offs...
stefanp-ibm via All-commits
all-commits at lists.llvm.org
Fri Sep 25 04:39:32 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: d224175230d1ab232cfdf71f9da63a732f405c91
https://github.com/llvm/llvm-project/commit/d224175230d1ab232cfdf71f9da63a732f405c91
Author: Stefan Pintilie <stefanp at ca.ibm.com>
Date: 2020-09-25 (Fri, 25 Sep 2020)
Changed paths:
M lld/ELF/Thunks.cpp
M lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
Log Message:
-----------
[PowerPC][LLD] Extend R2 save stub to support offsets of more than 26 bits
The R2 save stub will now support offsets up to 64 bits.
There are three cases that will be used.
1) The offset fits in 26 bits.
```
b <26 bit offset>
```
2) The offset does not fit in 26 bits but fits in 34 bits.
```
paddi r12, 0, <34 bit offset>, 1
mtctr r12
bctr
```
3) The offset does not fit in 34 bits. Since this is an R2 save stub we can use
the TOC in R2. We are not loading the offset but the actual address we want to
branch to.
```
addis r12, r2, <address in TOC lo>
ld r12 <address in TOC hi>(r12)
mtctr r12
bctr
```
In case 1) the stub is only 8 bytes while in cases 2) and 3) the stub will be
20 bytes.
Reviewed By: MaskRay, sfertile, NeHuang
Differential Revision: https://reviews.llvm.org/D87916
More information about the All-commits
mailing list