MS/CW-style inline assembly for GCC
Andi Kleen
ak@muc.de
Tue May 11 14:59:00 GMT 2004
Robert Dewar <dewar@gnat.com> writes:
>
> The cleanest way to write this loop is in fact to write
> a loop in C (or Ada or whatever), and then use an ASM
> insert for the actual ADC instruction and nothing else.
Not at all. You cannot get gcc to guarantee it will keep
the carry flag valid over a loop iteration. The only way is to
write the whole loop in assembly.
Or unroll by hand. I did that some time ago when doing an
IP checksum function in a C/assembler mix. Just writing
unrolled blocks of assembly is usually not very error prone.
-Andi
More information about the Gcc
mailing list