-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added Arm64 feature detections in STL #6067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,8 @@ | |
|
|
||
| #ifdef _M_ARM64 | ||
| #include <arm64_neon.h> | ||
|
|
||
| #include <Windows.h> | ||
| #elif !defined(_M_ARM64EC) | ||
| #include <intrin.h> | ||
| #include <isa_availability.h> | ||
|
|
@@ -54,6 +56,44 @@ namespace { | |
| } | ||
| #endif // ^^^ !defined(_M_ARM64) && !defined(_M_ARM64EC) ^^^ | ||
|
|
||
| #if defined(_M_ARM64) | ||
| bool _Use_FEAT_DotProd() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
|
||
| bool _Use_FEAT_I8MM() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
|
||
| bool _Use_FEAT_SHA3() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
|
||
| bool _Use_FEAT_SVE() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_SVE_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
|
||
| bool _Use_FEAT_SVE2() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
|
||
| bool _Use_FEAT_SVE2p1() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_SVE2_1_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
|
||
| bool _Use_FEAT_SVE_SHA3() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_SVE_SHA3_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
|
||
| bool _Use_FEAT_AES() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_SVE_AES_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
|
Comment on lines
+88
to
+90
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned in the discussion, the cryptography stuff is going to be unused by the STL, but I am fine with merging all of this for now, then we can garbage-collect the unused functions when we have the full suite of STL vectorized algorithms for ARM64 completed. These are helpers in an unnamed namespace, so they can be removed without fear of breaking the import lib's compatibility. |
||
|
|
||
| bool _Use_FEAT_BitPerm() noexcept { | ||
| return IsProcessorFeaturePresent(PF_ARM_SVE_BITPERM_INSTRUCTIONS_AVAILABLE); | ||
| } | ||
| #endif // ^^^ defined(_M_ARM64) ^^^ | ||
|
|
||
| size_t _Byte_length(const void* const _First, const void* const _Last) noexcept { | ||
| return static_cast<const unsigned char*>(_Last) - static_cast<const unsigned char*>(_First); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When creating a new PR, please ensure that your
mainis up to date, and that your feature branch is properly synced. (Ideally, clean commits rebased on top ofmain.) Your branch was relative tomainas of 2025-10-10 which was pretty old for such a fast-moving file asvector_algorithms.cpp. In this case it made no difference, just something to remember for the future!