ObjFW  Check-in [dfe5d16047]

Overview
Comment:Add +[OFSystemInfo supportsFusedMultiplyAdd]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dfe5d160471940268b864a151ea8285b015ee3f25922c2417ba78e47024c544a
User & Date: js on 2023-11-05 10:20:38
Other Links: manifest | tags
Context
2023-11-05
11:22
Update ChangeLog for 1.0.5 check-in: 6cc2844551 user: js tags: trunk
10:20
Add +[OFSystemInfo supportsFusedMultiplyAdd] check-in: dfe5d16047 user: js tags: trunk
2023-11-04
14:43
OFAllocObject: Fix calculation of extra alignment check-in: 648d29a33e user: js tags: trunk
Changes

Modified src/OFSystemInfo.h from [e5c75b40b1] to [8467e18c65].

52
53
54
55
56
57
58

59
60
61
62
63
64
65
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66







+







@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;
@property (class, readonly, nonatomic) bool supportsFusedMultiplyAdd;
@property (class, readonly, nonatomic) bool supportsF16C;
@property (class, readonly, nonatomic) bool supportsAVX512Foundation;
@property (class, readonly, nonatomic)
    bool supportsAVX512ConflictDetectionInstructions;
@property (class, readonly, nonatomic)
    bool supportsAVX512ExponentialAndReciprocalInstructions;
@property (class, readonly, nonatomic) bool supportsAVX512PrefetchInstructions;
338
339
340
341
342
343
344











345
346
347
348
349
350
351
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363







+
+
+
+
+
+
+
+
+
+
+







 *
 * @note This method is only available on AMD64 and x86.
 *
 * @return Whether the CPU supports Intel SHA Extensions
 */
+ (bool)supportsSHAExtensions;

/**
 * @brief Returns whether the CPU supports fused multiply-add.
 *
 * @warning This method only checks CPU support and assumes OS support!
 *
 * @note This method is only available on AMD64 and x86.
 *
 * @return Whether the CPU supports fused multiply-add
 */
+ (bool)supportsFusedMultiplyAdd;

/**
 * @brief Returns whether the CPU supports F16C.
 *
 * @note This method is only available on AMD64 and x86.
 *
 * @return Whether the CPU supports F16C
 */

Modified src/OFSystemInfo.m from [1b9d36f2fa] to [491407fc38].

794
795
796
797
798
799
800





801
802
803
804
805
806
807
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812







+
+
+
+
+







	return (x86CPUID(0, 0).eax >= 1 && x86CPUID(1, 0).ecx & (1u << 25));
}

+ (bool)supportsSHAExtensions
{
	return (x86CPUID(0, 0).eax >= 7 && x86CPUID(7, 0).ebx & (1u << 29));
}

+ (bool)supportsFusedMultiplyAdd
{
	return (x86CPUID(0, 0).eax >= 1 && x86CPUID(1, 0).ecx & (1u << 12));
}

+ (bool)supportsF16C
{
	return (x86CPUID(0, 0).eax >= 1 && x86CPUID(1, 0).ecx & (1u << 29));
}

+ (bool)supportsAVX512Foundation

Modified tests/OFSystemInfoTests.m from [604e506578] to [eb990a02b7].

119
120
121
122
123
124
125




126
127
128
129
130
131
132
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136







+
+
+
+







	    [OFSystemInfo supportsAVX2]];

	[OFStdOut writeFormat: @"[OFSystemInfo] Supports AES-NI: %d\n",
	    [OFSystemInfo supportsAESNI]];

	[OFStdOut writeFormat: @"[OFSystemInfo] Supports SHA extensions: %d\n",
	    [OFSystemInfo supportsSHAExtensions]];

	[OFStdOut writeFormat: @"[OFSystemInfo] Supports fused multiply-add: "
	    @"%d\n",
	    [OFSystemInfo supportsFusedMultiplyAdd]];

	[OFStdOut writeFormat: @"[OFSystemInfo] Supports F16C: %d\n",
	    [OFSystemInfo supportsF16C]];

	[OFStdOut writeFormat:
	    @"[OFSystemInfo] Supports AVX-512 Foundation: %d\n",
	    [OFSystemInfo supportsAVX512Foundation]];