Thumb vs Thumb-2 vs A32: ARM Instruction Sets Explained
A32, Thumb and Thumb-2 are three ways to encode ARM instructions. See how they differ, which one a Cortex-M runs, and how to read the encodings in objdump.

Pick up an ARM manual and three names appear within a page: A32, Thumb and Thumb-2. They are not three processors. They are three ways of encoding instructions into bits, and a given core supports some of them. Knowing which one a Cortex-M runs explains why movs has an s, why objdump prints some instructions in four hex digits and others in eight, and why your toolchain needs -mthumb. This post sorts out the names using the Arm Architecture Reference Manuals for Armv6-M and Armv7-M, and shows the encodings you will meet in a disassembly.
Three encodings, one family
Historically the ARM instruction set was a single 32-bit fixed-width encoding. Today the architecture calls it A32, and a processor executing it is said to be in ARM state. Code size was a problem on small devices, so Arm added a second, compact encoding with 16-bit instructions, called Thumb. A 16-bit instruction set cannot express everything, so Thumb was less capable per instruction and often needed more instructions for the same job.
Thumb-2 is the answer to that. It is not a third state. It is an extension to Thumb that adds many 32-bit instructions alongside the 16-bit ones, so a single instruction stream mixes both sizes. The processor tells them apart from the first halfword: if its top five bits are 0b11101, 0b11110 or 0b11111, the instruction is 32 bits long and continues in the next halfword. Anything else is a complete 16-bit instruction.
The Armv8 era also introduced the name T32 for the full Thumb-2 instruction set, and A64 for AArch64. When an Armv8 document says T32, it means what older documents call Thumb-2.
What a Cortex-M executes
Every Cortex-M executes Thumb only. There is no A32 state at all, which is also why the T bit in EPSR must always be set: clearing it would ask for a state the core does not have, and the next instruction fetch raises a fault.
What differs between cores is how much of Thumb-2 they implement:
| Core | Architecture | Instruction set |
|---|---|---|
| Cortex-M0, M0+ | Armv6-M | Thumb, plus a small set of 32-bit instructions: bl, dmb, dsb, isb, mrs, msr |
| Cortex-M3 | Armv7-M | Full Thumb-2 |
| Cortex-M4, M7 | Armv7E-M | Full Thumb-2, plus DSP instructions, optionally an FPU |
| Cortex-M23 | Armv8-M Baseline | Armv6-M plus division and some additions |
| Cortex-M33 | Armv8-M Mainline | Full Thumb-2 plus TrustZone instructions |
The tool you use to pick between them is the -mcpu option, covered in its own post in this series. For this post, the point is that the same source line can assemble to a different number of bytes depending on the core.
Reading the encodings
Take two lines of source:
.syntax unified
.thumb
movs r0, #1
movw r0, #0x1234
bx lrAssembled for a Cortex-M4 and listed with arm-none-eabi-objdump -d, the code section looks like this:
00000000 <.text>:
0: 2001 movs r0, #1
2: f241 2034 movw r0, #4660 @ 0x1234
6: 4770 bx lrThe first instruction is one halfword, 0x2001. The top bits 001 00 select "move immediate" in the 16-bit encoding, 000 names r0 and 0x01 is the constant. The second is two halfwords: 0xF241 starts with 11110, which marks a 32-bit instruction, and 0x2034 completes it. The 16 bits of the constant are split across the instruction, with four bits in the first halfword and the rest in the second, which is why the hex does not read as 1234. The third, bx lr, is the 16-bit 0x4770.
So the stream is 2, 4 and 2 bytes long, at addresses 0, 2 and 6. Instructions are only required to be halfword aligned. That surprises people coming from fixed-width A32, where every instruction sits at a multiple of four.
Why movs and not mov
In pre-UAL Thumb syntax, the 16-bit data-processing instructions always set the condition flags, because the 16-bit encodings of mov, add and friends outside an IT block have no choice. UAL (unified assembler language) makes that visible: you write movs. A 32-bit encoding exists with a choice, so mov.w r0, r1 does not set flags, while movs.w r0, r1 does. If you write mov r0, #1 on a Cortex-M0, the assembler has no flag-preserving encoding to give you and reports an error.
You can force a width yourself with the .n (narrow) and .w (wide) suffixes:
.syntax unified
.thumb
adds.n r0, r0, r1 // must fit the 16-bit encoding or it is an error
adds.w r0, r0, r1 // forces the 32-bit encoding 0: 1840 adds r0, r0, r1
2: eb10 0001 adds.w r0, r0, r1Forcing .w is rarely useful, but when you need two code paths to take the same number of bytes, for example a patched jump table, it is the control you have.
Code density and speed
Mixing 16- and 32-bit instructions is the reason a Cortex-M gets good code density without giving up the instruction set's reach. Do not expect a fixed ratio between Thumb-2 and A32 sizes; it depends on the compiler and the program, and the Arm documentation avoids promising one. Measure with arm-none-eabi-size on your own build.
What the core fetches also shapes timing. A 32-bit instruction that straddles a word boundary can need an additional fetch on some implementations, so cycle counts for the same instruction vary with alignment. The technical reference manual of each core lists its pipeline and cycle timings; the architecture manual does not.
When this does not matter
Most firmware never contains a line of assembly, and the compiler picks encodings for you with -mthumb. It starts to matter when you read a disassembly, when you write an assembly startup file, or when you port code between a Cortex-M and a Cortex-A core running AArch32, where A32 returns as a choice.
Why the instruction width shows up in your own code
Three places in ordinary firmware depend on whether an instruction is 16 or 32 bits wide. The first is branch range. A 16-bit unconditional b reaches about plus or minus 2 KB, a 16-bit conditional b<cond> about plus or minus 256 bytes, and the 32-bit forms reach much farther: plus or minus 16 MB for b.w and bl on Armv7-M. An assembler that finds a target out of range for the narrow form promotes the instruction to the wide one on a Thumb-2 core, and on a Cortex-M0 it reports an error or the linker inserts a veneer. If a build that worked on the M3 fails on the M0, check branch distances first.
The second is alignment of data. Because Thumb instructions are only halfword aligned, a word constant placed after code can land at an address that is not a multiple of four. The assembler adds padding or a nop to restore alignment before a literal pool, which is a source of the odd nop instructions you see in disassembly. They are not mistakes.
The third is patching. If you hot-patch a function by overwriting its first instruction with a branch, you have to know whether that instruction is two or four bytes before you decide how much to replace. Overwriting half of a 32-bit instruction leaves a second halfword that the core now decodes as the start of a new instruction, and the result is usually a fault one fetch later.
What the toolchain flags do
The compiler decides which instruction set to emit from -mthumb and -mcpu. For a Cortex-M the driver defaults to Thumb anyway, but writing -mthumb makes the intent plain in a Makefile. Passing -marm to a Cortex-M target does not produce A32 code that runs: the assembler may accept it for the build, but the core cannot execute it. If a project mixes sources for a Cortex-A and a Cortex-M, keep separate object directories and flags, because the same .S file may need .arm or .thumb directives chosen by the target.


