What is the ARM Thumb Instruction set?

后端 未结 1 1852
粉色の甜心
粉色の甜心 2021-01-30 10:33

under \"The Thumb instruction set\" in section 1-34 of \"ARM11TechnicalRefManual\" it said that:

\"The Thumb instruction set is a subset of the most commonly used 32-b

相关标签:
1条回答
  • 2021-01-30 11:07

    The ARM processor has 2 instruction sets, the traditional ARM set, where the instructions are all 32-bit long, and the more condensed Thumb set, where most common instructions are 16-bit long (and some are 32-bit long). Which instruction set to run can be chosen by the developer, and only one set can be active (i.e. once the processor is switched to Thumb mode, all instructions will be decoded as using the Thumb instead of ARM).

    Although they are different instruction sets, they share similar functionality, and can be represented using the same assembly language. For example, the instruction

    ADDS  R0, R1, R2
    

    can be compiled to ARM (E0910002 / 11100000 10010001 00000000 00000010) or Thumb (1888 / 00011000 10001000). Of course, they perform the same function (add r1 and r2 and store the result to r0), even if they have different encodings. This is the meaning of Thumb instructions are 16 bits long,and have a corresponding 32-bit ARM instruction that has the same effect on processor model.

    Every* instruction in Thumb encoding also has a corresponding encoding in ARM, which is meant by the "subset" sentence.


    *: Not strictly true, there is not "IT" instruction in ARM, although ARM doesn't need "IT" anyway (it will be ignored by the assembler).

    0 讨论(0)
提交回复
热议问题