DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
AVXUtils.hpp
Go to the documentation of this file.
1
8
9#include <fmt/core.h>
10#include <fmt/ranges.h>
11#include <immintrin.h>
12
13#include <array>
14
15#ifndef TPGLIBS_AVXUTILS_HPP_
16#define TPGLIBS_AVXUTILS_HPP_
17
18namespace tpglibs {
19
29inline __m256i
30_mm256_div_epi16(const __m256i& va, const int16_t& b)
31{
32 // NaiveUtils.hpp has the lay version.
33 __m256i vb = _mm256_set1_epi16(32768 / b);
34 return _mm256_mulhrs_epi16(va, vb);
35}
36
47inline void
48_mm256_print_epi16(const __m256i& input)
49{
50 std::array<int16_t, 16> prints;
51 _mm256_storeu_si256(reinterpret_cast<__m256i*>(prints.begin()), input);
52
53 fmt::print("{}", prints);
54}
55
56} // namespace tpglibs
57
58#endif // TPGLIBS_AVXUTILS_HPP_
__m256i _mm256_div_epi16(const __m256i &va, const int16_t &b)
Hack-ish AVX division function.
Definition AVXUtils.hpp:30
void _mm256_print_epi16(const __m256i &input)
AVX printing function.
Definition AVXUtils.hpp:48