This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Force consecutive operation when using asm volatile macro


Hello,

I've successfully updated gcc 2.95.3 to 4.3.2 (made necessary syntax changes to code etc.).

With GCC 2.95.3 I've used a critical section asm volatile macro to enter and exit critical sections in the code. When entering critical section, there are two asm volatile lines needed. On critical section exit only one asm volatile line is required.

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?

BR. Jari Kuusisto


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]