GCC -mthumb against -marm

13,837

Thumb is not the older instruction-set, but in fact the newer one. The current revision being Thumb-2, which is a mixed 16/32-bit instruction set. The Thumb1 instruction set was a compressed version of the original ARM instruction set. The CPU would fetch the the instruction, decompress it into ARM and then process it. These days (ARMv7 and above), Thumb-2 is preferred for everything but performance critical or system code. For example, GCC will by default generate Thumb2 for ARMv7 (Like your Tegra3), as the higher code density provided by the 16/32-bit ISA allows for better icache utilization. But this is something which is very hard to measure in a normal benchmark, because most benchmarks will fit into the L1 icache anyway.

For more information check the Wikipedia site: http://en.wikipedia.org/wiki/ARM_architecture#Thumb

Share:
13,837

Related videos on Youtube

exbluesbreaker
Author by

exbluesbreaker

Updated on September 15, 2022

Comments

  • exbluesbreaker
    exbluesbreaker over 1 year

    I am working on performance optimizations of ARM C/C++ code, compiled with GCC. CPU is Tegra 3. As I know flags -mthumb means generating old 16-bit Thumb instructions. On different tests, I have 10-15% performance increase with -marm against -mthumb.

    Is -mthumb used only for compatibility and for performance, while -marm is generally better? I am asking because android-cmake used -mthumb in Release mode and -marm in Debug. This is very confusing for me.