Given the following complete source file:

long long longfunc(long long x, long long y)
{
      return x * y;
}

Compile with ARM EABI gcc 4.2.1:
% arm-eabi-gcc -c -O2 -save-temps mul64.c


This yields mul64.i:

# 1 "mul64.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "mul64.c"
long long longfunc(long long x, long long y)
{
      return x * y;
}

And mul64.s:

       .file   "mul64.c"
       .text
       .align  2
       .global longfunc
       .type   longfunc, %function
longfunc:
       @ args = 0, pretend = 0, frame = 0
       @ frame_needed = 0, uses_anonymous_args = 0
       stmfd   sp!, {r4, r5, lr}
       mul     lr, r2, r1
       mov     r4, r0
       mov     r5, r1
       umull   r0, r1, r2, r4
       mla     ip, r4, r3, lr
       add     r1, ip, r1
       ldmfd   sp!, {r4, r5, pc}
       .size   longfunc, .-longfunc
       .ident  "GCC: (GNU) 4.2.1"

Note the use of register r5.  It's saved, restored, and used to hold a copy of
r1, but it's never used in the computation.


-- 
           Summary: arm-eabi-gcc 4.2.1 64-bit multiply weirdness
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sliao at google dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-eabi


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

Reply via email to