[opus] [PATCH] Add ARM cpu detection for iDevices

Martin Storsjö martin at martin.st
Thu Jan 8 12:48:28 PST 2015


On Thu, 8 Jan 2015, Jonathan Lennox wrote:

> Every armv7 (and armv8) iOS device has supported Neon, and Xcode support for
> armv6 was dropped with Xcode 4.5.
> 
> Even if you’re compiling with an old Xcode version to support really old iOS
> devices, Apple’s armv6/armv7 selection was a compile-time switch (supported
> using fat binaries).  I think the arch can be detected based on on
> preprocessor defines, though I can’t find the specific settings offhand.

You can use e.g. the define __ARM_NEON__ - it is defined in apple 
toolchains when targeting both armv7 and arm64. Likewise, when the 
compiler is building code for armv7 it will use neon instructions in 
normal C codepaths as well (if it finds it useful).

So the only even theoretical use for runtime detection on iOS would be 
trying to include NEON instruction codepaths in armv6 slices, but there's 
little reason for that, and you can't probably even submit such binaries 
to appstore any longer even if you'd have an old xcode version around.

Thus, I wholeheartedly agree that there is no point in runtime detection 
for this on iOS - checking the __ARM_NEON__ define at compile time is 
enough.

// Martin


More information about the opus mailing list