Force consecutive operation when using asm volatile macro
Ian Lance Taylor
iant@google.com
Tue Oct 7 04:26:00 GMT 2008
Jari Kuusisto <jari.h.kuusisto@gmail.com> writes:
> After upgrading from gcc 2.95.3 to 4.3.2 the critical section handling
> in the code stopped working. It seems that some of the code that
> should be in critical section seems to be relocated outside the
> critical section. I do know that asm volatile does not guarantee
> consecutive execution of the code. I also know that using singe asm
> would fix this problem, but in my case it is not possible.
>
> I've managed to to get around this problem by replacing the critical
> section macros with assembler functions as the blr instruction forces
> the correct consecutive operation when entering and exiting critical
> section. However, this function call type implementation seems to
> significantly slow down runtime operation of the software. The result
> is that the performance improvement gained with new gcc optimizations
> is waisted due to this function call type implementation.
>
> If I enable all other optimizations from -O2 but not the
> -freorder-blocks the code is working with the old asm volatile macros,
> but this is not an option.
>
> Is there any other way to force the consecutive operation of asm
> volatile macros?
You're going to have to show us the code.
Ian
More information about the Gcc-help
mailing list