@@ -296,23 +296,7 @@ void ffCPUDetectByCpuid(FFCPUResult* cpu)
296
296
}
297
297
#elif __APPLE__
298
298
#include <sys/sysctl.h>
299
- #include <arm/cpu_capabilities_public.h>
300
-
301
- #ifndef CAP_BIT_AdvSIMD
302
- #define CAP_BIT_AdvSIMD 49
303
- #endif
304
- #ifndef CAP_BIT_AdvSIMD_HPFPCvt
305
- #define CAP_BIT_AdvSIMD_HPFPCvt 50
306
- #endif
307
- #ifndef CAP_BIT_FEAT_CRC32
308
- #define CAP_BIT_FEAT_CRC32 51
309
- #endif
310
- #ifndef CAP_BIT_FEAT_HBC
311
- #define CAP_BIT_FEAT_HBC 64
312
- #endif
313
- #ifndef CAP_BIT_FEAT_CSSC
314
- #define CAP_BIT_FEAT_CSSC 67
315
- #endif
299
+ // #include <arm/cpu_capabilities_public.h> // Not available in macOS 14-
316
300
317
301
void ffCPUDetectByCpuid (FFCPUResult * cpu )
318
302
{
@@ -328,59 +312,59 @@ void ffCPUDetectByCpuid(FFCPUResult* cpu)
328
312
cpu -> march = "unknown" ;
329
313
330
314
// ARMv8-A
331
- bool has_fp = FF_HAS_CAP (CAP_BIT_AdvSIMD_HPFPCvt ); // Full FP16 support (implies FP/ASIMD)
332
- bool has_asimd = FF_HAS_CAP (CAP_BIT_AdvSIMD ); // Advanced SIMD (NEON)
315
+ bool has_fp = FF_HAS_CAP (50 ); /* CAP_BIT_AdvSIMD_HPFPCvt */ // Full FP16 support (implies FP/ASIMD)
316
+ bool has_asimd = FF_HAS_CAP (49 ); /* CAP_BIT_AdvSIMD */ // Advanced SIMD (NEON)
333
317
334
318
// ARMv8.1-A
335
- bool has_lse = FF_HAS_CAP (CAP_BIT_FEAT_LSE ); // Large System Extensions, optional in v8.0
336
- bool has_crc32 = FF_HAS_CAP (CAP_BIT_FEAT_CRC32 ); // CRC32 instructions, optional in v8.0
337
- bool has_rdm = FF_HAS_CAP (CAP_BIT_FEAT_RDM ); // AdvSIMD rounding double multiply accumulate, optional in v8.0
319
+ bool has_lse = FF_HAS_CAP (6 ); /* CAP_BIT_FEAT_LSE */ // Large System Extensions, optional in v8.0
320
+ bool has_crc32 = FF_HAS_CAP (51 ); /* CAP_BIT_FEAT_CRC32 */ // CRC32 instructions, optional in v8.0
321
+ bool has_rdm = FF_HAS_CAP (5 ); /* CAP_BIT_FEAT_RDM */ // AdvSIMD rounding double multiply accumulate, optional in v8.0
338
322
339
323
// ARMv8.2-A
340
- bool has_fp16 = FF_HAS_CAP (CAP_BIT_FEAT_FP16 ); // Half-precision FP support, optional
341
- bool has_dpb = FF_HAS_CAP (CAP_BIT_FEAT_DPB ); // DC CVAP, optional from v8.1
324
+ bool has_fp16 = FF_HAS_CAP (34 ); /* CAP_BIT_FEAT_FP16 */ // Half-precision FP support, optional
325
+ bool has_dpb = FF_HAS_CAP (22 ); /* CAP_BIT_FEAT_DPB */ // DC CVAP, optional from v8.1
342
326
343
327
// ARMv8.3-A
344
- bool has_pauth = FF_HAS_CAP (CAP_BIT_FEAT_PAuth ); // Pointer Authentication (PAC), optional from v8.2
345
- bool has_lrcpc = FF_HAS_CAP (CAP_BIT_FEAT_LRCPC ); // LDAPR/LR with RCPC semantics, optional from v8.2
346
- bool has_fcma = FF_HAS_CAP (CAP_BIT_FEAT_FCMA ); // Complex number multiply-add, optional from v8.2
347
- bool has_jscvt = FF_HAS_CAP (CAP_BIT_FEAT_JSCVT ); // JavaScript-style conversion (FJCVTZS), optional from v8.2
328
+ bool has_pauth = FF_HAS_CAP (19 ); /* CAP_BIT_FEAT_PAuth */ // Pointer Authentication (PAC), optional from v8.2
329
+ bool has_lrcpc = FF_HAS_CAP (15 ); /* CAP_BIT_FEAT_LRCPC */ // LDAPR/LR with RCPC semantics, optional from v8.2
330
+ bool has_fcma = FF_HAS_CAP (17 ); /* CAP_BIT_FEAT_FCMA */ // Complex number multiply-add, optional from v8.2
331
+ bool has_jscvt = FF_HAS_CAP (18 ); /* CAP_BIT_FEAT_JSCVT */ // JavaScript-style conversion (FJCVTZS), optional from v8.2
348
332
349
333
// ARMv8.4-A
350
- bool has_lse2 = FF_HAS_CAP (CAP_BIT_FEAT_LSE2 ); // Large System Extensions version 2, optional from v8.2
351
- bool has_dit = FF_HAS_CAP (CAP_BIT_FEAT_DIT ); // Data Independent Timing, optional from v8.3
352
- bool has_flagm = FF_HAS_CAP (CAP_BIT_FEAT_FlagM ); // Flag manipulation (FMOV/FCVT), optional from v8.1
353
- bool has_lrcpc2 = FF_HAS_CAP (CAP_BIT_FEAT_LRCPC2 ); // Enhanced RCPC (LDAPUR/LDAPST), optional from v8.2
334
+ bool has_lse2 = FF_HAS_CAP (30 ); /* CAP_BIT_FEAT_LSE2 */ // Large System Extensions version 2, optional from v8.2
335
+ bool has_dit = FF_HAS_CAP (33 ); /* CAP_BIT_FEAT_DIT */ // Data Independent Timing, optional from v8.3
336
+ bool has_flagm = FF_HAS_CAP (0 ); /* CAP_BIT_FEAT_FlagM */ // Flag manipulation (FMOV/FCVT), optional from v8.1
337
+ bool has_lrcpc2 = FF_HAS_CAP (16 ); /* CAP_BIT_FEAT_LRCPC2 */ // Enhanced RCPC (LDAPUR/LDAPST), optional from v8.2
354
338
355
339
// ARMv8.5-A
356
- bool has_bti = FF_HAS_CAP (CAP_BIT_FEAT_BTI ); // Branch Target Identification, optional from v8.4
357
- bool has_sb = FF_HAS_CAP (CAP_BIT_FEAT_SB ); // Speculative Barrier, optional from v8.0
358
- bool has_dpb2 = FF_HAS_CAP (CAP_BIT_FEAT_DPB2 ); // DC CVADP (DPB2), optional from v8.1
359
- bool has_flagm2 = FF_HAS_CAP (CAP_BIT_FEAT_FlagM2 ); // Enhanced FlagM, optional from v8.4
360
- bool has_frintts = FF_HAS_CAP (CAP_BIT_FEAT_FRINTTS ); // Floating-point to integer instructions, optional from v8.4
340
+ bool has_bti = FF_HAS_CAP (36 ); /* CAP_BIT_FEAT_BTI */ // Branch Target Identification, optional from v8.4
341
+ bool has_sb = FF_HAS_CAP (13 ); /* CAP_BIT_FEAT_SB */ // Speculative Barrier, optional from v8.0
342
+ bool has_dpb2 = FF_HAS_CAP (23 ); /* CAP_BIT_FEAT_DPB2 */ // DC CVADP (DPB2), optional from v8.1
343
+ bool has_flagm2 = FF_HAS_CAP (1 ); /* CAP_BIT_FEAT_FlagM2 */ // Enhanced FlagM, optional from v8.4
344
+ bool has_frintts = FF_HAS_CAP (14 ); /* CAP_BIT_FEAT_FRINTTS */ // Floating-point to integer instructions, optional from v8.4
361
345
362
346
// ARMv9.0-A
363
- bool has_sve2 = false; // Not exposed and not supported by Apple M4
347
+ bool has_sve2 = false; // Not exposed and not supported by Apple M4
364
348
365
349
// ARMv9.1-A
366
350
// ARMv8.6-A
367
- bool has_bf16 = FF_HAS_CAP (CAP_BIT_FEAT_BF16 ); // Brain float16, optional from v8.2
368
- bool has_i8mm = FF_HAS_CAP (CAP_BIT_FEAT_I8MM ); // Int8 Matrix Multiply, optional from v8.1
351
+ bool has_bf16 = FF_HAS_CAP (24 ); /* CAP_BIT_FEAT_BF16 */ // Brain float16, optional from v8.2
352
+ bool has_i8mm = FF_HAS_CAP (25 ); /* CAP_BIT_FEAT_I8MM */ // Int8 Matrix Multiply, optional from v8.1
369
353
370
354
// ARMv8.7-A
371
- bool has_afp = FF_HAS_CAP (CAP_BIT_FEAT_AFP ); // Alternate FP16 (FEXPA), optional from v8.6
355
+ bool has_afp = FF_HAS_CAP (29 ); /* CAP_BIT_FEAT_AFP */ // Alternate FP16 (FEXPA), optional from v8.6
372
356
373
357
// ARMv9.2-A
374
- bool has_sme = FF_HAS_CAP (CAP_BIT_FEAT_SME ); // Scalable Matrix Extension, optional from v9.2
358
+ bool has_sme = FF_HAS_CAP (40 ); /* CAP_BIT_FEAT_SME */ // Scalable Matrix Extension, optional from v9.2
375
359
376
360
// ARMv9.3-A
377
- bool has_sme2 = FF_HAS_CAP (CAP_BIT_FEAT_SME2 ); // SME2, optional from v9.2
361
+ bool has_sme2 = FF_HAS_CAP (41 ); /* CAP_BIT_FEAT_SME2 */ // SME2, optional from v9.2
378
362
379
363
// ARMv8.8-A
380
- bool has_hbc = FF_HAS_CAP (CAP_BIT_FEAT_HBC ); // Hinted conditional branches, optional from v8.7
364
+ bool has_hbc = FF_HAS_CAP (64 ); /* CAP_BIT_FEAT_HBC */ // Hinted conditional branches, optional from v8.7
381
365
382
366
// ARMv8.9-A
383
- bool has_cssc = FF_HAS_CAP (CAP_BIT_FEAT_CSSC ); // Common Short String Compare, optional from v8.7
367
+ bool has_cssc = FF_HAS_CAP (67 ); /* CAP_BIT_FEAT_CSSC */ // Common Short String Compare, optional from v8.7
384
368
385
369
// ARMv9.4-A+ are not exposed yet
386
370
0 commit comments