Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-sdd!ucsdhub!sdsu!lindwall From: lindwall@sdsu.UUCP (John Lindwall) Newsgroups: comp.sys.amiga Subject: Amiga compiler optimizing test Keywords: Manx C optimize code Message-ID: <3531@sdsu.UUCP> Date: 2 Mar 89 07:00:30 GMT Organization: San Diego State University, Math/Sciences Dept. Lines: 44 This posting was prompted by a friendly competition between two IBM PC compilers - Microsoft C 5.0 and Turbo C 2.0. We compared the assembly output generated by these compilers from a simple piece of code (I had a similar statement in a graphics program I was writing at the time). Here is the code: main() { int x, y, z; x = 8*y - 8*z; } [Keep reading - this IS an amiga posting.] It turned out that MSC generated nicer code for this statement. It fetched y and z , performed the subtraction, bit shifted the result, and stored the result in x. Turbo fetched y, shifted it, fetched z, shifted it, subtracted, and stored the result in x. So what does this have to do with Amigas? Well, out of curiosity I tried the same test on the only Ami compiler C I have, Manx 3.6a. Here is how I compiled it: cc -a +L test.c And here is the code generated: move.l -8(a5),d0 ; get y asl.l #3,d0 ; y *= 8 move.l -12(a5),d1 ; get z asl.l #3,d1 ; z *= z sub.l d1,d0 ; x = 8*y - 8*z move.l d0,-4(a5) Just out of curiosity I was wondering if someone could compile this code using Lattice so we can compare results. Use long integers. Please reveal the command line used to perform the compilation. Thanks! johnl@tw-rnd.SanDiego.NCR.COM john.lindwall@tw-rnd.SanDiego.NCR.COM