[gnu.gcc.bug] optimization need for the '/' operation in gcc-1.36 on aix386

TRANLE@INTELLICORP.COM (Minh Tran-Le) (01/21/90)

gcc-1.36 does not seems to optimize the integer divide operation on the 386
platforms:

I have the following function:
int test( a , b)
int a, b;
{
    return (a / b);
}

with the standard cc it compile to:
---- standard cc compile ----
        .globl    test
        .bss      
        .align 4  
        .blkb     0
        .text     
        .align 4  
test:
%_test_1:
%_test_2:
    movl     0x4(%esp), %eax
    cltd     
    idivl    0x8(%esp)
%_test_3:
%_test_exit:
    ret      
    movl     %eax, %eax
------------------------------

But with gcc I got:
---- gcc compile -------------
	.file	"xxx.c"
gcc_compiled.:
.text
	.align 4
.globl test
test:
	pushl %ebp
	movl %esp,%ebp
	pushl 12(%ebp)
	pushl 8(%ebp)
	call __divsi3	<-- why is there a function call here ?
	addl $8,%esp
	movl %eax,%eax
	movl %eax,%eax
	jmp .L1
.L1:
	leave
	ret
--------------------------------

Thanks, Tran Le.

Arpanet: tranle@intellicorp.com
uucp:    ..sun!icmv!mtranle
-------