Index: src/OFSystemInfo.h ================================================================== --- src/OFSystemInfo.h +++ src/OFSystemInfo.h @@ -54,10 +54,11 @@ @property (class, readonly, nonatomic) bool supportsSSE42; @property (class, readonly, nonatomic) bool supportsAVX; @property (class, readonly, nonatomic) bool supportsAVX2; @property (class, readonly, nonatomic) bool supportsAESNI; @property (class, readonly, nonatomic) bool supportsSHAExtensions; +@property (class, readonly, nonatomic) bool supportsF16C; @property (class, readonly, nonatomic) bool supportsAVX512Foundation; @property (class, readonly, nonatomic) bool supportsAVX512ConflictDetectionInstructions; @property (class, readonly, nonatomic) bool supportsAVX512ExponentialAndReciprocalInstructions; @@ -77,10 +78,12 @@ @property (class, readonly, nonatomic) bool supportsAVX512VectorNeuralNetworkInstructions; @property (class, readonly, nonatomic) bool supportsAVX512VectorByteManipulationInstructions2; @property (class, readonly, nonatomic) bool supportsAVX512BitAlgorithms; +@property (class, readonly, nonatomic) bool supportsAVX512Float16Instructions; +@property (class, readonly, nonatomic) bool supportsAVX512BFloat16Instructions; # endif # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsAltiVec; # endif # if defined(OF_WINDOWS) || defined(DOXYGEN) @@ -337,10 +340,19 @@ * * @return Whether the CPU supports Intel SHA Extensions */ + (bool)supportsSHAExtensions; +/** + * @brief Returns whether the CPU supports F16C. + * + * @note This method is only available on AMD64 and x86. + * + * @return Whether the CPU supports F16C + */ ++ (bool)supportsF16C; + /** * @brief Returns whether the CPU supports AVX-512 Foundation. * * @note This method is only available on AMD64 and x86. * @@ -464,10 +476,28 @@ * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports AVX-512 Bit Algorithms */ + (bool)supportsAVX512BitAlgorithms; + +/** + * @brief Returns whether the CPU supports AVX-512 Float16 Instructions. + * + * @note This method is only available on AMD64 and x86. + * + * @return Whether the CPU supports AVX-512 Float16 Instructions + */ ++ (bool)supportsAVX512Float16Instructions; + +/** + * @brief Returns whether the CPU supports AVX-512 BFloat16 Instructions. + * + * @note This method is only available on AMD64 and x86. + * + * @return Whether the CPU supports AVX-512 BFloat16 Instructions + */ ++ (bool)supportsAVX512BFloat16Instructions; #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN) /** * @brief Returns whether the CPU and OS support AltiVec. Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -737,16 +737,18 @@ return (x86CPUID(0, 0).eax >= 1 && x86CPUID(1, 0).edx & (1u << 23)); } + (bool)supports3DNow { - return (x86CPUID(0x80000001, 0).edx & (1u << 31)); + return (x86CPUID(0x80000000, 0).eax >= 0x80000001 && + x86CPUID(0x80000001, 0).edx & (1u << 31)); } + (bool)supportsEnhanced3DNow { - return (x86CPUID(0x80000001, 0).edx & (1u << 30)); + return (x86CPUID(0x80000000, 0).eax >= 0x80000001 && + x86CPUID(0x80000001, 0).edx & (1u << 30)); } + (bool)supportsSSE { return (x86CPUID(0, 0).eax >= 1 && x86CPUID(1, 0).edx & (1u << 25)); @@ -794,10 +796,15 @@ + (bool)supportsSHAExtensions { return (x86CPUID(0, 0).eax >= 7 && x86CPUID(7, 0).ebx & (1u << 29)); } + ++ (bool)supportsF16C +{ + return (x86CPUID(0, 0).eax >= 1 && x86CPUID(1, 0).ecx & (1u << 29)); +} + (bool)supportsAVX512Foundation { return (x86CPUID(0, 0).eax >= 7 && x86CPUID(7, 0).ebx & (1u << 16)); } @@ -859,10 +866,20 @@ + (bool)supportsAVX512BitAlgorithms { return (x86CPUID(0, 0).eax >= 7 && x86CPUID(7, 0).ecx & (1u << 12)); } + ++ (bool)supportsAVX512Float16Instructions +{ + return (x86CPUID(0, 0).eax >= 7 && x86CPUID(7, 0).edx & (1u << 23)); +} + ++ (bool)supportsAVX512BFloat16Instructions +{ + return (x86CPUID(0, 0).eax >= 7 && x86CPUID(7, 1).eax & (1u << 5)); +} #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) + (bool)supportsAltiVec { Index: tests/OFSystemInfoTests.m ================================================================== --- tests/OFSystemInfoTests.m +++ tests/OFSystemInfoTests.m @@ -122,10 +122,13 @@ [OFSystemInfo supportsAESNI]]; [OFStdOut writeFormat: @"[OFSystemInfo] Supports SHA extensions: %d\n", [OFSystemInfo supportsSHAExtensions]]; + [OFStdOut writeFormat: @"[OFSystemInfo] Supports F16C: %d\n", + [OFSystemInfo supportsF16C]]; + [OFStdOut writeFormat: @"[OFSystemInfo] Supports AVX-512 Foundation: %d\n", [OFSystemInfo supportsAVX512Foundation]]; [OFStdOut writeFormat: @@ -180,10 +183,18 @@ [OFSystemInfo supportsAVX512VectorByteManipulationInstructions2]]; [OFStdOut writeFormat: @"[OFSystemInfo] Supports AVX-512 Bit Algorithms: %d\n", [OFSystemInfo supportsAVX512BitAlgorithms]]; + + [OFStdOut writeFormat: + @"[OFSystemInfo] Supports AVX-512 Float16 Instructions: %d\n", + [OFSystemInfo supportsAVX512Float16Instructions]]; + + [OFStdOut writeFormat: + @"[OFSystemInfo] Supports AVX-512 BFloat16 Instructions: %d\n", + [OFSystemInfo supportsAVX512BFloat16Instructions]]; #endif #ifdef OF_POWERPC [OFStdOut writeFormat: @"[OFSystemInfo] Supports AltiVec: %d\n", [OFSystemInfo supportsAltiVec]];