[llvm-commits] FIX for PR13537: incorrect ADR encoding

Owen Anderson resistor at mac.com
Fri Aug 17 09:34:43 PDT 2012


Stepan,

This patch is not correct.  The value that is encoded into the instruction already has the two low bits shifted out.  Take a look at the fixup_thumb_adr_pcrel_10 case in adjustFixupValue() in ARMAsmBackend.cpp to see this in action.  If your patch is applied, the right shift will effectively be applied twice, resulting in the four low bits being discarded.

Note that that does lead to the somewhat confusing behavior of the "adr reg, #imm" requiring the imm operand to be pre-encoded.  However, this is already as extension to the official ARM syntax, so we're not beholden to have it work any particular way.

--Owen

On Aug 17, 2012, at 2:26 AM, Stepan Dyatkovskiy <stpworld at narod.ru> wrote:

> Hi all. Please find the fix for PR13537 in attachment:
> llvm-mc incorrectly assembles ADR instructions for ARM
> T1 encoding implemented incorrectly for ADR. We should store high 8 bits of immediate, that is 10 bit width value. Currently imm interpreted as 8 bit value and low 8 bits are encoded instead.
> 
> -Stepan.
> <pr13537.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list