diff --git a/util/cpuid.c b/util/cpuid.c index 50ab9ffbc..0f1f806a8 100644 --- a/util/cpuid.c +++ b/util/cpuid.c @@ -107,6 +107,22 @@ int main(int argc, const char* argv[]) { printf("Has SVE 0x%x\n", has_sve); printf("Has SVE2 0x%x\n", has_sve2); printf("Has SME 0x%x\n", has_sme); + +#if __aarch64__ + // Read and print the SVE and SME vector lengths. + if (has_sve) { + int sve_vl; + // rdvl x0, #1 + asm(".inst 0x04bf5020; mov %w0, w0" : "=r"(sve_vl)::"x0"); + printf("SVE vector length: %d bytes\n", sve_vl); + } + if (has_sme) { + int sme_vl; + // rdsvl x0, #1 + asm(".inst 0x04bf5820; mov %w0, w0" : "=r"(sme_vl)::"x0"); + printf("SME vector length: %d bytes\n", sme_vl); + } +#endif } if (has_riscv) { int has_rvv = TestCpuFlag(kCpuHasRVV);