This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: MS/CW-style inline assembly for GCC
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