cpufeatures: Support dynamic feature detection on iOS and derivative platforms #848
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for dynamic feature detection on iOS, watchOS, and tvOS, bringing full support to all of Apple's platforms and following up #435.
I'm not entirely sure what the previous comment about lack of
sysctl(3)
support meant, FWIW. iOS supports the same kernel calls that macOS does (for the most part, but especially low-level ones like this) because they're based on the same kernel and, more importantly, the function appears in the public headers inside each platform's SDK.To confirm/prove that there wasn't any problematic filtering occurring on iOS, I ran these changes on both the iOS simulator and on a real device (iPad Pro 3rd gen). The results make sense AFAICT because this specific model runs a full-fledged M1 processor in it.
Test code:
Results in iOS simulator:
Results on physical device: