I'm trying to understand the syntax of the IT instruction that is to be used to enable conditional execution of instructions on ARM, in Thumb2 mode.The way I understand it, the bits in the CPSR register along with the IT instruction make conditional execution possible in Thumb mode. If I were writing some Thumb2 code perhaps I could go about following the process mentioned below.Lets say I have 4 conditional instructions(the maximum limit suported by IT).First, I write down by conditional instructions. Lets say the prefixes for the four instructions are CLZNE.W, CLZEQ.W, ADDEQ, ADDNEQ.Now before the conditional instructions I add an instruction of the form ITEEE NE. The NE is added as the first instruction has an NE. The EEE following the IT are added as the last 3 instructions are the converse of an NE. Is this how assembly programmers write conditional thumb2 ARM code? Is my understanding of the process correct?Why is the condition encoded in both IT and the instructions that follow?
Conditional instructions on ARM
arm
As far as I understand you described the process of using IT instructions correctly. This is exactly how one of compilers I worked with works.[EDIT]According to (for example) ARM Architecture Reference Manual document conditions are not encoded in most of conditionally executed Thumb instructions (except of jumps and some others) and it is the thing that defines the reason for IT instruction and all its variants existence.Unfortunately I couldn't find exact Thumb 2 encoding reference, but I think that it behaves the same as in Thumb.[ONE MORE EDIT]Yes, it is correct,both thumb and thumb II instructions I looked to does not have condition field (for example addition instructions and other ALU related things). The document I found it in is ARMv7-A -R Architecture Reference Manual, its download requires registration. So regarding your question number 3 - conditions in IT compliant operations are definitely not encoded in instruction itself. 