Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!pyramid!wendyt From: wendyt@pyrps5 (Wendy Thrash) Newsgroups: comp.arch Subject: Re: 80486 vs. 68040 code size [really: how many regs] Message-ID: <72153@pyramid.pyramid.com> Date: 30 May 89 23:34:14 GMT Sender: daemon@pyramid.pyramid.com Reply-To: wendyt@pyrps5.pyramid.com (Wendy Thrash) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 33 In article <3256@epimass.EPI.COM> jbuck@epimass.EPI.COM (Joe Buck) writes: >Sorry, Wendy, it doesn't work. The reason it doesn't is because C >promotes shorts to ints before doing any arithmetic or function calls. . . . Before everyone on the net sends me mail telling me I'm an idiot, I'd like to 1) plead temporary insanity for not thinking of function calls; and 2) remark that C doesn't require promotion before doing arithmetic, but requires that the results look as if it did. For example, Vax gcc, when fed main() { short i, j, k, l; i = ((i+j)*(i-j)); foo(i); } produces . . . addw3 -4(fp),-8(fp),r0 subw3 -8(fp),-4(fp),r1 mulw3 r0,r1,-4(fp) cvtwl -4(fp),r0 pushl r0 calls $1,_foo The convert is there for the call, but the arithmetic is done in short. (Yes, there are other calculations on shorts that will require conversion to longs as an intermediate step.) This is in the X3J11 Rationale; e.g., in section 3.2.1.5: "Calculations can also be performed in a 'narrower' type, by the _as if_ rule, so long as the same end result is obtained." >Why do we always get into these C discussions on comp.arch? Why am I >complaining about something I am engaging in? :-) My apologies; I'll post no more on this topic, no matter what piece of stupidity someone finds in this posting.