[PATCH] Fix encoding of unconditional Thumb2 branch (T4)

Kevin Enderby enderby at apple.com
Thu Mar 28 12:50:23 PDT 2013


Hi Gordon.

I was the one that patch to disassemble this branch correctly (r166982 for rdar://12585795).  Your changes to lib/Target/ARM/ARMInstrThumb2.td looks right to me.  But I'm not a code gen guy so I think Jim will need to look at the change to lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp (the right shift) but that sounds correct to me.

Kev

On Mar 27, 2013, at 5:24 PM, Gordon Keiser <gkeiser at arxan.com> wrote:

> Hi,
>  
> A little while back someone checked in a patch to disassemble this branch correctly, but the TableGen definition was still using incorrect information as if a 20 bit immediate was involved, and the encode function neglected to right shift the immediate first (the output becomes left shifted by #1).   The former item was causing the S, J1, and J2 bits of the instruction to be set incorrectly (based on bits 19-17 of the immediate rather than the calculated version from the encode function), and the latter was causing all of the branches to go twice as far as specified.  This was verified both by the output from LLVM’s disassembler which is correct in this case, IDA 6.4, and lots of bit checking vs. ARM’s docs.
>  
> The patch also updates test cases, which were listing encoding results which didn’t match what they should have been.
>  
> I don’t have commit access yet, so someone who does can feel free to commit if it looks good. 
>  
> Cheers,
> Gordon Keiser
> Software Development Engineer
> Arxan Technologies
> w:+1.765.889.4756   m:+1.765.237.4833 
> gkeiser at arxan.com        www.arxan.com 
> Protecting the App Economy™ 
>  
> <Thumb2b.wT4Encoding.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130328/26ba9429/attachment.html>


More information about the llvm-commits mailing list