Page 1 of 1
THUMB vs. ARM

Posted:
Jan 6, 2002 @ 9:56am
by cryo
Hey,<br><br>as far as i understand, the only reason for using the THUMB instructions in assembler is the higher code density. For speed, one should always go for ARM instructions. <br>Does anyone know if this is generally true or are there exception to this rule? Has someone measured performance vs. code size? The only real problem i see is that a too large rutine in ARM could be small enough if recoded in THUMB to use the cache better. And does a veneer mean a high preformance penalty? What does eVC do, it seems like it always generates ARM, or does it depend on the optimization settings, i.e. if i go for "smallest code" will it use THUMB instead of ARM instructions? <br><br>I guess THUMB is cool for the smaller devices and processors like cell phones and the like, i dont think with modern PDA's having at least 32MB the size of an executable is such a problem.<br><br>thanx in advance, i hope some guru can answer some of this :)<br><br>cryo<br>
Re: THUMB vs. ARM

Posted:
Jan 6, 2002 @ 5:18pm
by Digby
The StrongARM used in the current crop of Pocket PC devices has an ARM V4 core (no Thumb support).<br><br>eVC's ARM compiler supports generation of ARM Thumb instructions via the /QRarch4T switch, however I doubt that this is invoked through the compiler optimizer's flags because it would never produce the proper code in a debug build where the optimizations typically are disabled.<br><br>Realize that although the Thumb instructions are half the size of the ARM instructions, it might take two of them to do what you could do in one of the ARM instructions.<br><br>Code size typically isn't a problem, it's usually data size that gets you in trouble on a handheld device - especially with games. Porting code from the PC can sometimes be a challenge because the Windows programmers have basically no memory restrictions (or at least they seem to code that way). As long as there is free disk space, malloc won't fail.<br><br>I recall some gaming device using Thumb instructions... Does the GameBoy Advance use Thumb instructions?<br><br>
Re: THUMB vs. ARM

Posted:
Jan 6, 2002 @ 5:27pm
by cryo
thanx Digby,<br><br>yeah, the GBA supports both THUMB and ARM instructions. I have read some tutorials on GBA coding and it seems to be possible to jump between ARM and THUMB code areas arbitrarily.<br>BTW: GBA sites are a good source of graphics-oriented ARM assembler source code. I have found to quite useful.<br><br>cryo<br>

Posted:
Mar 28, 2002 @ 12:33am
by Guest
Also--THUMB is much faster for instruction lookup when your memory bus is 16-bit instead of 32-bit (true for many embedded devices.) In this case, each ARM instruction causes an extra 1-read stall, which can be significant on slow devices.

Posted:
Mar 28, 2002 @ 9:28am
by refractor