This adds run-time CPU detection for iOS devices. I found this page useful for CPU support and models: http://iossupportmatrix.com/ The patch could be simplified to just set the OPUS_CPU_ARM_NEON flag if you think it's unlikely that anyone would be running on the really old devices that don't support NEON. Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/opus/attachments/20150108/65653d3c/attachment.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-ARM-cpu-detection-for-iDevices.patch Type: application/octet-stream Size: 2134 bytes Desc: not available Url : http://lists.xiph.org/pipermail/opus/attachments/20150108/65653d3c/attachment.obj
On Jan 8, 2015, at 2:33 PM, Tom Hughes <tom at airtime.com<mailto:tom at airtime.com>> wrote: This adds run-time CPU detection for iOS devices. I found this page useful for CPU support and models: http://iossupportmatrix.com/ The patch could be simplified to just set the OPUS_CPU_ARM_NEON flag if you think it's unlikely that anyone would be running on the really old devices that don't support NEON. Tom 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. That said, since Apple is going (very soon) to require arm64 in all apps submitted through the App Store, and no Xcode version supported both armv6 and arm64, I don?t know how useful this would be. So my inclination would be to just always set OPUS_CPU_ARM_NEON on iOS/arm. That said, if we do want to support runtime Neon detection on iOS, rather than checking hardware models I believe the semantically-correct way to do this is to check ?hw.optional.neon? using sysctlbyname(), as in: unsigned int hasNeon; size_t length = sizeof(hasNeon); if (sysctlbyname("hw.optional.neon", &hasNeon, &length, NULL, 0) != 0) hasNeon = 0; -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/opus/attachments/20150108/4ab7c6ad/attachment.htm
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
Maybe Matching Threads
- [RFC PATCHv1] cover: celt_pitch_xcorr: Introduce ARM neon intrinsics
- [Aarch64 v2 02/18] Reorganize ARM CPU #ifdefs.
- [RFC PATCHv1] armv7: celt_pitch_xcorr: Introduce ARM neon intrinsics
- [PATCH 12/15] Replace call of celt_inner_prod_c() (step 1)
- [PATCH v1] cover: armv7: celt_pitch_xcorr: Introduce ARM neon intrinsics