kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit de4cbd1052b126c0c6386c913663ee75a175496e
parent d0e448d8c85fce5aebd4f7b0002c5fa493613250
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon, 15 Apr 2019 10:12:45 +0000

Fix cpuid for x86_64

Diffstat:
Minclude/kfr/runtime/cpuid.hpp | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/kfr/runtime/cpuid.hpp b/include/kfr/runtime/cpuid.hpp @@ -115,11 +115,23 @@ struct cpu_data }; #if defined CMT_COMPILER_GNU || defined CMT_COMPILER_CLANG +#if defined __i386__ KFR_INTRINSIC u32 get_cpuid(u32 func, u32 subfunc, u32* eax, u32* ebx, u32* ecx, u32* edx) { __asm__("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "0"(func), "2"(subfunc)); return 1; } +#else +KFR_INTRINSIC u32 get_cpuid(u32 func, u32 subfunc, u32* eax, u32* ebx, u32* ecx, u32* edx) +{ + __asm("xchgq %%rbx,%q1\n" + "cpuid\n" + "xchgq %%rbx,%q1" + : "=a"(*eax), "=r"(*ebx), "=c"(*ecx), "=d"(*edx) + : "0"(func), "2"(subfunc)); + return 1; +} +#endif KFR_INTRINSIC void cpuid(u32* ptr, u32 func, u32 subfunc = 0) { get_cpuid(func, subfunc, &ptr[0], &ptr[1], &ptr[2], &ptr[3]);