util/loongarch64: Detect LASX vector support

Reviewed-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-05-27 17:18:20 +00:00
parent 1c05d53baf
commit 9d779187b8
2 changed files with 2 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#define CPUINFO_ALWAYS (1u << 0) /* so cpuinfo is nonzero */
#define CPUINFO_LSX (1u << 1)
#define CPUINFO_LASX (1u << 2)
/* Initialized with a constructor. */
extern unsigned cpuinfo;

View File

@ -29,6 +29,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
info = CPUINFO_ALWAYS;
info |= (hwcap & HWCAP_LOONGARCH_LSX ? CPUINFO_LSX : 0);
info |= (hwcap & HWCAP_LOONGARCH_LASX ? CPUINFO_LASX : 0);
cpuinfo = info;
return info;