<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div>On Jan 8, 2015, at 2:33 PM, Tom Hughes &lt;<a href="mailto:tom@airtime.com">tom@airtime.com</a>&gt; wrote:</div>
<div><br class="Apple-interchange-newline">
<blockquote type="cite">
<div dir="ltr">This adds run-time CPU detection for iOS devices. I found this page useful for CPU support and models:
<a href="http://iossupportmatrix.com/">http://iossupportmatrix.com/</a>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Tom</div>
</div>
</blockquote>
<br>
<div>Every armv7 (and armv8) iOS device has supported Neon, and Xcode support for armv6 was dropped with Xcode 4.5.</div>
<div><br>
</div>
<div>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). &nbsp;I think the arch can be detected based on on preprocessor defines, though I can’t
 find the specific settings offhand.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>So my inclination would be to just always set OPUS_CPU_ARM_NEON on iOS/arm.</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>unsigned int hasNeon;</div>
<div>size_t length = sizeof(hasNeon);</div>
<div>if (sysctlbyname(&quot;hw.optional.neon&quot;, &amp;hasNeon, &amp;length, NULL, 0) != 0)</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>hasNeon = 0;</div>
</div>
</body>
</html>