MCPcopy Create free account
hub / github.com/VcDevel/Vc / TEST_TYPES

Function TEST_TYPES

tests/deinterleave.cpp:50–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 */
49
50TEST_TYPES(Pair, testDeinterleave,
51 vir::Typelist<float_v, float>,
52 vir::Typelist<float_v, unsigned short>,
53 vir::Typelist<float_v, short>,
54 vir::Typelist<double_v, double>,
55 vir::Typelist<int_v, int>,
56 vir::Typelist<int_v, short>,
57 vir::Typelist<uint_v, unsigned int>,
58 vir::Typelist<uint_v, unsigned short>,
59 vir::Typelist<short_v, short>,
60 vir::Typelist<ushort_v, unsigned short>)
61{
62 typedef typename Pair::template at<0> V;
63 typedef typename Pair::template at<1> M;
64
65 const bool isSigned = std::numeric_limits<M>::is_signed;
66
67 const typename V::EntryType offset = isSigned ? -512 : 0;
68 const V _0246 = V([](int n) { return n * 2; }) + offset;
69
70 M memory[1024];
71 for (int i = 0; i < 1024; ++i) {
72 memory[i] = static_cast<M>(i + offset);
73 }
74
75 V a, b;
76
77 static_assert(2 * V::Size < 1024, "fix the test, please");
78 for (int i = 0; i < 1024 - 2 * int(V::Size); ++i) {
79 if (reinterpret_cast<std::uintptr_t>(&memory[i]) & (Vc::VectorAlignment - 1)) {
80 Vc::deinterleave(&a, &b, &memory[i], Vc::Unaligned);
81 } else {
82 Vc::deinterleave(&a, &b, &memory[i]);
83 }
84 COMPARE(a, _0246 + i);
85 COMPARE(b, _0246 + i + 1);
86 }
87}

Callers

nothing calls this directly

Calls 1

deinterleaveFunction · 0.50

Tested by

no test coverage detected