Re: What micros do you actually hate to work with?



"Joerg" <notthisjoergsch@xxxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:ZDTWg.13298$6S3.881@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ok, I have only used '51 family device from Atmel, don't know if there are
16-bitters in store anywhere. But your word "generally" urges me to ask
you how this multiplication by 0.457358479 (Horner + CSD optimized) would
be done in C on a uC without HW multiplier in less than 30 CPU clocks:

A very bad example. This has nothing to do with C or ASM, but shows
an example where you need to solve a problem with minimal resources.
In which case a clever approach is needed. In C, you would have to be
equally clever, so it would look more or less the same. Something like
this perhaps:

register int16 twelve;
register int16 thirteen;

.....

thirteen=twelve;
twelve=>>2;
thirteen+=twelve; // X1=X*2^-2+X
twelve=>>2;
thirteen+=twelve; // X2=X1*2^-2+X
twelve=>>4;
thirteen+=twelve; // X3=X2*2^-4+X

Etcetera.

Would compile to the same assembly code. The compiler will
optimize the shift by a constant to a number of single shifts,
no worries about that.

Generally speaking, asm is dead. Generally, using C will produce
better code in less time. Generally, with less than tiny asm
projects, a C version will give you a smaller footprint.
Generally, using asm is a waste of time and energy and
produces lower quality code.

Now that was a stupid example.

--
Thanks, Frank.
(remove 'q' and '.invalid' when replying by email)






.



Relevant Pages

  • Re: XML-based object orientated pre-Assembler
    ... > I have been promising an object orientated ASM IDE for a while now. ... > that will parse XML code and output ASM files. ... > compile and viola, the code is ported. ... "Why would someone use this product over other assemblers?" ...
    (alt.lang.asm)
  • Re: 50% of packets lost only on local interfaces
    ... It would be quite interesting to compare the actual commands that ... Capture the buildworld/kernel output and compare ... There used to be inconsistencies in the way gcc handle asm() ... reported errors (and failed to compile the code). ...
    (freebsd-stable)
  • Re: pic c
    ... I'd call that 'C syntax Assembler', ... It isn't asm either. ... You still get tracking and optimization that C gives. ... The code will generally compile and run on other platforms. ...
    (comp.arch.embedded)
  • Re: Steganography MFC program problem...
    ... Asm is right that the 'i' variable is only in the scope of the for loop. ... I'm surprised it will even compile. ... Another trick is that you can turn off the new for scope "fix" in the project properties, but I recommend you fix the problem instead as it's really a better solution. ...
    (microsoft.public.vc.mfc)
  • Re: What micros do you actually hate to work with?
    ... register int16 thirteen; ... Would compile to the same assembly code. ... optimize the shift by a constant to a number of single shifts, ... with less than tiny asm ...
    (comp.arch.embedded)