Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created Jan 6, 2021
Embed
What would you like to do?
Check the length of SVE
#include <cstdio>
int main(){
int x;
asm __volatile__("cntb %[x]" : [ x ] "=r"(x));
printf("%d\n",x*8);
}
@kaityo256
Copy link
Author

kaityo256 commented Jan 6, 2021

$ qemu-aarch64 -cpu max,sve128=on ./a.out
128
$ qemu-aarch64 -cpu max,sve256=on ./a.out
256
$ qemu-aarch64 -cpu max,sve512=on ./a.out
512
$ qemu-aarch64 -cpu max,sve=off ./a.out
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment