Skip to main content
cosmapa2
Associate II
April 19, 2010
Question

Conditional Assembly instruction in C

  • April 19, 2010
  • 2 replies
  • 815 views
Posted on April 19, 2010 at 17:25

Conditional Assembly instruction in C

    This topic has been closed for replies.

    2 replies

    andrewpellett9
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:47

    I'm assuming you're using an stm32 processor, which only implements the Thumb-2 ISA (not Thumb or ARM).

    Thumb-2 doesn't support conditional suffixes on all instructions, but it does give an IT instruction that can be used to subject the following instructions to conditional execution.

    cosmapa2
    cosmapa2Author
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:47

    Thanks. I've been looking everywhere for detailed info and examples on how to use the IT instruction. Can someone please show how the 3-instruction sequence below must be rewritten using the IT instruction. 

       sub r0, r1, r0     

       movmi r0, #0

       movpl r0, #1