Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created January 6, 2021 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaityo256/c43c168976568fd883c9e3519c61d421 to your computer and use it in GitHub Desktop.
Save kaityo256/c43c168976568fd883c9e3519c61d421 to your computer and use it in GitHub Desktop.
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