Closed dl9sec closed 4 years ago
Try something like this:
#if defined(__x86_64__)
// checkAvxSupport
//
// Tests the underlying platform for AVX support. 2020 needs AVX support
to run
// in real-time, and old processors do not offer AVX support
//
void __cpuid(int* cpuinfo, int info)
{
__asm__ __volatile__(
"xchg %%ebx, %%edi;"
"cpuid;"
"xchg %%ebx, %%edi;"
:"=a" (cpuinfo[0]), "=D" (cpuinfo[1]), "=c" (cpuinfo[2]), "=d"
(cpuinfo[3])
:"0" (info)
);
}
// These methods are defined for Windows but must be created otherwise
unsigned long long __xgetbv(unsigned int index)
{
unsigned int eax, edx;
__asm__ __volatile__(
"xgetbv;"
: "=a" (eax), "=d"(edx)
: "c" (index)
);
return ((unsigned long long)edx << 32) | eax;
}
void MainFrame::checkAvxSupport(void)
{
int cpuinfo[4];
__cpuid(cpuinfo, 1);
bool avxSupported = false;
avxSupported = cpuinfo[2] & (1 << 28) || false;
bool osxsaveSupported = cpuinfo[2] & (1 << 27) || false;
if (osxsaveSupported && avxSupported)
{
// _XCR_XFEATURE_ENABLED_MASK = 0
unsigned long long xcrFeatureMask = __xgetbv(0);
avxSupported = (xcrFeatureMask & 0x6) == 0x6;
}
isAvxPresent = false;
}
#else
void MainFrame::checkAvxSupport(void)
{
isAvxPresent = false;
}
#endif
Great stuff! Thank you very much, builds like a charm now :-D
Regards, Thorsten
Hi,
i tried to build the latest freedv on an Raspberry Pi 3 on Raspbian "Buster". Codec2 and LPCNet seems to build well, but when compiling freedv-gui, the build process stops at about 25% with the following error:
Maybe this part of code isn't supported on ARM targets.
Any solutions how to solve?
Thanks in advance.
Regards, Thorsten