🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #901

optimization need for the '/' operation in gcc-1.36 on aix386

#901
From: Minh Tran-Le
Date: Sat, 20 Jan 1990 20:10
57 lines
1446 bytes
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
-------
Technical Details
Message-ID: <9001202009.AA01920@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!INTELLICORP.COM!TRANLE

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!INTELLICORP.COM!TRANLE
From: TRANLE@INTELLICORP.COM (Minh Tran-Le)
Newsgroups: gnu.gcc.bug
Subject: optimization need for the '/' operation in gcc-1.36 on aix386
Message-ID: <9001202009.AA01920@life.ai.mit.edu>
Date: 20 Jan 90 20:10:45 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 57