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