3 ms·
That isn’t quite how it worked: every instruction has a 4 bit condition code field. It is usually AL “always” which is omitted in assembler. There wasn’t any li
by fanf2 6y ago
That isn’t quite how it worked: every instruction has a 4 bit condition code field. It is usually AL “always” which is omitted in assembler. There wasn’t any limit on how many conditional instructions you could have in sequence, but a branch is usually faster than three or so conditionals.
It gets really fun when you combine condition codes with comparisons, or with ALU instructions that set the processor status bits: you can do some quite intricate logic in very little space.
- mtklein 6y agoYou're both right... the 32-bit ARM encoding gives every instruction a 4-bit condition field, but the 16-bit Thumb and mostly-16-bit Thumb2 encodings use the IT instruction to carry the conditions for the next few instructions.
- olliej 6y agoAh cheers! I didn't think about it being thumb only (I never used raw arm32, so in my brain thumb2 is all that existed :D )