Selective -O3 optimization of a C++ code mixed with inline assembly

Wasif Latif wasif40@yahoo.com
Sun Oct 6 19:31:00 GMT 2002


I am encountered with a very compute intensive C++
code. When I compile it -O3 level optimization, it
gives me a time saving of about 40% and works fine. To
do more optimization, I have converted its 3 functions
into inline assembly. This mixed C++ plus inline
assembly code works fine at optimization level -O0.
However when I compiles it -O3, it gives 2 types of
error.
1)It reports error in assembly instructions in
assembly which otherwise ran fine at -O0
level. This is due to improper addressing translation 
while accessing the local C variables.
2)If somehow I overcome these compile time errors at
optimization level -O3, the program gives run time
errors like "Segmentation Fault" and "Arithmetic 
Exception"

The solution which I thought for this thing is to
selectively compile the inline assembly functions with
no optimization while remaining C code with highest
optimization. Can somebody tell me is there Microsoft
Visual C++ #pragma optimization and #pragma
nooptimization like declations which I can put in my
C-code to do selective optimization while compilation.

Thanks in advance

Wasif


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



More information about the Gcc-help mailing list