Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site mit-bug.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!mhuxt!mhuxr!ulysses!allegra!mit-eddie!mit-bug!dove From: dove@mit-bug.UUCP (Web Dove) Newsgroups: net.lang.c Subject: Re: Can C default to float? Are there float regs? Message-ID: <253@mit-bug.UUCP> Date: Wed, 25-Sep-85 09:53:06 EDT Article-I.D.: mit-bug.253 Posted: Wed Sep 25 09:53:06 1985 Date-Received: Sun, 29-Sep-85 04:16:15 EDT References: <418@phri.UUCP> <700002@fthood> <187@graffiti.UUCP> <175@mit-bug.UUCP> <897@turtlevax.UUCP> <698@sfmag.UUCP> <56@escher.UUCP> Reply-To: dove@mit-bugs-bunny.UUCP (Web Dove) Organization: MIT Digital Signal Processing Group Lines: 82 In article <56@escher.UUCP> doug@escher.UUCP (Douglas J Freyburger) writes: >The discussion has been about single vs double precision >floating point as well as keeping them in registers. It >was mentioned that there w{{uld be a big speed difference >on the VAX. > >At site "cithep", the Caltech High Enerrgy Physics >Department, they made a C compiler that used single >precision for "float". At first, they got ALMOST NO SPEED >IMPROVEMENT. After adding floating point immediate values >to the assembler produced (instead of storing constants >like strings and then referring to them by name), they got >a pretty good improvement. 10-20%. I don't know if they >were running a 750 or 780. Still, for calculations that >only involve variables and no constants, the difference is >much smaller than you'd think. Here is the simple test I used #includemain() { register float x=1.1, y=1.0; register int i; for(i=0; i<100000; i++) { x = x+y; x = x+y; x = x+y; x = x+y; x = x+y; x = x+y; x = x+y; x = x+y; x = x+y; x = x+y; } } 750/FPA results using 4.2bsd compiler (with "-O") 9.6u 0.6s 0:11 91% 1+3k 1+2io 2pf+0w 750/FPA results using 4.3bsd compiler (with "-O -f" i.e. use single precision float) 1.8u 0.1s 0:01 101% 1+3k 0+2io 2pf+0w This is an artificially dramatic result. The following is more typical. Here is a summary of the fft times for a program written in C (no assem code) It uses either single precision (with the 4.3bsd compiler "-O -f") or double precision (either 4.3bsd or 4.2bsd compilers, they are effectively the same). The times for single with the 4.2 compiler are longer than double (because of all the conversions) so it is pointless to list them as an alternative. Summary of FFT Times: 1024 complex FFTs (in milliseconds) and IFFTs - Single Precision Vax750 w/FPA (Radix 4): 210 and 210 Vax750 w/FPA (Radix 2): 280 and 290 Vax785 w/FPA (Radix 4): 80 and 90 Vax785 w/FPA (Radix 2): 100 and 110 1024 complex FFTs (in milliseconds) and IFFTs - Double Precision Vax750 w/FPA (Radix 4): 350 and 350 Vax750 w/FPA (Radix 2): 360 and 390 Vax785 w/FPA (Radix 4): 200 and 210 Vax785 w/FPA (Radix 2): 220 and 230 These are considerable improvements for both 750 and 785 (more than the 20% quoted above) and for a program that has a typical balance of control code and floating arithmetic code (typical for signal processing).