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

preston@tera.com (Preston Briggs)
22 Mar 1996 21:27:44 -0500

          From comp.compilers

Related articles
[38 earlier articles]
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? pdonovan@netcom.com (1996-03-21)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? fjh@cs.mu.OZ.AU (1996-03-21)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? cliffc@ami.sps.mot.com (1996-03-21)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? schwarz@mips.complang.tuwien.ac.at (1996-03-22)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? jfc@mit.edu (1996-03-22)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? chuck@aage.mit.edu (1996-03-22)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? preston@tera.com (1996-03-22)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? bobduff@world.std.com (1996-03-22)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? torbenm@diku.dk (1996-03-25)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) (1996-03-25)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? schwarz@mips.complang.tuwien.ac.at (1996-03-25)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? pardo@cs.washington.edu (1996-03-25)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? mgrice@iastate.edu (1996-03-27)
[5 later articles]
| List of all articles for this month |
From: preston@tera.com (Preston Briggs)
Newsgroups: comp.compilers
Date: 22 Mar 1996 21:27:44 -0500
Organization: /etc/organization
References: 96-03-106 96-03-117 96-03-131
Keywords: C, performance

>> I find this implied goal of programming to the lowest common
>> denominator very depressing.


>Since the majority of C compilers do not optimize const or static,
>"loweset common denominator" is perhaps better described as "common
>denominator".


I guess I'm not suprised. C is traditionally a language by and for
people who distrust optimizers (I'm thinking of all the Bell Labs guys
here). So maybe you're right. People writing in C should code as if
there's no help available at all. Do your own strength reduction and
CSE elimination. Propagate your own constants (by all means using
macros rather than "const"). Use those register declarations or
suffer the consequences! It's fun to code like this, like doing
crossword puzzles; you can spend days on every little function!


Or, find a good compiler and write your code as you like. When people
complain that your code doesn't run fast with their (poor miserable)
compiler, point out that better compilers do exist.


Or, pay attention to your algorithms and trust the hardware folks.
They'll soon overcome any coding inefficiencies introduced by the
programmer or compiler.


How do you find good C compilers? Test a lot of them. I wrote the
beginnings of a little test suite once, and Glaeser has a much more
complete one. Probably others have 'em too. I guess a difference
between Glaeser and me is that he has a small business and I wanted to
publicize the results. So instead of saying that the lowest common
denominator is thus and so, I could say "these few are great
compilers! Avoid these others." But then I got a job too, kind of
undermining my position as a consumer advocate.


Preston Briggs


--


Post a followup to this message

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