Hacker News new | past | comments | ask | show | jobs | submit login

Is thumb-only particularly good for density, compared to being able to mix instruction sizes?



Thumb has both 16-bit and 32-bit instructions.


Oh, you meant thumb and thumb-2.


"thumb-2" isn't really a thing. It's just an informal name from when more instructions were being added to thumb. it's still just thumb.


Thumb2 is a thing. Thumb is purely 16 bit instructions. Thumb2 is a mix of 16 bit and 32 bit instructions.

As an illustrative example, in Thumb when the programmer writes "BL <offset>" or "BX <offset>" the assembler creates two undocumented 16 bit instructions next to each other which together have the desired effect. If you create those instructions yourself using e.g. .half directives (or if you're writing a JIT or compiler) then you can actually put other instructions between them, as long as you don't disturb the link register.

In Thumb2 the bit patterns for BL and BX are the same, but they are an ACTUAL 32 bit instruction which can't be split up like it can in Thumb.




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

Search: