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

Eyal Ben-Avraham <eyal@dsp.co.il>
3 Mar 1996 19:47:02 -0500

          From comp.compilers

Related articles
C code .vs. Assembly code for Microcontrollers/DSPs ? ravindra@hal.com (1996-03-01)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? dstarr@pop-3.std.com (David J. Starr) (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? mwilliam@duncan.cs.utk.edu (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? eyal@dsp.co.il (Eyal Ben-Avraham) (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? jens.hansson@mailbox.swipnet.se (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? torbenm@diku.dk (1996-03-04)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? andrew@memex.co.uk (Andrew Cruickshank) (1996-03-04)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? fink@post.tau.ac.il (1996-03-05)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? torbenm@diku.dk (1996-03-05)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? hatrjo@hat-fi.kone.com (Risto Jokinen) (1996-03-05)
[46 later articles]
| List of all articles for this month |

From: Eyal Ben-Avraham <eyal@dsp.co.il>
Newsgroups: comp.compilers,comp.dsp
Date: 3 Mar 1996 19:47:02 -0500
Organization: Compilers Central
References: 96-03-006
Keywords: optimize, code, DSP

Ravindra Divekar <ravindra@hal.com> wrote:
: I've heard people say so many times, that hand-crafted (assembly) code
: is more compact than compiled C code for microcontrollers or DSPs.


I work in writing C compilers for DSPs, here are my observations
regarding these issues.


This code efficiency gap also exists for C compilers on
Workstations/PC's, the main difference is in 2 issues:


1. The average application size on microcontrollers or DSPs is small.
      So it can easily be written manually.


2. Reducing the application size on embedded microcontrollersor/DSP's
      can cause reduction in product price and improved performance.
      since these products are sold in large quantities, any manual effort
      to improve the application coding is worthwhile.


So even if you get an excellent compiler, with degradation factor of
only 10% (110 code size instead of 100), it is still worthwhile to
hand-optimize the code.


: So where is the problem?
:
: Is it a limitation of existing compiler technology (so much for the
: optimization hype) ?


This factor also exists, since microcontrollersor/DSPs have relatively
small register set. Compilers do better with plenty of registers.


: Is it the choice of high level language i.e. C/C++ that matters ?


For DSPs, definitely yes. C doesn't have intrinsic support for
multiply-accumulate, modulo addresssing, irregular register sizes,
various rounding methods.


--


Post a followup to this message

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