[PATCH] gold/aarch64: Fix adrp distance check
Cary Coutant
ccoutant@gmail.com
Fri Jul 29 22:14:25 GMT 2022
> > The cast is unnecessary here for assignment to an int64_t. Once the
> > result is in a signed int, I don't think you need to go to all that
> > extra trouble to shift it.
>
> Note that right shifting a negative value is fully defined only in C++20
> and later.
Yes, you're right, thanks. I was tempted to say that every compiler we
care about does that as an arithmetic shift, but of course that's
careless. Then I saw that the arm-gcc compiler translates that ?:
idiom into a single "asr" instruction. Kinda suggests we should have
an ASR macro somewhere common.
Still, the static cast is unnecessary, and I see no need to introduce
the temporary "offset" instead of "adrp_imm".
-cary
More information about the Binutils
mailing list