Compared to the 32-bit ARM instruction set, the 16-bit thumb instruction set (not to mention thumb extensions2) takes up less space because instructions are half the size, but overall this is a performance hit because it requires more instructions to do the same as on the hand. There are fewer functions in the instruction set, and most instructions work only with the r0-r7 registers. Comparing Apples to Apples more instructions to perform the same action slower.
Now thumb2 extensions accepts previously undefined thumb instructions and creates 32-bit thumb instructions. Understand that there are several sets of thumb extensions. ARMv6m adds a couple dozen, perhaps. ARMv7m adds something like 150 instructions to the instruction set of the thumb, I donβt know what ARMv8 or the future is. Thus, assuming ARMv7m, they bridge the gap between what you can do with your thumb and what you can do in ARM. Thus, thumb2 is a smaller ARM instruction set like thumb, but not as small. Thus, more instructions may be required to do the same in thumb2 (suppose plus the thumb) compared to ARM, doing the same.
This gives an idea of ββthe problem, one instruction in the hand and its equivalent in the thumb.
ARM and r8,r9,r10 THUMB push {r0,r1} mov r0,r8 mov r1,r9 and r0,r1 mov r1,r10 and r0,r1 mov r8,r0 pop {r0,r1}
Now the compiler will not do this, the compiler will know that it is aiming at the thumb and does something different, choosing other registers. You still have fewer registers and fewer options for each command:
mov r0,r1 and r0,r2
It still executes two instruction / execution cycles and two registers together without changing the operands and puts the result in the third register. Thumb2 has three registers, and so you return to the same instruction using the thumb2 extensions. And this thumb2 command allows r0-r15 in any of these three registers, where the thumb is limited to r0-r7.
Look at the ARMv5 Architecture Reference Guide, for each thumb instruction, it shows an equivalent ARM instruction. Then go to this ARM instruction and compare what you can do with this instruction, which you cannot do with the thumb instruction. This is a one-way path in which thumb (not thumb2) pointers are one-to-one with the ARM instruction. all thumb pointers have equivalent hand instructions. but not all hand instructions have equivalent thumb instructions. You should be able to see the compiler limit from this exercise when using the thumb instruction set. Then get the ARMv7m Architectural Reference Manual and look at the set of commands and compare the "all thumb options" encodings (those that include ARMv4T) and those that are limited by ARMv6 and / or v7 and see an extension of functions between the thumb and thumb2, and there are also thumb indexes2, which have not the slightest analogue. This should clarify that compilers should work with thumb and thumb2. You can go so far as to compare finger + thumb2 with fully bloated ARM instructions (is ARMv7 AR what it is called?). And look that thumb2 is much closer to ARM, but you lose, for example, conditional expressions for each command, so conditional execution on the finger becomes a mapping to branching over the code, where in ARM there can sometimes be if-then-else without branching ..