Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Apr 2, 2024
1 parent ef582e0 commit aecc567
Showing 1 changed file with 35 additions and 15 deletions.
50 changes: 35 additions & 15 deletions test/CPUID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,49 @@ int main()
defined(_M_X64) || \
defined(_M_IX86)

#if defined(__POPCNT__) && !defined(HAS_POPCNT)
std::cerr << "Error: HAS_POPCNT must be defined if __POPCNT__ is defined!" << std::endl;
return 1;
#if defined(__POPCNT__)
#if defined(HAS_POPCNT)
std::cout << "OK: __POPCNT__ and HAS_POPCNT are defined!" << std::endl;
#else
std::cerr << "Error: HAS_POPCNT must be defined if __POPCNT__ is defined!" << std::endl;
return 1;
#endif
#endif

#if defined(__AVX__) && !defined(HAS_POPCNT)
std::cerr << "Error: HAS_POPCNT must be defined if __AVX__ is defined!" << std::endl;
return 1;
#if defined(__AVX__)
#if defined(HAS_POPCNT)
std::cout << "OK: __AVX__ and HAS_POPCNT are defined!" << std::endl;
#else
std::cerr << "Error: HAS_POPCNT must be defined if __AVX__ is defined!" << std::endl;
return 1;
#endif
#endif

#if defined(__AVX2__) && !defined(HAS_POPCNT)
std::cerr << "Error: HAS_POPCNT must be defined if __AVX2__ is defined!" << std::endl;
return 1;
#if defined(__AVX2__)
#if defined(HAS_POPCNT)
std::cout << "OK: __AVX2__ and HAS_POPCNT are defined!" << std::endl;
#else
std::cerr << "Error: HAS_POPCNT must be defined if __AVX2__ is defined!" << std::endl;
return 1;
#endif
#endif

#if defined(HAS_POPCNT) && defined(ENABLE_CPUID_POPCNT)
std::cerr << "Error: ENABLE_CPUID_POPCNT must not be defined if HAS_POPCNT is defined!" << std::endl;
return 1;
#if defined(HAS_POPCNT)
#if !defined(ENABLE_CPUID_POPCNT)
std::cout << "OK: HAS_POPCNT is defined but ENABLE_CPUID_POPCNT is not defined!" << std::endl;
#else
std::cerr << "Error: ENABLE_CPUID_POPCNT must not be defined if HAS_POPCNT is defined!" << std::endl;
return 1;
#endif
#endif

#if !defined(HAS_POPCNT) && !defined(ENABLE_CPUID_POPCNT)
std::cerr << "Error: ENABLE_CPUID_POPCNT must be defined if HAS_POPCNT is not defined!" << std::endl;
return 1;
#if !defined(HAS_POPCNT)
#if defined(ENABLE_CPUID_POPCNT)
std::cout << "OK: HAS_POPCNT is not defined but ENABLE_CPUID_POPCNT is defined!" << std::endl;
#else
std::cerr << "Error: ENABLE_CPUID_POPCNT must be defined if HAS_POPCNT is not defined!" << std::endl;
return 1;
#endif
#endif

#if defined(ENABLE_CPUID_POPCNT)
Expand Down

0 comments on commit aecc567

Please sign in to comment.