[AArch64] Print the SVE and SME vector lengths in cpu_id

This file is not compiled with SVE or SME features enabled so use
`.inst` to specify the instructions to read the vector length in hex
instead.

Change-Id: I2673b6f79a4a6ea0753f8b3de31244457fc08e76
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5616030
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
George Steed 2024-05-20 18:41:31 +01:00 committed by Frank Barchard
parent c8974cf8d4
commit c8dc7f57d4

View File

@ -107,6 +107,22 @@ int main(int argc, const char* argv[]) {
printf("Has SVE 0x%x\n", has_sve); printf("Has SVE 0x%x\n", has_sve);
printf("Has SVE2 0x%x\n", has_sve2); printf("Has SVE2 0x%x\n", has_sve2);
printf("Has SME 0x%x\n", has_sme); 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) { if (has_riscv) {
int has_rvv = TestCpuFlag(kCpuHasRVV); int has_rvv = TestCpuFlag(kCpuHasRVV);