Re: C code .vs. Assembly code for Microcontrollers/DSPs ?

dan@watson.ibm.com (Walt Daniels)
16 Mar 1996 00:08:47 -0500

          From comp.compilers

Related articles
[23 earlier articles]
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? sberg@camtronics.com (1996-03-14)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? bobduff@world.std.com (1996-03-14)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? bobduff@world.std.com (1996-03-14)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? john.r.strohm@BIX.com (1996-03-15)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? cdg@nullstone.com (1996-03-15)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? cdg@nullstone.com (1996-03-16)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? dan@watson.ibm.com (1996-03-16)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? stefan.monnier@lia.di.epfl.ch (Stefan Monnier) (1996-03-16)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? albaugh@agames.com (1996-03-16)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? preston@cs.rice.edu (1996-03-17)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? elvey@hal.com (1996-03-17)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? john.gilliver@gecm.com (1996-03-20)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? leichter@smarts.com (Jerry Leichter) (1996-03-21)
[20 later articles]
| List of all articles for this month |

From: dan@watson.ibm.com (Walt Daniels)
Newsgroups: comp.arch,comp.compilers,comp.dsp
Date: 16 Mar 1996 00:08:47 -0500
Organization: IBM T.J. Watson Research Center, Hawthorne, New York
References: 96-03-006 96-03-091
Keywords: assembler, optimize, DSP

I for one don't believe assembler is consistently better than
HLLs. Let me give two examples one ancient one moderately recent.


In the late 50s in needed a function to compute Bessel functions of
the 3rd kind. I picked up the handy-dandy share library routine and
started testing it. It got wrong answers near
singularities. Fortunately it came with a clear writeup of the
algorithm that it was using. I coded that up in Fortran. Surprise - it
ran 30% faster and got right answers.


The second example was for some of the math functions on AIX. These
were originally written by the compiler people in PL.8 (a PL/I like
language). But the AIX developers didn't want any code that wasn't C
or Assembler so they rewrote it in Assembler. It was slower. They
could have just copied the PL.8 assembler listing and gotten it right
but that code was someone ununderstandable so they rewrote it. The
answer is that the compilers for RISC machines frequently put out
fairly obscure code because they understand all about the scheduling
of instructions which can makes differences in 10% area.


There are very few assembler coders that are as good as the output of
good compilers because of the complexity of the machines. Even when
they are good, they are not consistently good because it is hard to
pay that much attention to details all of the time.


Now if you ask a slightly different question - What is the difference
in size of the code? - you will get a somewhat different
answer. Compiler writers have not typically paid as much attention to
small code size which is important to the embedded market. Although in
the first example above, the Fortran was 10% smaller than the
assembler.
--
Walt Daniels (IBM)<DAN at WATSON> 914 784-6736
                                          (Internet)<dan@watson.ibm.com>
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.