Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SSE4a implementation of NT-store accessor #768

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion examples/stream/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,12 @@ void checkSTREAMresults()

# undef abs
# undef M
# include <emmintrin.h>
# ifdef _MSC_VER
# include <intrin.h>
# else
# include <ammintrin.h>
# include <emmintrin.h>
# endif
# include <llama/llama.hpp>

constexpr auto mapping = llama::mapping::AoS<llama::ArrayExtents<ssize_t, STREAM_ARRAY_SIZE>, STREAM_TYPE>{};
Expand All @@ -613,15 +618,23 @@ struct NonTemporalStoreAccessor
# else
if constexpr(sizeof(T) == sizeof(long long))
{
# ifdef __SSE4A__
_mm_stream_sd(&ref, _mm_set_sd(t));
# else
long long i;
std::memcpy(&i, &t, sizeof(i));
_mm_stream_si64(reinterpret_cast<long long*>(&ref), i);
# endif
}
else if constexpr(sizeof(T) == sizeof(int))
{
# ifdef __SSE4A__
_mm_stream_ss(&ref, _mm_set_ss(t));
# else
int i;
std::memcpy(&i, &t, sizeof(i));
_mm_stream_si32(reinterpret_cast<int*>(&ref), i);
# endif
}
else
{
Expand Down
Loading