[LLVMbugs] [Bug 13039] New: Thumb2 branch instruction is broken

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 6 07:04:28 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13039

             Bug #: 13039
           Summary: Thumb2 branch instruction is broken
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: richard.barton at arm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The Thumb2 conditional Branch (T4 encoding) is incorrectly implemented in MC.

Reproduce with: echo  0x00 0xf0 0x00 0xb0 |
/work/ricbar01/llvm-oss/build/bin/llvm-mc -triple thumbv7 -show-encoding
-disassemble -show-inst

        .section        __TEXT,__text,regular,pure_instructions
        b.w     #262144                 @ encoding: [0x00,0xf0,0x00,0x98]
                                        @ <MCInst #2218 t2B
                                        @  <MCOperand Imm:262144>
                                        @  <MCOperand Imm:14>
                                        @  <MCOperand Reg:0>>

The immediate is being incorrectly handled. It should be encoded as:

I1 = NOT(J1 EOR S);  I2 = NOT(J2 EOR S);  
imm32 = SignExtend(S:I1:I2:imm10:imm11:'0', 32);

The current encoding appears to be a copy-paste error from the conditional
branch (T3) encoding. 

>From looking around the code, there appears to have been some recent
refactoring of the related BLX and BL instructions. The T3 and T4 B encodings
could also receive this treatment.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list