asm() / goto() concern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to write some inline assembler but I see that asm() does not support branching to labels, and that asm goto() does not support output (at least prior to gcc 11).  

If I tie them together by declaring an output of the asm() as an input to asm goto() I assume that this will prevent the optimiser from reordering them, but how can I ensure that they are run without any intervening instructions if the goto() has a dependency on the cc generated by the asm(), eg:

    asm ( "algr %[rs],%[rb] \n\t"
          : [rs] "+r" (sum)     // output
          : [rb] "r"  (u64b)    // input
        );

    asm goto ( "bc 3,%l[done]"        // branch if carry bit set (cc 2 or 3)
               :                    // output
               : [rs] "r"  (sum)    // input:  ensure this comes after the algr
               :                     // clobbers
               : done
             ); 

Best wishes / Mejores deseos /  Meilleurs vœux

Ian ...




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux