diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-04-16 14:52:15 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-04-16 16:31:30 +0200 |
commit | bf320a3d0f5c526f0d96551681c37e20b3f44efb (patch) | |
tree | 9e6b725c583ff4ccd306066291b4c57042ba8a66 | |
parent | c6361b600df58ad1c20c6e45384f408543dcf5c2 (diff) |
cpu: add AVX512 support
-rw-r--r-- | cpu.c | 2 | ||||
-rw-r--r-- | cpu.h | 1 | ||||
-rw-r--r-- | util.asm | 4 |
3 files changed, 6 insertions, 1 deletions
@@ -76,6 +76,8 @@ static int get_cpu_flags_x86(void) if (ebx & 0x00000100) rval |= MG2DI_CPU_FLAG_BMI2; } + if ((ebx & 0xD0030000) == 0xD0030000) + rval |= MG2DI_CPU_FLAG_AVX512; } mg2di_cpu_cpuid(0x80000000, &max_ext_level, &ebx, &ecx, &edx); @@ -43,6 +43,7 @@ #define MG2DI_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions #define MG2DI_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 #define MG2DI_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 +#define MG2DI_CPU_FLAG_AVX512 (1<<16) int mg2di_cpu_flags_get(void); @@ -29,7 +29,9 @@ %error Invalid selector %3 %endif - %if mmsize == 32 && cpuflag(avx2) + %if mmsize == 64 && cpuflag(avx512) + vbroadcastsd %1, %2 + %elif mmsize == 32 && cpuflag(avx2) vpermpd %1, %2, _IMM8SPLAT2B(%3) %elif mmsize == 32 && cpuflag(avx) shufpd %1, %2, %2, _IMM4SPLAT1B(%3 & 1) |