This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, i386]: Insert "cld" via optimize mode switching
On Mon, 4 Dec 2006, Jan Hubicka wrote:
> As author of the current cld emitting code, I can just say that I kept
> it around for single reason, that the old GCC always emitted it and I
> didn't find any specification in the 32bit ABI (in 64bit ABI we specify
> CLD as clear and I did have patch to disable CLD codegen there that
> probably got lost somewhere on it's way to mainline).
The 32bit ABI specifies exactly the same. "Function calling sequence" the
list of registers:
EFLAGS The flags register contains the system flags, such as the direction
flag and the carry flag. The direction flag must be set to the
ââforwardââ (that is, zero) direction before entry and upon exit
from a function. Other user flags have no specified role in the
standard calling sequence and are not preserved.
> I would not be oposed to not emitting it at all - it just never seemed
> important enought for me as it is short and rather fast on most modern
> CPUs. It seems better alternative to me than introducing the mode
> switching pass that has some compilation time implications.
I agree. If we change something we should rather not emit cld at all (and
document from now on that inline asms are entered and to be left with