Overview
Comment: | Add +[OFSystemInfo supports{AESNI,SHAExtensions}] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4c19f80ab002c0223c284741734967d6 |
User & Date: | js on 2019-09-14 23:24:18 |
Other Links: | manifest | tags |
Context
2019-09-29
| ||
15:28 | Update version to 1.1-dev now that 1.0 is branched check-in: 965f88ff1e user: js tags: trunk | |
15:17 | Branch for 1.0 check-in: 27626892ce user: js tags: 1.0 | |
2019-09-14
| ||
23:24 | Add +[OFSystemInfo supports{AESNI,SHAExtensions}] check-in: 4c19f80ab0 user: js tags: trunk | |
2019-09-07
| ||
23:33 | ofhttp: Fix error code not always being set check-in: 9764b0886f user: js tags: trunk | |
Changes
Modified src/OFSystemInfo.h from [e2aaa262d3] to [147dae58c0].
︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | @property (class, readonly, nonatomic) bool supportsSSE2; @property (class, readonly, nonatomic) bool supportsSSE3; @property (class, readonly, nonatomic) bool supportsSSSE3; @property (class, readonly, nonatomic) bool supportsSSE41; @property (class, readonly, nonatomic) bool supportsSSE42; @property (class, readonly, nonatomic) bool supportsAVX; @property (class, readonly, nonatomic) bool supportsAVX2; # endif # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsAltiVec; # endif #endif /*! | > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | @property (class, readonly, nonatomic) bool supportsSSE2; @property (class, readonly, nonatomic) bool supportsSSE3; @property (class, readonly, nonatomic) bool supportsSSSE3; @property (class, readonly, nonatomic) bool supportsSSE41; @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; # endif # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsAltiVec; # endif #endif /*! |
︙ | ︙ | |||
249 250 251 252 253 254 255 256 257 258 259 260 261 262 | * @warning This method only checks CPU support and assumes OS support! * * @note This method is only available on x86 and x86_64. * * @return Whether the CPU supports AVX2 */ + (bool)supportsAVX2; #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) /*! * @brief Returns whether the CPU and OS support AltiVec. * * @note This method is only available on PowerPC and PowerPC 64. | > > > > > > > > > > > > > > > > > > | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | * @warning This method only checks CPU support and assumes OS support! * * @note This method is only available on x86 and x86_64. * * @return Whether the CPU supports AVX2 */ + (bool)supportsAVX2; /*! * @brief Returns whether the CPU supports AES-NI. * * @note This method is only available on x86 and x86_64. * * @return Whether the CPU supports AES-NI */ + (bool)supportsAESNI; /*! * @brief Returns whether the CPU supports Intel SHA Extensions. * * @note This method is only available on x86 and x86_64. * * @return Whether the CPU supports Intel SHA Extensions */ + (bool)supportsSHAExtensions; #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) /*! * @brief Returns whether the CPU and OS support AltiVec. * * @note This method is only available on PowerPC and PowerPC 64. |
︙ | ︙ |
Modified src/OFSystemInfo.m from [9552eef440] to [fe648ccbbc].
︙ | ︙ | |||
622 623 624 625 626 627 628 629 630 631 632 633 634 635 | return (x86_cpuid(1, 0).ecx & (1u << 28)); } + (bool)supportsAVX2 { return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1u << 5)); } #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) + (bool)supportsAltiVec { # if defined(OF_MACOS) int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0; | > > > > > > > > > > | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | return (x86_cpuid(1, 0).ecx & (1u << 28)); } + (bool)supportsAVX2 { return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1u << 5)); } + (bool)supportsAESNI { return (x86_cpuid(1, 0).ecx & (1u << 25)); } + (bool)supportsSHAExtensions { return (x86_cpuid(7, 0).ebx & (1u << 29)); } #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) + (bool)supportsAltiVec { # if defined(OF_MACOS) int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0; |
︙ | ︙ | |||
645 646 647 648 649 650 651 | return (vectorUnit == VECTORTYPE_ALTIVEC); # elif defined(OF_MORPHOS) uint32_t supportsAltiVec; if (NewGetSystemAttrs(&supportsAltiVec, sizeof(supportsAltiVec), SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE) > 0) return supportsAltiVec; | < < | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | return (vectorUnit == VECTORTYPE_ALTIVEC); # elif defined(OF_MORPHOS) uint32_t supportsAltiVec; if (NewGetSystemAttrs(&supportsAltiVec, sizeof(supportsAltiVec), SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE) > 0) return supportsAltiVec; # endif return false; } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } @end |
Modified tests/OFSystemInfoTests.m from [98cec1ab7b] to [96bd962194].
︙ | ︙ | |||
81 82 83 84 85 86 87 88 89 90 91 92 93 94 | PRINT(GREEN, @"Supports SSE4.1: %d", [OFSystemInfo supportsSSE41]); PRINT(GREEN, @"Supports SSE4.2: %d", [OFSystemInfo supportsSSE42]); PRINT(GREEN, @"Supports AVX: %d", [OFSystemInfo supportsAVX]); PRINT(GREEN, @"Supports AVX2: %d", [OFSystemInfo supportsAVX2]); #endif #ifdef OF_POWERPC PRINT(GREEN, @"Supports AltiVec: %d", [OFSystemInfo supportsAltiVec]); #endif [pool drain]; | > > > > > | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | PRINT(GREEN, @"Supports SSE4.1: %d", [OFSystemInfo supportsSSE41]); PRINT(GREEN, @"Supports SSE4.2: %d", [OFSystemInfo supportsSSE42]); PRINT(GREEN, @"Supports AVX: %d", [OFSystemInfo supportsAVX]); PRINT(GREEN, @"Supports AVX2: %d", [OFSystemInfo supportsAVX2]); PRINT(GREEN, @"Supports AES-NI: %d", [OFSystemInfo supportsAESNI]); PRINT(GREEN, @"Supports SHA extensions: %d", [OFSystemInfo supportsSHAExtensions]); #endif #ifdef OF_POWERPC PRINT(GREEN, @"Supports AltiVec: %d", [OFSystemInfo supportsAltiVec]); #endif [pool drain]; |
︙ | ︙ |