[comp.sys.mac.programmer] MPW C/fp performance

tcd@vax5.cit.cornell.edu (01/08/91)

    I am using MPW C (v. 3.0) to write a program that involves
a lot of floating point calculation.  The code that is generated
appears incredibly inefficient (although I'll admit that I have
never looked at the output from another compiler before, so I
don't have much basis for comparison).  I have learned to use a lot
of temporary variables and eliminate explicit subscripting of arrays,
but some things appear impossible to get around.  A typical section of
code that really bothers me is something like the following:
  FMOVE   FP7,FP0
  FADD.X  (A3),FP0
  FMOVE   FP0,FP7

when   FADD.X  (A3),FP7   would produce the desired result.  What I am
wondering is the following:
1)  Does version 3.1 of MPW offer any improvement in this regard?
2)  How do other Macintosh compilers (C or otherwise) compare?
3)  Does anyone know of a book or other source that describes tips,
techniques, pitfalls, etc. for a Macintosh programmer interested in
execution speed for floating point calculations?

Thanks,
Tim Dorcey

torrie@cs.stanford.edu (Evan J Torrie) (01/08/91)

tcd@vax5.cit.cornell.edu writes:


>    I am using MPW C (v. 3.0) to write a program that involves
>a lot of floating point calculation.  The code that is generated
>appears incredibly inefficient (although I'll admit that I have
>never looked at the output from another compiler before, so I
>don't have much basis for comparison).  I have learned to use a lot
>of temporary variables and eliminate explicit subscripting of arrays,
>but some things appear impossible to get around.  A typical section of
>code that really bothers me is something like the following:
>  FMOVE   FP7,FP0
>  FADD.X  (A3),FP0
>  FMOVE   FP0,FP7

  You might want to try looking at Apple's recently released (and
fairly much unsupported) GCC for MPW.  GCC produces fairly efficient
code for the 6888x series, certainly much better than MPW C has ever
produced for me (factors of 2 or 3 times faster in some cases).

-- 
------------------------------------------------------------------------------
Evan Torrie.  Stanford University, Class of 199?       torrie@cs.stanford.edu   
Where can a nation lie when it hides its organic minds in a cellar dark and
grim?  They must be ...  very dim.