From 8a6b5d8f025b8af365acbe6c8f7128ac0fccffe5 Mon Sep 17 00:00:00 2001 From: thorstenhater <24411438+thorstenhater@users.noreply.github.com> Date: Mon, 23 Aug 2021 11:32:38 +0200 Subject: [PATCH] Clean-up AVX routine and global def [EOM] (#1618) * Clean-up AVX SIMD mask setting. * Remove redundant global constant in the memory lib. * Fix 'unused variable' warning in `test_probe.cpp`. --- arbor/include/arbor/simd/avx.hpp | 10 +++++----- arbor/memory/range_limits.hpp | 6 ------ test/unit/test_probe.cpp | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/arbor/include/arbor/simd/avx.hpp b/arbor/include/arbor/simd/avx.hpp index 67fb4f4a..2aeaed9f 100644 --- a/arbor/include/arbor/simd/avx.hpp +++ b/arbor/include/arbor/simd/avx.hpp @@ -332,11 +332,11 @@ struct avx_double4: implbase<avx_double4> { return _mm256_castsi256_pd(combine_m128i(bu, bl)); } - static void mask_set_element(__m256d& u, int i, bool b) { - char data[256]; - _mm256_storeu_pd((double*)data, u); - ((int64*)data)[i] = -(int64)b; - u = _mm256_loadu_pd((double*)data); + static void mask_set_element(__m256d& u, const int i, bool b) { + int64 data[4]; + _mm256_storeu_si256((__m256i*)data, _mm256_castpd_si256(u)); + data[i] = -(int64)b; + u = _mm256_castsi256_pd(_mm256_loadu_si256((__m256i*)data)); } static void mask_copy_to(const __m256d& m, bool* y) { diff --git a/arbor/memory/range_limits.hpp b/arbor/memory/range_limits.hpp index c1284a8b..273e2f80 100644 --- a/arbor/memory/range_limits.hpp +++ b/arbor/memory/range_limits.hpp @@ -5,11 +5,5 @@ namespace memory { // tag for final element in a range struct end_type {}; -namespace{ - // attach the unused attribute so that -Wall won't generate warnings when - // translation units that include this file don't use end - end_type end [[gnu::unused]]; -} - } // namespace memory } // namespace arb diff --git a/test/unit/test_probe.cpp b/test/unit/test_probe.cpp index 6ea8ad80..13fc9889 100644 --- a/test/unit/test_probe.cpp +++ b/test/unit/test_probe.cpp @@ -1164,7 +1164,7 @@ void run_stimulus_probe_test(const context& ctx) { cable_probe_stimulus_current_cell{}, {stim_until/2, 2*stim_until}).at(0); ASSERT_EQ(3u, traces[i].meta.size()); - for (unsigned cv: {0u, 1u, 2u}) { + for ([[maybe_unused]] unsigned cv: {0u, 1u, 2u}) { ASSERT_EQ(2u, traces[i].size()); } } -- GitLab