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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to