Mail Archives: djgpp/2000/04/14/11:59:29
Please read the following text *entirely* instead of reading a part and then
talking about it. Entirely!!!
If I use something like this in my inline ASM:
__asm__ __volatile__ ("
fmull (%0)"
:
: "g" (&variable)
);
I have some problems...
If optimizer doesn't put address of the variable to a conventional
register (EAX,EBX,ECX,EDX,ESI,EDI) with the following instruction:
LEA register, [ebp-offset] (sorry for Intel syntax),
the following assembly source code is generated out of my inline ASM:
fmull (-140(%ebp))
Here first and last parentheses crash the AS with these error messages:
"Error: Error: Missing ')' assumed"
"Error: Error: Ignoring junk `(%ebp))' after expression")"
If I remove these parentheses manually, "bug" goes away.
Also I can "patch" my source and bug will also go away:
__asm__ __volatile__ ("
fmull %0"
:
: "g" (&variable)
);
BUT!!!
If the optimizer puts the address of the variable to any of conventional
registers (EAX,EBX,ECX,EDX,ESI,EDI), generated the following code:
fmull (%ecx)
which is recognized by AS.
But with use of the ``"g" ()'' thing I can't know what will the
optimizer do. So, I can't know where I should put those parentheses and
where I should not. Of course I can use the ``"r" ()'' instead, but this
means I work instead of the optimizer, but do I have to do *its* job?
I think no. It must figure out what to do itself and it must not generate
faulty source code. *Optimizing* doesn't mean *adding bugs*.
Thanks for reading it attentively.
Now is time for your comments, thoughts, ideas.
Alexei A. Frounze
- Raw text -