Re: pic c



From that proof we logically say that we can make any C program
the same size or smaller than an asm benchmark.

You cannot be serious claiming that.

"Any C program can be coded in ASM"

is true (perhaps impractical with some - many - assembly syntaxes);

the reverse is simply not true and you should know it.

Dimiter

------------------------------------------------------
Dimiter Popoff Transgalactic Instruments

http://www.tgi-sci.com
------------------------------------------------------

Walter Banks wrote:

David Brown wrote:

It is often *easier* to write clever code in C, especially if
maintainability of the code is important, but it will *always* be the
case that any code that can be written in C, no matter how clever, can
be written at least as small and fast in assembly (given enough time and
programmer skill), while the opposite is not true.

This last point I don't agree with. With a C compiler that can optimize
small sequences each describing one instruction of the whole
instruction set and producing one instruction we have proof that we
can then take any asm program translate it into C and and compile it
into a program the exact same size as the asm program.

From that proof we logically say that we can make any C program
the same size or smaller than an asm benchmark.

The point of using modern
compilers is not that they can somehow generate impossibly good
code - it is that they can generate better code than assembly
programming in almost all real-life cases.

I am not disputing that at all. This all started a few months ago
as part of a compiler validation excise. The result of the
exercise has a lot of implications in the asm vs C debate
and some approaches to application development.

I am not trying to argumentative on this point, just pointing
out what we did and extrapolating the implications.

We have been aware for 3 or 4 years that it was possible
to encode the instruction set in C. We did most of the
eTPU instruction set in C when we wrote the code generator
for it. The RS08 was the first full instruction set that we
implemented in C and compiled back to single instructions.
Since then we have done 2 more.

Walter Banks
--
Byte Craft Limited
Tel. (519) 888-6911
http://www.bytecraft.com
walter@xxxxxxxxxxxxx

.



Relevant Pages

  • Re: Asm simulators/emulators?
    ... | get straight to the asm. ... Its not clear, but if you like the SPARC instruction set, heres a link ... intended to illustrate the SPARC instruction set, ...
    (comp.lang.lisp)
  • Re: pic c
    ... >>example have there full instruction set described ?in C and when compiled ... >>proof that any asm program can be equal or SMALLER in C) ... Well every compiler ive seen compiles to assembler so his staement is ... Most do NOT compile to assembler these days unless you ask them nicely. ...
    (comp.arch.embedded)
  • Re: Interesting article by Randall Hyde
    ... Orthogonality implies redundancy, ... >a precompressed instruction set. ... >x87 will do 18 digits at a time in hardware. ... tell he knows how to write .asm code. ...
    (comp.lang.asm.x86)
  • Re: Buffer overrun exploit example
    ... Understanding the ASM gives one a feel for what is really going on ... >considerably improve FP code over what the delphi compiler emits. ... >intel assembler book, and I just generalise from that. ... >of the instruction set. ...
    (alt.comp.lang.borland-delphi)
  • Re: [9fans] speaking of kenc
    ... as dumb as gcc asm thrown in there or something even simpler. ... > provided you have the instruction set manuals. ... emulation modes and addressing modes? ...
    (comp.os.plan9)