MCPcopy Create free account
hub / github.com/numpy/numpy / npy__cpu_cpuid

Function npy__cpu_cpuid

numpy/core/src/common/npy_cpu_features.c:393–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393static void
394npy__cpu_cpuid(int reg[4], int func_id)
395{
396#if defined(_MSC_VER)
397 __cpuidex(reg, func_id, 0);
398#elif defined(__INTEL_COMPILER)
399 __cpuid(reg, func_id);
400#elif defined(__GNUC__) || defined(__clang__)
401 #if defined(NPY_CPU_X86) && defined(__PIC__)
402 // %ebx may be the PIC register
403 __asm__("xchg{l}\t{%%}ebx, %1\n\t"
404 "cpuid\n\t"
405 "xchg{l}\t{%%}ebx, %1\n\t"
406 : "=a" (reg[0]), "=r" (reg[1]), "=c" (reg[2]),
407 "=d" (reg[3])
408 : "a" (func_id), "c" (0)
409 );
410 #else
411 __asm__("cpuid\n\t"
412 : "=a" (reg[0]), "=b" (reg[1]), "=c" (reg[2]),
413 "=d" (reg[3])
414 : "a" (func_id), "c" (0)
415 );
416 #endif
417#else
418 reg[0] = 0;
419#endif
420}
421
422static void
423npy__cpu_init_features(void)

Callers 1

npy__cpu_init_featuresFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected