MT#56471 add detection for SSE2

Not used at this point

Change-Id: I027a33ba89fb9be8c201ce1109570eb156464ea5
pull/1692/head
Richard Fuchs 2 years ago
parent a5793cbecc
commit ef29dc4af7

@ -1182,18 +1182,22 @@ bool rtpe_has_cpu_flag(enum rtpe_cpu_flag flag) {
if (!done) {
#if defined(__x86_64__)
int32_t ebx_7h0h;
int32_t ebx_7h0h, edx_1h;
__asm (
"mov $1, %%eax" "\n\t"
"cpuid" "\n\t"
"mov %%edx, %1" "\n\t"
"mov $7, %%eax" "\n\t"
"xor %%ecx, %%ecx" "\n\t"
"cpuid" "\n\t"
"mov %%ebx, %0" "\n\t"
: "=rm" (ebx_7h0h)
: "=rm" (ebx_7h0h), "=rm" (edx_1h)
:
: "eax", "ebx", "ecx", "edx"
);
cpu_flags[RTPE_CPU_FLAG_SSE2] = !!(edx_1h & (1L << 26));
cpu_flags[RTPE_CPU_FLAG_AVX2] = !!(ebx_7h0h & (1L << 5));
cpu_flags[RTPE_CPU_FLAG_AVX512BW] = !!(ebx_7h0h & (1L << 30));
cpu_flags[RTPE_CPU_FLAG_AVX512F] = !!(ebx_7h0h & (1L << 16));

@ -65,6 +65,7 @@ enum rtpe_cpu_flag {
RTPE_CPU_FLAG_AVX2 = 0,
RTPE_CPU_FLAG_AVX512BW,
RTPE_CPU_FLAG_AVX512F,
RTPE_CPU_FLAG_SSE2,
__NUM_RTPE_CPU_FLAGS
};

Loading…
Cancel
Save