Re: mixing C and assembly



On Apr 23, 7:27�pm, Walter Banks <wal...@xxxxxxxxxxxxx> wrote:
Stefan Reuther wrote:
register_sp SP;

SP = int_value;

What you're doing here is writing assembly with C syntax. It relies upon
a heavily non-standard language extension, and makes assumptions about
how the compiler behaves (you don't want the compiler to use the stack
before your SP assignment, do you?). So instead of writing assembly in
C, I prefer using the real thing.

Yes, thats what he always does! He can then claim his compiler can
beat assembler for speed,code size ect. To Walter if it looks Cish,
ends in a semicolon and his compiler can change it into machine code
then its C.



I actually agree with you it is very low level C. The purpose of ISO/IEC
18037 was to define the low level syntax. Most start up code is very processor
family specific. �Writting start up code in C makes good use of C's
optimization like the branch/jump to main.

Whats to optimise? Why bother optimising a one time instruction?

Sometimes I think you'll say anything to sell a compiler.


w..

.



Relevant Pages

  • array bounds in assignments
    ... Assume there are M true elements in MASK. ... subroutine is compiled without optimization, ... not a bug in the compiler. ... of the assignment statement to be the same. ...
    (comp.lang.fortran)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... what experienced programmers do, ... optimization, ... Thugs" ad nauseum fits that a lot more closely than discussing compiler ... be modified outside a loop, and guessing ...
    (comp.programming)
  • long(!) Re: need help on CFLAGS in /etc/make.conf please
    ... For example, MPlayer sets this high on purpose, so GCC will actually ... and the K&R compiler would've known exactly the kind of optimization we wanted. ... >> A msg from Richard Coleman, taken together with the GCC 3.x Known Bugs ...
    (freebsd-questions)
  • Re: SETF and variable issues in Self Similar program.
    ... The way to get a compiler to optimize a tail-call ... call optimization turned on. ... It changes the semantics of the language in a big way. ... In Common Lisp it has to interact with condition handling, ...
    (comp.lang.lisp)
  • Re: Programming languages
    ... >> execution time, ... That's not a good candidate for optimization. ... if there is comething the compiler ... António> programmers and those can't cope with anything else than ...
    (sci.lang)