simdtranspose for defaultsize=1

This commit is contained in:
Joachim Schoeberl 2023-02-11 20:23:53 +01:00
parent cec87bb2ff
commit ff65434e46

View File

@ -46,19 +46,27 @@ namespace ngcore
}
#endif
NETGEN_INLINE void SIMDTranspose (SIMD<double,4> a1, SIMD<double,4> a2, SIMD <double,4> a3, SIMD<double,4> a4,
SIMD<double,4> & b1, SIMD<double,4> & b2, SIMD<double,4> & b3, SIMD<double,4> & b4)
SIMD<double,4> & b1, SIMD<double,4> & b2, SIMD<double,4> & b3, SIMD<double,4> & b4)
{
SIMD<double,4> h1,h2,h3,h4;
std::tie(h1,h2) = Unpack(a1,a2);
std::tie(h3,h4) = Unpack(a3,a4);
b1 = SIMD<double,4> (h1.Lo(), h3.Lo());
b2 = SIMD<double,4> (h2.Lo(), h4.Lo());
b3 = SIMD<double,4> (h1.Hi(), h3.Hi());
b4 = SIMD<double,4> (h2.Hi(), h4.Hi());
if constexpr (sizeof(a1.Lo()) == 16)
{
auto [h1,h2] = Unpack(a1,a2);
auto [h3,h4] = Unpack(a3,a4);
b1 = SIMD<double,4> (h1.Lo(), h3.Lo());
b2 = SIMD<double,4> (h2.Lo(), h4.Lo());
b3 = SIMD<double,4> (h1.Hi(), h3.Hi());
b4 = SIMD<double,4> (h2.Hi(), h4.Hi());
}
else
{
b1 = SIMD<double,4> (a1[0], a2[0], a3[0], a4[0]);
b2 = SIMD<double,4> (a1[1], a2[1], a3[1], a4[1]);
b3 = SIMD<double,4> (a1[2], a2[2], a3[2], a4[2]);
b4 = SIMD<double,4> (a1[3], a2[3], a3[3], a4[3]);
}
}
template<int N>
NETGEN_INLINE auto HSum (SIMD<double,N> s1, SIMD<double,N> s2)
{