[PATCH] D98053: [mac/lld] Fix scale computation for vector ops in PAGEOFF12 relocations

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 09:09:58 PST 2021


thakis added inline comments.


================
Comment at: lld/MachO/Arch/ARM64.cpp:130
 
-inline uint64_t encodePageOff12(uint64_t base, uint64_t va) {
-  int scale = ((base & 0x3b000000) == 0x39000000) ? base >> 30 : 0;
+inline uint64_t encodePageOff12(uint32_t base, uint64_t va) {
+  int scale = 0;
----------------
(the type change in this line is inconsequential. All callers pass a uint32_t, it's conceptually a uint32_t, and on the return line it gets widened to an uin64_t. This part is a no-op, but it seemed semantically more correct -- without it, you'd technically have to do `(base >> 30) & 3` if you didn't know that all callers passed in a widened uint32_t.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98053/new/

https://reviews.llvm.org/D98053



More information about the llvm-commits mailing list