-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Clang generates suboptimal code for armv7 when loading a 64 bit value with a register offset that is added rather than subtracted. For example, when loading from a register, `frameRegs[-offset]` will compile to: ``` sub.w r0, r0, r1, lsl #3 ldrd r0, r1, [r0] bx lr ``` Whereas `frameRegs[offset]` will compile to: ``` ldr.w r2, [r0, r1, lsl #3] add.w r0, r0, r1, lsl #3 ldr r1, [r0, #4] mov r0, r2 bx lr ``` By using inline asm, we can force clang to perform the add as a separate operation before the load, which prevents it from being folded into the load and allows it to use the more efficient 64 bit load instead. Reviewed By: kodafb Differential Revision: D31030620 fbshipit-source-id: 9620205e6382943c4a113d00c42d558bb5fbcdfc
- Loading branch information
1 parent
d520bca
commit bbc8ab0
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters