Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description:
This PR replaces the stub
// TODOimplementations inTArmSimdFeatureswith real, cross-platform ARM hardware capability detection, enabling runtime SIMD dispatch on ARM targets.New Units
HlpArmHwCapProvider— Platform-abstracted ARM HWCAP provider:getauxvalviadlsymto queryAT_HWCAP/AT_HWCAP2elf_aux_info/_elf_aux_infoviadlsymIsProcessorFeaturePresentforPF_ARM_V8_*constantsHlpDarwinSysCtl— Darwin-specific (macOS/iOS) feature detection viasysctlbyname, resolved dynamically throughdlsym. Supports modernFEAT_*sysctl keys (macOS 12+) with automatic fallback to legacy keys (macOS 11).Changes to Existing Units
HlpArmSimdFeatures— AllCPUHas*methods now contain real detection logic for NEON, AES, SHA1, SHA256, SHA512, SHA3, PMULL, SVE, and SVE2. AddedCPUHasCRC32/HasCRC32for CRC32 instruction detection.HlpX86SimdFeatures— RenamedFSimdLevel→FActiveSimdLevelandGetSimdLevel()→GetActiveSimdLevel()for consistency and clarity.HlpCpuFeatures—TCpuFeatures.X86andTCpuFeatures.Armproperties are now conditionally compiled underHASHLIB_X86/HASHLIB_ARMrespectively, so only the relevant architecture code is included in each build.Include files (
HashLib.inc,HashLibFPC.inc):HASHLIB_ARM(which previously meant ARM32) toHASHLIB_ARM32andHASHLIB_ARM_ASMtoHASHLIB_ARM32_ASMto avoid ambiguityHASHLIB_X86(= I386 or X86_64) andHASHLIB_ARM(= ARM32 or AArch64) as architecture-family definesAll dispatch units (
HlpAdler32Dispatch,HlpCRCDispatch,HlpBlake2BDispatch,HlpBlake2SDispatch,HlpBlake3Dispatch,HlpSHA1Dispatch,HlpSHA2_256Dispatch,HlpSHA2_512Dispatch,HlpSHA3Dispatch,HlpXXHash3Dispatch,HlpArgon2Dispatch,HlpScryptDispatch) — Updated to callGetActiveSimdLevel()instead ofGetSimdLevel().Design Notes
dlopen(nil)+dlsymat runtime, avoiding hard static imports and gracefully degrading when symbols are unavailable.HWCAP2while AArch64 usesHWCAP) are handled via conditional compilation.PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLEbundles AES, PMULL, SHA1, and SHA256 together per Microsoft's documentation. SHA3/SHA512 use the newerPF_ARM_V82_*constants.