Skip to content

Commit 4571d3a

Browse files
refactor: remove redundant SIMD flags and runtime detection
- Remove duplicate SIMD flags from test/samples/benchmark CMakeLists (flags already inherited from nfx-hashing INTERFACE target) - Remove runtime SSE4.2 detection fallback in crc32c() (intrinsics unavailable without compile-time flags anyway)
1 parent 70a233d commit 4571d3a

4 files changed

Lines changed: 5 additions & 29 deletions

File tree

benchmark/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,15 @@ foreach(benchmark_source ${benchmark_sources})
8080
)
8181

8282
#----------------------------------------------
83-
# Enable specific CPU features
83+
# Compiler warnings
8484
#----------------------------------------------
8585

8686
target_compile_options(${benchmark_target_name}
8787
PRIVATE
88-
$<$<CXX_COMPILER_ID:MSVC>:/arch:AVX2>
89-
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-msse4.2>
90-
9188
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
9289
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wall -Wextra -Werror>
9390
)
91+
9492
#----------------------------------------------
9593
# Properties
9694
#----------------------------------------------

include/nfx/detail/hashing/Algorithms.inl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,7 @@ namespace nfx::hashing
104104
return _mm_crc32_u8( hash, ch );
105105
# endif
106106
#else
107-
// No compile-time SSE4.2 - check at runtime
108-
if( internal::hasSse42Support() )
109-
{
110-
# if defined( __GNUC__ ) || defined( __clang__ )
111-
return __builtin_ia32_crc32qi( hash, ch );
112-
# elif defined( _MSC_VER )
113-
return _mm_crc32_u8( hash, ch );
114-
# else
115-
// Compiler doesn't support intrinsics, fall back to software
116-
return crc32cSoft( hash, ch );
117-
# endif
118-
}
119-
else
120-
{
121-
// CPU doesn't support SSE4.2, use software implementation
122-
return crc32cSoft( hash, ch );
123-
}
107+
return crc32cSoft( hash, ch );
124108
#endif
125109
}
126110

samples/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,11 @@ foreach(sample_source ${sample_sources})
4343
)
4444

4545
#----------------------------------------------
46-
# Enable specific CPU features
46+
# Compiler warnings
4747
#----------------------------------------------
4848

4949
target_compile_options(${sample_target_name}
5050
PRIVATE
51-
$<$<CXX_COMPILER_ID:MSVC>:/arch:AVX2>
52-
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-msse4.2>
53-
5451
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
5552
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wall -Wextra -Werror>
5653
)

test/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,11 @@ foreach(test_source ${test_sources})
9898
)
9999

100100
#----------------------------------------------
101-
# Enable specific CPU features
101+
# Compiler warnings
102102
#----------------------------------------------
103103

104104
target_compile_options(${test_target_name}
105105
PRIVATE
106-
$<$<CXX_COMPILER_ID:MSVC>:/arch:AVX2>
107-
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-msse4.2>
108-
109106
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
110107
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wall -Wextra -Werror>
111108
)

0 commit comments

Comments
 (0)