[llvm-bugs] [Bug 50664] New: [MC][Thumb2] .w suffix rejected for certain ldr and str operands

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 10 17:09:28 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50664

            Bug ID: 50664
           Summary: [MC][Thumb2] .w suffix rejected for certain ldr and
                    str operands
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: rprichard at google.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at arm.com

LLVM can assemble this Thumb2 code (clang --target=armv7a-linux-gnueabi):

    .syntax unified
    .thumb
    ldr.w r0, [r1, #0xf00]

But not this:

    .syntax unified
    .thumb
    ldr.w r0, [r1, #-2]

test.S:3:15: error: invalid operand for instruction
    ldr.w r0, [r1, #-2]
              ^

It will assemble if I remove the ".w" suffix. The disassembly is then:

00000000 <.text>:
   0:   f851 0c02       ldr.w   r0, [r1, #-2]

... which indicates a wide instruction.

Maybe the fix for bug #49118 was incomplete?

There are some similar instructions that, IIRC, use the same encoding, and have
the same problem. They're wide instructions that can only be assembled if the
".w" suffix is omitted:

    ldr.w r0, [r1, #2]!
    ldr.w r0, [r1], #2
    ldr.w r0, [r1, #-0]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210611/b81d84c2/attachment.html>


More information about the llvm-bugs mailing list