Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



You'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.


Ah 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 )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: