http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58166

            Bug ID: 58166
           Summary: ARMv5: poor register allocation in function containing
                    smull instruction
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jay.foad at gmail dot com

Created attachment 30660
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30660&action=edit
C source for testcase

On the attached test case I get:

$ gcc -marm -S -O2 mul.c -o - -fomit-frame-pointer -march=armv5
...
mul:
    @ args = 0, pretend = 0, frame = 0
    @ frame_needed = 0, uses_anonymous_args = 0
    @ link register save eliminated.
    str    r4, [sp, #-4]!
    smull    r3, r4, r0, r1
    mov    r1, r4
    mov    r0, r3
    ldr    r4, [sp], #4
    bx    lr

If the register allocator picked r2 and r3 for the result of the multiply, then
there would be no need to push and pop r4.

I'm using gcc built from svn r201719 configured with --target=arm-eabi.

Reply via email to