Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!rpi!rpi.edu!deven From: deven@pawl.rpi.edu (Deven Corzine) Newsgroups: comp.sys.amiga Subject: Re: Amiga compiler optimizing test Message-ID: Date: 3 Mar 89 08:55:59 GMT References: <3531@sdsu.UUCP> Sender: usenet@rpi.edu Reply-To: shadow@pawl.rpi.edu Organization: RPI Public Access Workstation Lab, Troy NY Lines: 35 In-reply-to: lindwall@sdsu.UUCP's message of 2 Mar 89 07:00:30 GMT Lattice C V5.00 generated similar code; it did not factor the expression and do the shift once only. (with or without the global optimizer.) with your example, the compiler complained about uninitialized automatic variables and the optimizer simply killed the whold thing as being dead code. recoded as: test(x,y); int x,y; { return(x*8-y*8); } compiled with: lc -O -v test.c nothing complained, produced code was: link a5,#0000 ; (exactly what does this do?) ; [something w/stack] move.l 000c(a5),d0 ; x asl.l #3,d0 ; x*8 move.l 0008(a5),d1 ; y asl.l #3,d1 ; y*8 sub.l d0,d1 ; x*8-y*8 move.l d1,d0 ; return x*8-y*8 unlk a5 ; undo the link rts ; return Deven -- ------- shadow@pawl.rpi.edu ------- Deven Thomas Corzine --------------------- Cogito shadow@acm.rpi.edu 2346 15th Street Pi-Rho America ergo userfxb6@rpitsmts.bitnet Troy, NY 12180-2306 (518) 272-5847 sum... In the immortal words of Socrates: "I drank what?" ...I think.