This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Inline assembly, clobber registers, ask for help
- From: "Tamas Nagy" <nagytam at web dot de>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Sun, 19 Jan 2003 22:17:02 +0100
- Subject: Inline assembly, clobber registers, ask for help
Hello,
There is an inline assembly routine (x86, converted from Intel syntax),
which has to be highly optimized.
The routine is using basicly all available
registers(eax,ebx,ecx,edx,esi,edi), and have problems if I enable
optimizations. (O0 -> Ok, O1..03->error, gcc3.2)
I see the following solution, and would be interested in your comments
on these:
1) Simple convert to GCC-syntax with using predefined registers (easy to
maintain). Add some extra code for saving/loading registers (make gcc
happy) as I was suggested... Accept worse performance caused by this
extra operation...
2) Modify the code (hard to maintain parallel with the other
Intel-syntax code) and let gcc select/optimize registers...
Will this optimization problem disappear?
The routine is using MMX/SSE2 instructions as well... Can gcc could
optimize the MMX/XMM registers as well?
And a question:
Which registers can be marked as clobbered registers? I tried eax, ebx
with success, but e.g. ecx caused a compilation error (~Register can't
be found within GENERAL_REGS). Which registers belongs to GENERAL_REGS?
Many thanks for all the tips, suggestions, comments,
Tamas