Skip to content

Instantly share code, notes, and snippets.

@maneesh29s
Created February 27, 2023 07:00
Show Gist options
  • Select an option

  • Save maneesh29s/340634f9390754bf80446a3bb26a0ecf to your computer and use it in GitHub Desktop.

Select an option

Save maneesh29s/340634f9390754bf80446a3bb26a0ecf to your computer and use it in GitHub Desktop.
Gist to check which intrinsics are present in a machine
#include <iostream>
int main(int argc, char const *argv[])
{
#ifdef __amd64__
std::cout << "__amd64__ detected" << std::endl;
#endif
#ifdef __x86_64__
std::cout << "__x86_64__ detected" << std::endl;
#endif
#ifdef __arm__
std::cout << "__arm__ detected" << std::endl;
// #ifdef __ARM_ARCH_'V'__
// std::cout << " Arm version is: " << __ARM_ARCH_'V'__ << std::endl;
// #endif
#endif
#ifdef __aarch64__
std::cout << "__aarch64__ detected" << std::endl;
#endif
#ifdef __SSE__
std::cout << "__SSE__ detected" << std::endl;
#endif
#ifdef __SSE2__
std::cout << "__SSE2__ detected" << std::endl;
#endif
#ifdef __SSE3__
std::cout << "__SSE3__ detected" << std::endl;
#endif
#ifdef __AVX2__
std::cout << "__AVX2__ detected" << std::endl;
#endif
#ifdef __AVX2__
std::cout << "__AVX2__ detected" << std::endl;
#endif
#ifdef __ARM_NEON__
std::cout << "__ARM_NEON__ detected" << std::endl;
#endif
#ifdef __SSE2__
std::cout << "__SSE2__ detected" << std::endl;
#endif
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment