ARM Thumb ISA

Hi,

sorry, when this is off-topic but I didn't really know what other newsgroup to use. A general question on the instruction set of the ARM processor:

Many of the ARM processors provide a normal ISA (32-bit) as well as an compressed 16-bit ISA (Thumb mode). It's obvious that the Thumb instructions are smaller than the

32-bit instructions resulting in a smaller program code if merely the Thumb instructions are used. What about the runtime of a program. Is a program, in general, slower or faster when constructed from instructions of one ISA? If so, why?

Thank you. Chris

Reply to
Christian Christmann
Loading thread data ...

This question is entirely on-topic for comp.arch.embedded.

It's impossible to generalize about this because it's system-dependent. ARM publishes metrics on speed vs. size for Thumb vs. 32-bit code. If I recall correctly, the rough number is 60% of the speed with a 25% improvement in code density. However, the situation is affected by memory bus width and speed. If you are running out of 16-bit memory (quite a few low-end ARM parts only have 16-bit external data buses) and/or slow flash memory, Thumb's speed numbers may be significantly better because the memory subsystem isn't being called upon for the same throughput.

Reply to
larwe

Cross-posted to comp.arch.embedded, and follow-ups set. You will get much better answers there.

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 Click to see the full signature
Reply to
CBFalconer

For the specific case of ARM if you have a 32 bit memory subsystem with sufficent bandwith ARM will always be faster than Thumb 1. In short this is because there are things that can be done in one ARM instruction that require more than one Thumb instruction.

If you have a 16 bit memory subsystem then Thumb is almost always faster as it would take twice as long to to fetch a 32 bit ARM instruction.

The situation is more complicated for Thumb2 due to having both 32 bit and

16 bit instructions. However in general you get the best of both worlds with the code size of Thumb and the speed of ARM.

In the general the choice of ISA dictates the requirements for memory bandwidth and piplining for the implementation. You have to consider both ISA and implementation. You can see from the market a theoretically nasty ISA with a highly optimal implementation can perform much better than theoretically cleaner ISA with a suboptimal implementation.

-p

--
 "What goes up must come down, ask any system administrator"
--------------------------------------------------------------------
Reply to
Paul Gotch

Has anyone done a study of using a mix of ARM and Thumb instructions? It would seem that Thumb performance would be as good as ARM for mundane situations at a smaller code size and then switch to ARM for more critical areas.

Reply to
Everett M. Greene

Yes. If your application spends most of the time in a small amount of code then you can compile that to ARM. You then essentially get the codesize of Thumb and the performance of ARM. It is difficult to achieve in reality though...

For example, it may not be easy to find the critical code, there may be too much of it to copy to fast SRAM, or the application doesn't have a good split between performance critical code and the rest. Also, with ARM7tdmi you need to enable interworking if you mix ARM and Thumb, and this costs a few percent codesize and performance (this is solved in architecture v5T). Finally not all compilers support compilation of individual functions to either ARM or Thumb, so you may have to restructure your sources in some cases.

So although you can achieve good results on a well-behaved application, you have to work at it (some compilers have a utility that helps making the ARM vs Thumb decision based on profiling runs, but it is hard to take the effect of interworking veneers into account). With the current pressures to get to the market quickly, many choose either ARM-only or Thumb-mostly. This is one reason why Thumb-2 was invented, it avoids the need to make these tradeoffs by combining the best of Thumb with the best of ARM.

Wilco

Reply to
Wilco Dijkstra

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.