home .. forth .. misc mail list archive ..

Re: RISC again


On Mon, 25 Mar 1996, Andrew Haley wrote:

> RISC instructions are often a bit less dense than CISC.  RISC
> processors handle procedures with a variable number of arguments
> perfectly correctly.

I tried to elaborate on this :-)

> That is: the code does the right thing, and it
> does it quickly.

> Compiler writing for RISC architectures is to a large extent a problem
> which has already been solved.  I use such a compiler every day: the
> code it generates isn't perfectly optimum, but it is correct.  (In
> fact that's not quite true; I have experienced one optimizer bug which
> generated incorrect code in the course of three years' programming.)

Actually, to the things that matter most -- loop unrolling for floating
point routines -- they are very bad (well, the SGI MIPS compiler for IRIX
5.3) The compiler, given the following C code, produces either far from
optimal machine code, or _incorrect_ code, depending on the switches you
feed it:

/*
 *  Calculate the dot product of two samples
 */

double ddot(double *v1, double *v2, int n){
  int i;
  double acc;

  for(acc=0,i=0; i<n; i++) acc+=v1[i]*v2[i];
  return(acc);
}

This is not a staement about RISC per se, it only says, that the problem
of RISC C compiler writing is far from being solved.

--
Penio Penev <Penev@pisa.Rockefeller.edu> 1-212-327-7423