Skip to content

Commit

Permalink
Fix simd_test rename and arch detect on gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Aug 7, 2024
1 parent db38a3a commit 1ed3298
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
7 changes: 2 additions & 5 deletions cmake/ArchDetect.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ function(target_architecture output_arch output_arch_ver)
# #error preprocessor directives... but by exploiting the preprocessor in this
# way, we can detect the correct target architecture even when cross-compiling,
# since the program itself never needs to be run (only the compiler/preprocessor)
try_run(
run_result_unused
try_compile(
compile_result_unused
"${CMAKE_BINARY_DIR}"
"${FastSIMD_SOURCE_DIR}/cmake/ArchDetect.cpp"
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
OUTPUT_VARIABLE COMPILE_OUTPUT
)

#message(STATUS ${COMPILE_OUTPUT})

# Parse the architecture name from the compiler output
Expand Down
9 changes: 8 additions & 1 deletion cmake/ArchDetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
#define TO_LITERAL_( string ) #string
#define TO_LITERAL( string ) TO_LITERAL_( string )

#if !defined( TEST_FEATURE_SET_ACTIVE ) || FASTSIMD_FEATURE_VALUE( TEST_FEATURE_SET_ACTIVE ) > 0
#if !defined( TEST_FEATURE_SET_ACTIVE )
#define FASTSIMD_DETECT_SUCCESS
#else
#if FASTSIMD_FEATURE_VALUE( TEST_FEATURE_SET_ACTIVE ) > 0
#define FASTSIMD_DETECT_SUCCESS
#endif
#endif

#ifdef FASTSIMD_DETECT_SUCCESS
static_assert( 0, "FASTSIMD_ARCH<" TO_LITERAL( FASTSIMD_ARCH_NAME() ) ">" );

// Needed for MacOS clang, it doesn't evaluate macros in static assert errors
Expand Down
6 changes: 3 additions & 3 deletions tests/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ struct TestRunner
};

template<FastSIMD::FeatureSet HEAD, FastSIMD::FeatureSet... TAIL>
struct TestOrganiser<FastSIMD::FeatureSetList<HEAD, TAIL...>>
struct TestOrganiser<FastSIMD::FeatureSetList<0, HEAD, TAIL...>>
{
static TestCollection GetCollections()
{
TestCollection collections = TestOrganiser<FastSIMD::FeatureSetList<TAIL...>>::GetCollections();
TestCollection collections = TestOrganiser<FastSIMD::FeatureSetList<0, TAIL...>>::GetCollections();

if( HEAD <= FastSIMD::DetectCpuMaxFeatureSet() )
{
Expand Down Expand Up @@ -280,7 +280,7 @@ struct TestRunner
{
std::cout << "Starting Tests - Register Size: " << RegisterBytes * 8 << " (" << RegisterBytes << "b)" << std::endl;

TestSet testSet = TestOrganiser<FastSIMD::test_simd::CompiledFeatureSets>::GetSet();
TestSet testSet = TestOrganiser<FastSIMD::simd_test::CompiledFeatureSets>::GetSet();

for( auto& test : testSet )
{
Expand Down

0 comments on commit 1ed3298

Please sign in to comment.