This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MS/CW-style inline assembly for GCC

Michael Matz wrote:

You see the contradiction, don't you?  (Or at least that you personally
failed spectacularly in supporting your assertion ;-) )

No, I don't see any particular contradiction, it's easy to make mistakes when dashing off code in any language.

Actually if you compare the C and ASM, what you see is
that the C is far clearer and easier in the addressing
and looping issues (note that all my junk slipups were
in this area), but much less clear in the actual operation,
which in the ASM is just one ADC instruction (which was
correct in all my iterations), and in the C code, this
is piles of rubbish, which we hope the compiler will
manage to turn into one instruction.

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.

That actually is quite easy and clean to do with the current
syntax. It would be interesting to do the excercise, and see
what gcc generated for it. Actually I am not confident this
can be done thinking a bit more. Will the gcc loop code respect
the need to preserve the carry flag, I am afraid not???

I'd have a go, but I find writing the ASM inserts for GCC
to be *really* tricky :-) :-)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]