[PATCH] D28689: X86: Produce @ABS8 symbol modifiers for absolute symbols in range [0, 256).

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 11:39:35 PST 2017


pcc marked an inline comment as done.
pcc added inline comments.


================
Comment at: llvm/lib/Target/X86/X86Subtarget.cpp:100
+      // See if we can use the 8-bit immediate form.
+      if (CR->getUnsignedMax().ult(256))
+        return X86II::MO_ABS8;
----------------
RKSimon wrote:
> Should we treating this as an unsigned value? D28688 suggested its sign-extended
Good point. The tricky thing here is that `R_X86_64_8` is an unsigned relocation, but we're using it to relocate a sign extended operand. Probably the safest thing we can do here is to accept only the range [0,128), which I've done. If it proves necessary later, we can try to recognise patterns like `sext i64 (trunc i8 (i8* @foo))` and allow the range [-128,128).


https://reviews.llvm.org/D28689





More information about the llvm-commits mailing list