This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/32044] udivdi3 counterproductive, unwarranted use



------- Comment #6 from malitzke at metronets dot com  2007-05-23 01:06 -------
I did try changing #define 1000000000Ul to its rightful hexadecimal value
#define 0x3b9aca00UL. the results are:

        .file   "rmgg.c"
.globl __udivdi3
        .text
        .p2align 4,,15
.globl rmg
        .type   rmg, @function
rmg:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %edi
        movl    $-1000000000, %edi
        pushl   %ebx
        subl    $48, %esp
        movl    nsec.1646, %eax
        movl    nsec.1646+4, %edx
        movl    %eax, -16(%ebp)
        movl    sec.1647, %eax
        movl    %edx, -12(%ebp)
        testl   %eax, %eax
        jg      .L10
        .p2align 4,,15
.L5:
        movl    -16(%ebp), %edx
        movl    -12(%ebp), %ecx
        addl    $1, %edx
        adcl    $0, %ecx
        cmpl    $0, %ecx
        jbe     .L11
.L7:
        addl    $-1000000000, %edx
        adcl    $-1, %ecx
        incl    %eax
        addl    $-999999999, -16(%ebp)
        movl    %edx, -32(%ebp)
        movl    $1000000000, %edx
        adcl    $-1, -12(%ebp)
        movl    %ecx, -28(%ebp)
        movl    %edx, 8(%esp)
        movl    -12(%ebp), %ecx
        movl    -16(%ebp), %edx
        movl    %eax, -20(%ebp)
        xorl    %eax, %eax
        movl    %eax, 12(%esp)
        movl    %ecx, 4(%esp)
        movl    %edx, (%esp)
        call    __udivdi3
        imull   $-1000000000, %edx, %ecx
        movl    %eax, %ebx
        subl    %eax, %ecx
        mull    %edi
        addl    %ecx, %edx
        movl    %eax, -40(%ebp)
        movl    -20(%ebp), %eax
        movl    %edx, -36(%ebp)
        movl    -40(%ebp), %edx
        addl    -32(%ebp), %edx
        movl    -36(%ebp), %ecx
        adcl    -28(%ebp), %ecx
        addl    %ebx, %eax
        movl    %edx, -16(%ebp)
        movl    %ecx, -12(%ebp)
        .p2align 4,,15
.L12:
        testl   %eax, %eax
        jle     .L5
.L10:
        movl    -16(%ebp), %edx
        movl    -12(%ebp), %ecx
        movl    %eax, sec.1647
        movl    %edx, nsec.1646
        movl    %ecx, nsec.1646+4
        addl    $48, %esp
        popl    %ebx
        popl    %edi
        popl    %ebp
        ret
        .p2align 4,,7
.L11:
        cmpl    $999999999, %edx
        ja      .L7
        movl    %edx, -16(%ebp)
        movl    %ecx, -12(%ebp)
        jmp     .L12
        .size   rmg, .-rmg
        .p2align 4,,15
.globl main
        .type   main, @function
main:
        leal    4(%esp), %ecx
        andl    $-16, %esp
        pushl   -4(%ecx)
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ecx
        subl    $4, %esp
        call    rmg
        popl    %ecx
        popl    %ecx
        popl    %ebp
        leal    -4(%ecx), %esp
        ret
        .size   main, .-main
        .local  sec.1647
        .comm   sec.1647,4,4
        .local  nsec.1646
        .comm   nsec.1646,8,8
        .ident  "GCC: (GNU) 4.3.0 20070522 (experimental)"
        .section        .note.GNU-stack,"",@progbits

I will try both Mr. Taylor volatile suggestion and if I can retrieve Mr Park's
proposed patch in ascii I will try that one too

Thanks


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]