[coldfire-gnu-discuss] Toolchain, asm parameters numbering and optimisation flags
fred at aidounix.com
fred at aidounix.com
Tue Dec 5 23:14:57 UTC 2006
> Here's your problem. The inline asm semantics are that all the input
> operands
> are read before any of the output operands are written. thus it is safe
> to
> allocate the same register(s) for inputs and outputs. All gcc targets are
> the
> same in this regard. Your assembly breaks that. you can fix this by
> telling
> gcc that 'sum' is an early clobber
> :"=&d" (sum)
>
Hi Nathan, your knowledge is some order of magnitude beyound mine! :)
I've corrected those points, now I can compile with -O0.
But GCC still scramble the registers (assigning D0 to %2 and %3 for
example).
for example :
C source :
move.l (%[X])+, %[tmp1];
move.l (%[Y])+, %[tmp2];
move.w %[tmp1], %[R1];
move.w %[tmp2], %[R2];
generates, with -O2 :
move.l (a0)+, d1;
move.l (a1)+, d1; ouch!
move.w d1, d2;
move.w d1, d3;
I really don't understand why it nicelly works with -O0 and not
with -O2.
Any idea?
Thanx again
More information about the coldfire-gnu-discuss
mailing list