Skip to content

Commit

Permalink
Fix FS_BIND_INTRINSIC for Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Jul 13, 2023
1 parent 4877aab commit 6f47e0f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
23 changes: 23 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,29 @@
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_clang_x64" ],
"wslPath": "${defaultWSLPath}"
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
},
{
"name": "x64-Clang-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"variables": []
}
]
}
5 changes: 2 additions & 3 deletions example/example.inl
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ class FastSIMD::DispatchClass<ExampleSIMD, SIMD> : public ExampleSIMD
{
constexpr std::size_t N = 32;

if constexpr( !(SIMD & FastSIMD::FeatureFlag::AVX) )
if constexpr( (SIMD & FastSIMD::FeatureFlag::AVX512_F) )
{
auto vMultiplier = FS::f32<N>( multiplier );
auto test = FS::NativeExec<FS::f32<N>>( FS_BIND_INTRINSIC( _mm_mul_ps ), vMultiplier, FS::Constant<float>(2,3,4,5) );
auto test = FS::NativeExec<FS::f32<N>>( FS_BIND_INTRINSIC( _mm512_mul_ps ), vMultiplier, FS::LoadIncremented<float, N>() );

FS::Store( out, test );
}


//auto vInt = FS::i32<N>( 1 ) + 2_i32;

Expand Down
1 change: 1 addition & 0 deletions example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
int main()
{
FastSIMD::FeatureSet featureSet = FastSIMD::DetectCpuMaxFeatureSet();
std::cout << FastSIMD::GetFeatureSetString( featureSet ) << std::endl;

std::vector<float> data;
for( int i = 0; i < 32; i++ )
Expand Down
4 changes: 0 additions & 4 deletions include/FastSIMD/ToolSet/Generic/Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

#include "Register.h"

#if defined( __clang__ )
#define FS_BIND_INTRINSIC( FUNC ) FUNC
#else
#define FS_BIND_INTRINSIC( FUNC ) []( auto... ARGS ){ return FUNC( ARGS... ); }
#endif

namespace FS
{
Expand Down
3 changes: 2 additions & 1 deletion include/FastSIMD/Utility/ArchDetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@
#define FASTSIMD_FEATURE_VALUE( feature ) FASTSIMD_FEATURE_VALUE_IMPL( feature )
#define FASTSIMD_FEATURE_VALUE_IMPL( feature ) FASTSIMD_FEATURE_VALUE_##feature()

#define FASTSIMD_DEFAULT_FEATURE_VALUE() FASTSIMD_FEATURE_VALUE( FASTSIMD_DEFAULT_FEATURE_SET )
#define FASTSIMD_MAX_FEATURE_VALUE() FASTSIMD_FEATURE_VALUE( FASTSIMD_MAX_FEATURE_SET )
#define FASTSIMD_ARCH_NAME() FASTSIMD_ARCH_DETECT()=FASTSIMD_MAX_FEATURE_SET


namespace FastSIMD
{
static_assert( FASTSIMD_FEATURE_VALUE( FASTSIMD_DEFAULT_FEATURE_SET ) <= FASTSIMD_FEATURE_VALUE( FASTSIMD_MAX_FEATURE_SET ),
static_assert( FASTSIMD_DEFAULT_FEATURE_VALUE() <= FASTSIMD_MAX_FEATURE_VALUE(),
"Default feature set must be <= to max feature set" );

template<FeatureSet SIMD = FastSIMD::FeatureSet::FASTSIMD_DEFAULT_FEATURE_SET>
Expand Down

0 comments on commit 6f47e0f

Please sign in to comment.