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

jfc@mit.edu (John Carr)
22 Mar 1996 00:05:41 -0500

          From comp.compilers

Related articles
[36 earlier articles]
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? stefan.monnier@lia.di.epfl.ch (Stefan Monnier) (1996-03-21)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? cdg@nullstone.com (1996-03-21)
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)
[7 later articles]
| List of all articles for this month |
From: jfc@mit.edu (John Carr)
Newsgroups: comp.compilers,comp.dsp
Date: 22 Mar 1996 00:05:41 -0500
Organization: Massachusetts Institute Of Technology
References: 96-03-006 96-03-044 96-03-078 96-03-098
Keywords: architecture

Robert A Duff <bobduff@world.std.com> wrote:


>This is a language problem, IMHO. Languages like C and Ada and Pascal
>seem to think that integer data types have something to do with the
>underlying hardware. That's wrong. The size in bits of the result
>should be determined by the size of the operands, and not their
>"type". No casts should be needed.


Unless you move away from a static typed language, the C model has a
great advantage. If the result of an operation is defined to have
infinite precision a long expression gains bits for every operator and
the code to implement it is big and slow.


To get the exact result for


(x + y) * (a + b) / d


where all variables are 32 bits requires 66 bit arithmetic. Addition
adds 1 bit and multiplication doubles the number of bits. The quotient
has the same number of bits as the dividend.




--
        John Carr (jfc@mit.edu)


--


Post a followup to this message

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