util: Add i386 CPUINFO_ATOMIC_VMOVDQU

Add a bit to indicate when VMOVDQU is also atomic if aligned.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2023-05-17 21:16:05 -07:00
parent 6bc12fd042
commit a48b6afea4
2 changed files with 4 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#define CPUINFO_AVX512DQ (1u << 14) #define CPUINFO_AVX512DQ (1u << 14)
#define CPUINFO_AVX512VBMI2 (1u << 15) #define CPUINFO_AVX512VBMI2 (1u << 15)
#define CPUINFO_ATOMIC_VMOVDQA (1u << 16) #define CPUINFO_ATOMIC_VMOVDQA (1u << 16)
#define CPUINFO_ATOMIC_VMOVDQU (1u << 17)
/* Initialized with a constructor. */ /* Initialized with a constructor. */
extern unsigned cpuinfo; extern unsigned cpuinfo;

View File

@ -77,8 +77,10 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688 * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688
*/ */
__cpuid(0, a, b, c, d); __cpuid(0, a, b, c, d);
if (c == signature_INTEL_ecx || c == signature_AMD_ecx) { if (c == signature_INTEL_ecx) {
info |= CPUINFO_ATOMIC_VMOVDQA; info |= CPUINFO_ATOMIC_VMOVDQA;
} else if (c == signature_AMD_ecx) {
info |= CPUINFO_ATOMIC_VMOVDQA | CPUINFO_ATOMIC_VMOVDQU;
} }
} }
} }