bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/12793] New: arm: push/pop equivalents using stm/ldm mnemonics a


From: dave.martin at linaro dot org
Subject: [Bug gas/12793] New: arm: push/pop equivalents using stm/ldm mnemonics assembled inconsistently
Date: Fri, 20 May 2011 17:38:41 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12793

           Summary: arm: push/pop equivalents using stm/ldm mnemonics
                    assembled inconsistently
           Product: binutils
           Version: 2.22 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: address@hidden
        ReportedBy: address@hidden


Observed on trunk, 2011-05-17
Configured with --{build,host}=x86_64-pc-linux-gnu --target=arm-elf-eabi

$ cat <<EOF >stm-ldm.s
.syntax unified
.thumb

.type f, %function
.globl f
f:
        push    {r0}
        stmfd   sp!, {r0}
@       stmfd.n sp!, {r0}
        push    {r0-r1}
        stmfd   sp!, {r0-r1}
@       stmfd.n sp!, {r0-r1}
        push    {r0,lr}
        stmfd   sp!, {r0,lr}

        ldmfd   sp!, {r0,lr}
@       ldmfd.n sp!, {r0,lr}
        pop     {r0,pc}
        ldmfd   sp!, {r0-r1}
        ldmfd.n sp!, {r0-r1}
        ldmfd   sp!, {r0}
        ldmfd.n sp!, {r0}
        pop     {r0}
EOF

# The commented-out lines above generate "cannot honor width suffix" errors if
assembled.
# All of the above ldmfd/stmfd instructions are equivalent to the adjacent
push/pop mnemonics, and could be assembled to 16-bit encodings.

$ as -march=armv7-a -o stm-ldm.o stm-ldm.s
$ objdump -d stm-ldm.o

stm-ldm.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <f>:
   0:   b401            push    {r0}
   2:   f84d 0d04       str.w   r0, [sp, #-4]!
   6:   b403            push    {r0, r1}
   8:   e92d 0003       stmdb   sp!, {r0, r1}
   c:   b501            push    {r0, lr}
   e:   e92d 4001       stmdb   sp!, {r0, lr}
  12:   e8bd 4001       ldmia.w sp!, {r0, lr}
  16:   bd01            pop     {r0, pc}
  18:   bc03            pop     {r0, r1}
  1a:   bc03            pop     {r0, r1}
  1c:   bc01            pop     {r0}
  1e:   bc01            pop     {r0}
  20:   bc01            pop     {r0}


It looks rather like the older ARM logic may be being used to choose encodings
when using the ldm/stm mnemonics in Thumb, in some cases.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]