-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDummyContainer.hpp
73 lines (63 loc) · 1.47 KB
/
DummyContainer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include <immintrin.h>
#include <cstdint>
template<size_t n>
struct DummyContainer {
char dummy[n]{};
};
template<>
struct DummyContainer<64> {
char dummy[64];
DummyContainer() {
_mm256_storeu_ps((float*)dummy, _mm256_setzero_ps());
_mm256_storeu_ps((float*)(dummy + 32), _mm256_setzero_ps());
}
};
template<>
struct DummyContainer<56> {
char dummy[56];
DummyContainer() {
__m256 a = _mm256_setzero_ps();
_mm256_storeu_ps((float*)dummy, a);
_mm256_storeu_ps((float*)(dummy + 24), a);
}
};
template<>
struct DummyContainer<48> {
char dummy[48];
DummyContainer() {
__m256 a = _mm256_setzero_ps();
_mm256_storeu_ps((float*)dummy, a);
_mm_storeu_ps((float*)(dummy + 32), _mm256_castps256_ps128(a));
}
};
template<>
struct DummyContainer<40> {
char dummy[40];
DummyContainer() {
_mm256_storeu_ps((float*)dummy, _mm256_setzero_ps());
*((uint64_t*)(dummy + 32)) = 0;
}
};
template<>
struct DummyContainer<32> {
char dummy[32];
DummyContainer() {
_mm256_storeu_ps((float*)dummy, _mm256_setzero_ps());
}
};
template<>
struct DummyContainer<24> {
char dummy[24];
DummyContainer() {
_mm_storeu_ps((float*)dummy, _mm_setzero_ps());
*((uint64_t*)(dummy + 16)) = 0;
}
};
template<>
struct DummyContainer<16> {
char dummy[16];
DummyContainer() {
_mm_storeu_ps((float*)dummy, _mm_setzero_ps());
}
};