Path: 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 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 -------