]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
cpuinfo/i386: Detect GFNI as an AVX extension
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 5 Aug 2025 01:40:31 +0000 (11:40 +1000)
committerRichard Henderson <richard.henderson@linaro.org>
Thu, 4 Sep 2025 07:49:23 +0000 (09:49 +0200)
We won't use the SSE GFNI instructions, so delay
detection until we know AVX is present.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
host/include/i386/host/cpuinfo.h
include/qemu/cpuid.h
util/cpuinfo-i386.c

index 9541a64da6121f8708da85bebcd6c6db05a6ca53..93d029d499bbc5e2b5d875fb0d05b763bf38381b 100644 (file)
@@ -27,6 +27,7 @@
 #define CPUINFO_ATOMIC_VMOVDQU  (1u << 17)
 #define CPUINFO_AES             (1u << 18)
 #define CPUINFO_PCLMUL          (1u << 19)
+#define CPUINFO_GFNI            (1u << 20)
 
 /* Initialized with a constructor. */
 extern unsigned cpuinfo;
index b11161555b691f3a34d8b4c544e20f5d17a3a7fa..de7a9005096a8aaf2fe731b6f5a64dcbca2708b6 100644 (file)
@@ -68,6 +68,9 @@
 #ifndef bit_AVX512VBMI2
 #define bit_AVX512VBMI2 (1 << 6)
 #endif
+#ifndef bit_GFNI
+#define bit_GFNI        (1 << 8)
+#endif
 
 /* Leaf 0x80000001, %ecx */
 #ifndef bit_LZCNT
index c8c8a1b3705eb7573eec068efb31d21623271179..f4c5b6ff407c9cc8ed9fed0205a91909124fa083 100644 (file)
@@ -50,6 +50,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
             if ((bv & 6) == 6) {
                 info |= CPUINFO_AVX1;
                 info |= (b7 & bit_AVX2 ? CPUINFO_AVX2 : 0);
+                info |= (c7 & bit_GFNI ? CPUINFO_GFNI : 0);
 
                 if ((bv & 0xe0) == 0xe0) {
                     info |= (b7 & bit_AVX512F ? CPUINFO_AVX512F : 0);