LDR pseudo-op generates MOVS

Bug #1682620 reported by Dan Lewis on 2017-04-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU ARM Embedded Toolchain
Undecided
Unassigned

Bug Description

According to the ARM documentation at

        http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489i/Babbfdih.html

under the heading "LDR in Thumb code", it says:

       "The LDR pseudo-instruction never generates a 16-bit flag-setting MOV instruction."

However, when I use the following:

       LDR R0,=1

it gets replaced by:

       MOVS R0,1 // This is a 16-bit instruction that updates flags N and Z.

To comply with the ARM documentation, the assembler should replace the pseudo-instruction with one of the following that do not modify the flags:

       MOV.W R0,1 // Both of these are 32-bit instructions, but
       MOVW R0,1 // neither of them affect the flags.

FYI, I use the EmBitz v1.11 IDE which uses gcc 5_4- embedded branch,
and the only assembler directives I use are:

        .syntax unified
 .cpu cortex-m4
        .text
        .thumb_func
        .align 2

Dan Lewis (danielwlewis) on 2017-04-13
description: updated

Hi Dan,

While I agree this specific case is a bug, please note that the documentation you reference is for ARM compiler and thus the GNU ARM embedded toolchain is not bound to respect it in the general case.

Best regards.

Changed in gcc-arm-embedded:
status: New → Confirmed
Changed in gcc-arm-embedded:
status: Confirmed → In Progress
Changed in gcc-arm-embedded:
status: In Progress → Fix Committed

Thanks, Thomas!

Dan

On Tue, Jun 20, 2017 at 9:23 AM, Thomas Preud'homme <
<email address hidden>> wrote:

> ** Changed in: gcc-arm-embedded
> Status: In Progress => Fix Committed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1682620
>
> Title:
> LDR pseudo-op generates MOVS
>
> Status in GNU ARM Embedded Toolchain:
> Fix Committed
>
> Bug description:
> According to the ARM documentation at
>
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.
> doc.dui0489i/Babbfdih.html
>
> under the heading "LDR in Thumb code", it says:
>
> "The LDR pseudo-instruction never generates a 16-bit flag-
> setting MOV instruction."
>
> However, when I use the following:
>
> LDR R0,=1
>
> it gets replaced by:
>
> MOVS R0,1 // This is a 16-bit instruction that updates flags
> N and Z.
>
> To comply with the ARM documentation, the assembler should replace the
> pseudo-instruction with one of the following that do not modify the
> flags:
>
> MOV.W R0,1 // Both of these are 32-bit instructions, but
> MOVW R0,1 // neither of them affect the flags.
>
> FYI, I use the EmBitz v1.11 IDE which uses gcc 5_4- embedded branch,
> and the only assembler directives I use are:
>
> .syntax unified
> .cpu cortex-m4
> .text
> .thumb_func
> .align 2
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-arm-embedded/+bug/1682620/+subscriptions
>

Changed in gcc-arm-embedded:
milestone: none → 6-2017-q2-update
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers