在 2025/10/16 下午5:39, Xi Ruoyao 写道:
On Thu, 2025-10-16 at 17:22 +0800, Lulu Cheng wrote:
+  if (CPUCFG2 & CPUCFG2_LSX)
+    setCPUFeature (FEAT_LSX);
+  if (CPUCFG2 & CPUCFG2_LASX)
+    setCPUFeature (FEAT_LASX);
LSX and LASX capabilities should be obtained via kernel interface
because they need kernel support.  On Linux they can be obtained via
getauxval(AT_HWCAP), and on other kernels we can only assume they are
unavailable until their UAPI is stabilized.


When I first implemented it, I wanted to use HWCAP, but I found that HWCAP

only had the following values:

#define HWCAP_LOONGARCH_CPUCFG          (1 << 0)
#define HWCAP_LOONGARCH_LAM             (1 << 1)
#define HWCAP_LOONGARCH_UAL             (1 << 2)
#define HWCAP_LOONGARCH_FPU             (1 << 3)
#define HWCAP_LOONGARCH_LSX             (1 << 4)
#define HWCAP_LOONGARCH_LASX            (1 << 5)
#define HWCAP_LOONGARCH_CRC32           (1 << 6)
#define HWCAP_LOONGARCH_COMPLEX         (1 << 7)
#define HWCAP_LOONGARCH_CRYPTO          (1 << 8)
#define HWCAP_LOONGARCH_LVZ             (1 << 9)
#define HWCAP_LOONGARCH_LBT_X86         (1 << 10)
#define HWCAP_LOONGARCH_LBT_ARM         (1 << 11)
#define HWCAP_LOONGARCH_LBT_MIPS        (1 << 12)
#define HWCAP_LOONGARCH_PTW             (1 << 13)

So, do LAM and UAL also need to pass the HWCAP? Or do they both need to

pass the HWCAP?

Reply via email to