|Non-Confidential||PDF version||ARM DUI0473M|
|Home > Using the Assembler > Instruction width selection in Thumb|
If the assembler can select either a 16-bit or a 32-bit encoding for a Thumb instruction, in general it selects the 16-bit encoding. You can override this by specifying a
.N mnemonic qualifier.
If you are writing Thumb code for ARMv6T2 or later processors, some instructions can have either a 16-bit encoding or a 32-bit encoding.
If you do not specify the instruction size, by default:
For forward reference
instructions, the assembler always generates a 16-bit instruction, even if that results
in failure for a target that could be reached using a 32-bit instruction.
For external reference
B instructions, the assembler
always generates a 32-bit instruction.
In all other cases, the assembler generates the smallest size encoding that can be output.
If you want to override this behavior, you can use the
.N width specifier to ensure a particular instruction size. The assembler
faults if it cannot generate an instruction with the specified width.
.W specifier is ignored when assembling
to ARM code, so you can safely use this specifier in code that might
assemble to either ARM or Thumb code. However, the
is faulted when assembling to ARM code.