[LLVMbugs] [Bug 16387] New: clang doesn't produce ARM EABI-compliant modulo runtime function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 20 05:53:35 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16387

            Bug ID: 16387
           Summary: clang doesn't produce ARM EABI-compliant modulo
                    runtime function
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: kristof.beyls at arm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

For the following program:
$ cat divmod.c
int f(int a, int b) {
    int d = a/b;
    int m = a%b;
    int c = b%a;
    return d+m+c;
}

compiled with the following command line:
clang -O3 -target armv7a-none-none-eabi -mcpu=cortex-a8 divmod.c -S

clang produces code that is not EABI compliant:
f:
        push    {r4, r5, r6, r11, lr}
        add     r11, sp, #12
        sub     sp, sp, #4
        mov     r5, r1
        mov     r4, r0
        bl      __aeabi_idiv
        mov     r6, r0
        mov     r0, r4
        mov     r1, r5
        bl      __modsi3
        add     r6, r0, r6
        mov     r0, r5
        mov     r1, r4
        bl      __modsi3
        add     r0, r6, r0
        sub     sp, r11, #12
        pop     {r4, r5, r6, r11, pc}


The problem is the calls to __modsi3. These are not compliant with the EABI.
Instead, clang should produce calls to __aeabi_idivmod or __aeabi_uidivmod for
modulo operations when producing EABI-compliant code.

-- 
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/20130620/b43b8d9e/attachment.html>


More information about the llvm-bugs mailing list