Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sol.ctr.columbia.edu!ira.uka.de!smurf!urlichs From: urlichs@smurf.sub.org (Matthias Urlichs) Newsgroups: comp.sys.mac.programmer Subject: Re: Increment (Was Re: Pascal deficiency)? Message-ID: Date: 18 Dec 90 23:00:01 GMT References: <1990Dec18.001753.3756@Neon.Stanford.EDU> <1990Dec18.004838.5623@Neon.Stanford.EDU> <1990Dec18.015258.8631@Neon.Stanford.EDU> Organization: University of Karlsruhe, FRG Lines: 30 In comp.sys.mac.programmer, article <1990Dec18.015258.8631@Neon.Stanford.EDU>, kaufman@Neon.Stanford.EDU (Marc T. Kaufman) writes: < < Well, to generate the above code, I declared 'external int i'. The C < compiler DOES put things in registers. However, MPW C still generates < pretty crufty code for i = i+1: < < MOVE.L D2,D0 < ADDQ.L #$1,D0 < MOVE.L D0,D2 < < and this is with optimization ON! < MPW Pascal is about as bad. < [...] I'm going to look at gcc and see if doesn't generate better code. Substantially; it generates direct ADDQ instructions in all three cases (x=x+1; x++; ++x), for registers as well as memory locations. < While gcc misses a few obvious optimizations like MOVE.L D0,D0 in some cases, its code quality approaches being comparable to what a human programmer might create. That can't be said for the MPW compilers, unfortunately, and there's no Gnu Pascal yet. (On the other hand, it's relatively easy to translate Pascal to Modula-2, and the p1 Modula compiler generates good code... ;-) ) -- Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de /(o\ Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(0700-2330) \o)/