MSVC 4.2 re-arranges inline asm 
Author Message
 MSVC 4.2 re-arranges inline asm

With global optimization enabled, Microsoft Visual C++ 4.2 may change
the following inline asm sequence:

    cmp DL,0
    jne rarely_taken
  continue:
    nop
    jmp [pointer]
  rarely_taken:
    nop
    jmp continue

to:

    cmp DL,0
    jne rarely_taken
    jmp continue
    // some other stuff
  continue:
    nop
    jmp [pointer]
  rarely_taken:
    nop
    jmp continue

On the Pentium, this will cost 1 cycle. There may be an additional
performance loss because the unconditional jump needs an entry in the
Branch Target Buffer.

To prevent the re-arrangement of inline asm, insert:

  #pragma optimize("g", off)

before the function which contains inline assembler.



Wed, 12 May 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. porting inline Watcom asm to MSVC inline asm

2. Cycle-exact Pentium timing routine for MSVC 4.2

3. FPS 4.0 + MSVC 4.2 DLL problem

4. HELP! GraphWidget/Win95/MSVC V4/Tk 4.2

5. Interrupt 21h Function 7160h, Inline with Visual C ++ 4.2

6. Inline expansions in Allegro 4.2

7. (inline assembler)calling interrupts in program compiled on MsVC.net, winXP

8. ASSISTANCE REQUIRED - large memory model with inline MSVC assembler

9. GCC inline ASM -- calling C functions from __asm__

10. GCC inline ASM -- calling C functions from __asm__ blocks

11. MSVC CHOKES on this ASM putpixel routine!

12. MSVC CHOKES on this ASM putpixel routine!

 

 
Powered by phpBB® Forum Software