Mail Archives: djgpp/2001/07/05/18:34:16
The problem is that you're declaring cx to be both an input operand
and a clobber. The solution, taken from linux's headers, is to
declare three temporary variables and match them as *outputs*, with
the constraints. Then, make your input constraints be dups of those:
int tmp1, tmp2, tmp3;
asm volatile
(
" cld ; "
" rep ; "
" movsl ; "
: "=&S" (tmp1),
"=&D" (tmp2),
"=&c" (tmp3)
: "0" (src_cur_line_pos),
"1" (dest_cur_line_pos),
"2" (c2)
: "memory"
);
The '=' means it's an output, '&' means that the value changes before
the instruction is done using its inputs, and '0'..'2' means "same
register as operand N". The "volatile" tells gcc to never delete,
move, or modify the asm, else the optimizer would remove it (because
you're not using any of the output values). The "memory" tells gcc
that the asm changes memory, so it should be pessimistic about
optimizing memory accesses around this asm.
- Raw text -