|Home > Compiler Command-line Options > -mthumb|
Requests that the compiler targets the T32 instruction set.
Most Arm®v7‑A (and earlier) processors support two instruction sets. These are the A32 instruction set (formerly ARM), and the T32 instruction set (formerly Thumb). Armv8‑A processors in AArch32 state continue to support these two instruction sets, but with additional instructions. The Armv8‑A processors additionally introduce the A64 instruction set, used in the AArch64 execution state.
Different architectures support different instruction sets:
-mthumboption is not valid for targets in AArch64 state, for example
--target=aarch64-arm-none-eabi. The compiler ignores the
-mthumboption and generates a warning when compiling for a target in AArch64 state.
-mthumboption is recognized when using armclang as a compiler, but not when using it as an assembler. To request armclang to assemble using the T32 instruction set for your assembly source files, you must use the
.code 16directive in the assembly files.
The default for all targets that support A32 instructions is
armclang -c --target=arm-arm-none-eabi -march=armv8-a -mthumb test.c