Here’s another should-read for you all from the fellow who did the introduction to ARM® NEON™ we mentioned earlier:
A few things iOS developers ought to know about the ARM architecture
Note particularly this bit if you did read the previous article and apply it:
If you’ve read my NEON post, you may remember that in that post I also suggested a way to do the detection and selection at runtime. If you check now, you’ll notice I have actually removed that part, and now recommend you do not use that method any more…
But that aside, the most important part (in case you haven’t run across it yet) is Thumb desirability variances:
… ARMv6 Thumb code has access to fewer registers, does not have conditional instructions, and in particular cannot use the floating-point hardware. This means for every single floating-point addition, subtraction, multiplication, etc., floating-point Thumb code must call a system function to do it. Yes, this is as slow as it sounds. For this reason, I recommend disabling Thumb mode when targeting ARMv6…
… When targeting ARMv7, however, all these drawbacks disappear: ARMv7 contains Thumb-2, an extension of the Thumb instruction set which adds support for conditional execution and 32-bit Thumb instructions that allow access to all ARM registers as well as hardware floating-point and NEON. It’s pretty much a free reduction in code size, so it should be left on…
The way that we’ve handled this is that our base .xcconfig file for a universal project compiling with 4.0+ SDK now contains
ARCHS = $(ARCHS_STANDARD_32_BIT)
GCC_THUMB_SUPPORT = YES
GCC_THUMB_SUPPORT[arch=armv6] = NO
Haven’t actually verified with a built executable that indeed those do the right thing, mind you, but it makes the Inspector panel in Xcode look like it’s set up properly, and various combinations of iPhone/iPad targeting projects seem to run ok. Of course, if you have any corrections or elucidations, please share!
h/t: iPhone Development!