versions for thumb and thumb-2 instruction sets

Timo Sintonen via D.gnu d.gnu at puremagic.com
Sun Feb 7 12:26:31 PST 2016


On Saturday, 6 February 2016 at 21:58:17 UTC, Dan Olson wrote:
> Hi Iain, Johannes.  I'm asking here because I don't expect 
> anybody else is playing with thumb instructions.
>
> Both GDC and LDC have version ARM_Thumb defined for original 
> thumb (call it thumb-1) and thumb-2.  But there is no way to 
> tell in D code which set is supported.
>
> GCC and clang define these:
>
> __arm__
> Always defined when building for the ARM architecture 
> (regardless of
> target instruction set)
>
> __thumb__
> Defined only when targeting any Thumb instruction set variant 
> (Thumb-1
> or Thumb-2)
>
> __thumb2__
> Defined only when targeting Thumb-2
>
> We could mimic this by adding ARM_Thumb2.
>
> But in my experience it is usually thumb-1 that needs special 
> handling because it is very limited, and thumb-2 uses unified 
> assembler so often same code works for either thumb-2 or arm 
> modes.
>
> So I am thinking that ARM_Thumb1 would be more practical.  What 
> do you think?

Thumb2 is an extension to thumb. It has everything that thumb has 
and more. There is nothing in thumb that is not in thumb2. There 
is no thumb1. Thumb is sometimes called thumb1 because thumb is 
often understood to be both thumb and thumb2.

Thumb2 was introduced to some armv6 devices and it is in all v7 
and later devices, including all Cortex ones. I do not remember 
dates but I think it has been nearly 10 years that all new 
designs have been thumb2. There may not be many old thumb 
processors out there any more.

I do not know if there is need to support old thumb any more. 
However, if it is wanted, plain thumb or thumb1 is just what is 
not thumb2 and can be handled in else branch of thumb2 test.




More information about the D.gnu mailing list