Merge pull request #276 from gtsoul-tech/bugFix/cppcheck-noExplicitConstructor-part2

Bug fix/cppcheck no explicit constructor part2
This commit is contained in:
Konstantinos Margaritis 2024-05-14 19:52:01 +03:00 committed by GitHub
commit bf794fafa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 290 additions and 290 deletions

View File

@ -159,13 +159,13 @@ really_inline SuperVector<16>::SuperVector(uint64_t const other)
template<>
really_inline SuperVector<16> SuperVector<16>::Ones(void)
{
return {vdupq_n_u8(0xFF)};
return SuperVector<16>(vdupq_n_u8(0xFF));
}
template<>
really_inline SuperVector<16> SuperVector<16>::Zeroes(void)
{
return {vdupq_n_u8(0)};
return SuperVector<16>(vdupq_n_u8(0));
}
// Methods
@ -179,37 +179,37 @@ really_inline void SuperVector<16>::operator=(SuperVector<16> const &other)
template <>
really_inline SuperVector<16> SuperVector<16>::operator&(SuperVector<16> const &b) const
{
return {vandq_u8(u.u8x16[0], b.u.u8x16[0])};
return SuperVector<16>(vandq_u8(u.u8x16[0], b.u.u8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator|(SuperVector<16> const &b) const
{
return {vorrq_u8(u.u8x16[0], b.u.u8x16[0])};
return SuperVector<16>(vorrq_u8(u.u8x16[0], b.u.u8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator^(SuperVector<16> const &b) const
{
return {veorq_u8(u.u8x16[0], b.u.u8x16[0])};
return SuperVector<16>(veorq_u8(u.u8x16[0], b.u.u8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator!() const
{
return {vmvnq_u8(u.u8x16[0])};
return SuperVector<16>(vmvnq_u8(u.u8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::opandnot(SuperVector<16> const &b) const
{
return {vandq_u8(vmvnq_u8(u.u8x16[0]), b.u.u8x16[0])};
return SuperVector<16>(vandq_u8(vmvnq_u8(u.u8x16[0]), b.u.u8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator==(SuperVector<16> const &b) const
{
return {vceqq_u8(u.u8x16[0], b.u.u8x16[0])};
return SuperVector<16>(vceqq_u8(u.u8x16[0], b.u.u8x16[0]));
}
template <>
@ -221,25 +221,25 @@ really_inline SuperVector<16> SuperVector<16>::operator!=(SuperVector<16> const
template <>
really_inline SuperVector<16> SuperVector<16>::operator>(SuperVector<16> const &b) const
{
return {vcgtq_s8(u.s8x16[0], b.u.s8x16[0])};
return SuperVector<16>(vcgtq_s8(u.s8x16[0], b.u.s8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator>=(SuperVector<16> const &b) const
{
return {vcgeq_u8(u.u8x16[0], b.u.u8x16[0])};
return SuperVector<16>(vcgeq_u8(u.u8x16[0], b.u.u8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator<(SuperVector<16> const &b) const
{
return {vcltq_s8(u.s8x16[0], b.u.s8x16[0])};
return SuperVector<16>(vcltq_s8(u.s8x16[0], b.u.s8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator<=(SuperVector<16> const &b) const
{
return {vcgeq_s8(u.s8x16[0], b.u.s8x16[0])};
return SuperVector<16>(vcgeq_s8(u.s8x16[0], b.u.s8x16[0]));
}
template <>
@ -274,35 +274,35 @@ template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_8_imm() const
{
return {vshlq_n_u8(u.u8x16[0], N)};
return SuperVector<16>(vshlq_n_u8(u.u8x16[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_16_imm() const
{
return {vshlq_n_u16(u.u16x8[0], N)};
return SuperVector<16>(vshlq_n_u16(u.u16x8[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_32_imm() const
{
return {vshlq_n_u32(u.u32x4[0], N)};
return SuperVector<16>(vshlq_n_u32(u.u32x4[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_64_imm() const
{
return {vshlq_n_u64(u.u64x2[0], N)};
return SuperVector<16>(vshlq_n_u64(u.u64x2[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_128_imm() const
{
return {vextq_u8(vdupq_n_u8(0), u.u8x16[0], 16 - N)};
return SuperVector<16>(vextq_u8(vdupq_n_u8(0), u.u8x16[0], 16 - N));
}
template <>
@ -316,35 +316,35 @@ template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_8_imm() const
{
return {vshrq_n_u8(u.u8x16[0], N)};
return SuperVector<16>(vshrq_n_u8(u.u8x16[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_16_imm() const
{
return {vshrq_n_u16(u.u16x8[0], N)};
return SuperVector<16>(vshrq_n_u16(u.u16x8[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_32_imm() const
{
return {vshrq_n_u32(u.u32x4[0], N)};
return SuperVector<16>(vshrq_n_u32(u.u32x4[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_64_imm() const
{
return {vshrq_n_u64(u.u64x2[0], N)};
return SuperVector<16>(vshrq_n_u64(u.u64x2[0], N));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_128_imm() const
{
return {vextq_u8(u.u8x16[0], vdupq_n_u8(0), N)};
return SuperVector<16>(vextq_u8(u.u8x16[0], vdupq_n_u8(0), N));
}
template <>
@ -376,7 +376,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_8 (uint8_t const N) const
if (N == 0) return *this;
if (N == 8) return Zeroes();
int8x16_t shift_indices = vdupq_n_s8(N);
return { vshlq_s8(u.s8x16[0], shift_indices) };
return SuperVector<16>(vshlq_s8(u.s8x16[0], shift_indices));
}
template <>
@ -385,7 +385,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_16 (uint8_t const N) const
if (N == 0) return *this;
if (N == 16) return Zeroes();
int16x8_t shift_indices = vdupq_n_s16(N);
return { vshlq_s16(u.s16x8[0], shift_indices) };
return SuperVector<16>(vshlq_s16(u.s16x8[0], shift_indices));
}
template <>
@ -394,7 +394,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_32 (uint8_t const N) const
if (N == 0) return *this;
if (N == 32) return Zeroes();
int32x4_t shift_indices = vdupq_n_s32(N);
return { vshlq_s32(u.s32x4[0], shift_indices) };
return SuperVector<16>(vshlq_s32(u.s32x4[0], shift_indices));
}
template <>
@ -403,7 +403,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_64 (uint8_t const N) const
if (N == 0) return *this;
if (N == 64) return Zeroes();
int64x2_t shift_indices = vdupq_n_s64(N);
return { vshlq_s64(u.s64x2[0], shift_indices) };
return SuperVector<16>(vshlq_s64(u.s64x2[0], shift_indices));
}
template <>
@ -413,11 +413,11 @@ really_inline SuperVector<16> SuperVector<16>::vshl_128(uint8_t const N) const
if (N == 16) return Zeroes();
#if defined(HAVE__BUILTIN_CONSTANT_P)
if (__builtin_constant_p(N)) {
return {vextq_u8(vdupq_n_u8(0), u.u8x16[0], 16 - N)};
return SuperVector<16>(vextq_u8(vdupq_n_u8(0), u.u8x16[0], 16 - N));
}
#endif
SuperVector result;
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {vextq_u8(vdupq_n_u8(0), v->u.u8x16[0], 16 - n)}; });
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = SuperVector<16>(vextq_u8(vdupq_n_u8(0), v->u.u8x16[0], 16 - n)); });
return result;
}
@ -433,7 +433,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_8 (uint8_t const N) const
if (N == 0) return *this;
if (N == 8) return Zeroes();
int8x16_t shift_indices = vdupq_n_s8(-N);
return { vshlq_s8(u.s8x16[0], shift_indices) };
return SuperVector<16>(vshlq_s8(u.s8x16[0], shift_indices));
}
template <>
@ -442,7 +442,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_16 (uint8_t const N) const
if (N == 0) return *this;
if (N == 16) return Zeroes();
int16x8_t shift_indices = vdupq_n_s16(-N);
return { vshlq_s16(u.s16x8[0], shift_indices) };
return SuperVector<16>(vshlq_s16(u.s16x8[0], shift_indices));
}
template <>
@ -451,7 +451,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_32 (uint8_t const N) const
if (N == 0) return *this;
if (N == 32) return Zeroes();
int32x4_t shift_indices = vdupq_n_s32(-N);
return { vshlq_s32(u.s32x4[0], shift_indices) };
return SuperVector<16>(vshlq_s32(u.s32x4[0], shift_indices));
}
template <>
@ -460,7 +460,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_64 (uint8_t const N) const
if (N == 0) return *this;
if (N == 64) return Zeroes();
int64x2_t shift_indices = vdupq_n_s64(-N);
return { vshlq_s64(u.s64x2[0], shift_indices) };
return SuperVector<16>(vshlq_s64(u.s64x2[0], shift_indices));
}
template <>
@ -470,11 +470,11 @@ really_inline SuperVector<16> SuperVector<16>::vshr_128(uint8_t const N) const
if (N == 16) return Zeroes();
#if defined(HAVE__BUILTIN_CONSTANT_P)
if (__builtin_constant_p(N)) {
return {vextq_u8(u.u8x16[0], vdupq_n_u8(0), N)};
return SuperVector<16>(vextq_u8(u.u8x16[0], vdupq_n_u8(0), N));
}
#endif
SuperVector result;
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {vextq_u8(v->u.u8x16[0], vdupq_n_u8(0), n)}; });
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = SuperVector<16>(vextq_u8(v->u.u8x16[0], vdupq_n_u8(0), n)); });
return result;
}
@ -511,7 +511,7 @@ really_inline SuperVector<16> SuperVector<16>::Ones_vshl(uint8_t const N)
template <>
really_inline SuperVector<16> SuperVector<16>::loadu(void const *ptr)
{
return {vld1q_s32((const int32_t *)ptr)};
return {SuperVector<16>(vld1q_s32((const int32_t *)ptr))};
}
template <>
@ -519,7 +519,7 @@ really_inline SuperVector<16> SuperVector<16>::load(void const *ptr)
{
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
ptr = vectorscan_assume_aligned(ptr, SuperVector::size);
return {vld1q_s32((const int32_t *)ptr)};
return {SuperVector<16>(vld1q_s32((const int32_t *)ptr))};
}
template <>
@ -537,11 +537,11 @@ really_inline SuperVector<16> SuperVector<16>::alignr(SuperVector<16> &other, in
if (offset == 16) return *this;
#if defined(HAVE__BUILTIN_CONSTANT_P)
if (__builtin_constant_p(offset)) {
return {vextq_u8(other.u.u8x16[0], u.u8x16[0], offset)};
return SuperVector<16>(vextq_u8(other.u.u8x16[0], u.u8x16[0], offset));
}
#endif
SuperVector result;
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (offset == n) result = {vextq_u8(other.u.u8x16[0], v->u.u8x16[0], n)}; });
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (offset == n) result = SuperVector<16>(vextq_u8(other.u.u8x16[0], v->u.u8x16[0], n)); });
return result;
}
@ -549,7 +549,7 @@ template<>
template<>
really_inline SuperVector<16> SuperVector<16>::pshufb<false>(SuperVector<16> b)
{
return {vqtbl1q_u8(u.u8x16[0], b.u.u8x16[0])};
return SuperVector<16>(vqtbl1q_u8(u.u8x16[0], b.u.u8x16[0]));
}
template<>

View File

@ -183,13 +183,13 @@ really_inline SuperVector<16>::SuperVector(uint64_t const other)
template<>
really_inline SuperVector<16> SuperVector<16>::Ones(void)
{
return { vec_splat_s8(-1)};
return SuperVector<16>(vec_splat_s8(-1));
}
template<>
really_inline SuperVector<16> SuperVector<16>::Zeroes(void)
{
return { vec_splat_s8(0) };
return SuperVector<16>(vec_splat_s8(0));
}
// Methods
@ -203,38 +203,38 @@ really_inline void SuperVector<16>::operator=(SuperVector<16> const &other)
template <>
really_inline SuperVector<16> SuperVector<16>::operator&(SuperVector<16> const &b) const
{
return { vec_and(u.v128[0], b.u.v128[0]) };
return SuperVector<16>(vec_and(u.v128[0], b.u.v128[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator|(SuperVector<16> const &b) const
{
return { vec_or(u.v128[0], b.u.v128[0]) };
return SuperVector<16>(vec_or(u.v128[0], b.u.v128[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator^(SuperVector<16> const &b) const
{
return { vec_xor(u.v128[0], b.u.v128[0]) };
return SuperVector<16>(vec_xor(u.v128[0], b.u.v128[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator!() const
{
return { vec_xor(u.v128[0], u.v128[0]) };
return SuperVector<16>(vec_xor(u.v128[0], u.v128[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::opandnot(SuperVector<16> const &b) const
{
int8x16_t not_res = vec_xor(u.s8x16[0], vec_splat_s8(-1));
return { vec_and(not_res, b.u.s8x16[0]) };
return SuperVector<16>(vec_and(not_res, b.u.s8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator==(SuperVector<16> const &b) const
{
return { vec_cmpeq(u.s8x16[0], b.u.s8x16[0])};
return SuperVector<16>(vec_cmpeq(u.s8x16[0], b.u.s8x16[0]));
}
template <>
@ -246,25 +246,25 @@ really_inline SuperVector<16> SuperVector<16>::operator!=(SuperVector<16> const
template <>
really_inline SuperVector<16> SuperVector<16>::operator>(SuperVector<16> const &b) const
{
return { vec_cmpgt(u.s8x16[0], b.u.s8x16[0])};
return SuperVector<16>(vec_cmpgt(u.s8x16[0], b.u.s8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator>=(SuperVector<16> const &b) const
{
return { vec_cmpge(u.s8x16[0], b.u.s8x16[0])};
return SuperVector<16>(vec_cmpge(u.s8x16[0], b.u.s8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator<(SuperVector<16> const &b) const
{
return { vec_cmpgt(b.u.s8x16[0], u.s8x16[0])};
return SuperVector<16>(vec_cmpgt(b.u.s8x16[0], u.s8x16[0]));
}
template <>
really_inline SuperVector<16> SuperVector<16>::operator<=(SuperVector<16> const &b) const
{
return { vec_cmpge(b.u.s8x16[0], u.s8x16[0])};
return SuperVector<16>(vec_cmpge(b.u.s8x16[0], u.s8x16[0]));
}
template <>
@ -310,35 +310,35 @@ template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_8_imm() const
{
return { vec_sl(u.s8x16[0], vec_splat_u8(N)) };
return SuperVector<16>(vec_sl(u.s8x16[0], vec_splat_u8(N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_16_imm() const
{
return { vec_sl(u.s16x8[0], vec_splat_u16(N)) };
return SuperVector<16>(vec_sl(u.s16x8[0], vec_splat_u16(N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_32_imm() const
{
return { vec_sl(u.s32x4[0], vec_splat_u32(N)) };
return SuperVector<16>(vec_sl(u.s32x4[0], vec_splat_u32(N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_64_imm() const
{
return { vec_sl(u.s64x2[0], vec_splats((ulong64_t) N)) };
return SuperVector<16>(vec_sl(u.s64x2[0], vec_splats((ulong64_t) N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshl_128_imm() const
{
return { vec_sld(u.s8x16[0], vec_splat_s8(0), N)};
return SuperVector<16>(vec_sld(u.s8x16[0], vec_splat_s8(0), N));
}
template <>
@ -352,35 +352,35 @@ template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_8_imm() const
{
return { vec_sr(u.s8x16[0], vec_splat_u8(N)) };
return SuperVector<16>(vec_sr(u.s8x16[0], vec_splat_u8(N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_16_imm() const
{
return { vec_sr(u.s16x8[0], vec_splat_u16(N)) };
return SuperVector<16>(vec_sr(u.s16x8[0], vec_splat_u16(N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_32_imm() const
{
return { vec_sr(u.s32x4[0], vec_splat_u32(N)) };
return SuperVector<16>(vec_sr(u.s32x4[0], vec_splat_u32(N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_64_imm() const
{
return { vec_sr(u.s64x2[0], vec_splats((ulong64_t)N)) };
return SuperVector<16>(vec_sr(u.s64x2[0], vec_splats((ulong64_t)N)));
}
template <>
template<uint8_t N>
really_inline SuperVector<16> SuperVector<16>::vshr_128_imm() const
{
return { vec_sld(vec_splat_s8(0), u.s8x16[0], 16 - N) };
return SuperVector<16>(vec_sld(vec_splat_s8(0), u.s8x16[0], 16 - N));
}
template <>
@ -411,7 +411,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_8 (uint8_t const N) const
{
if (N == 0) return *this;
uint8x16_t shift_indices = vec_splats((uint8_t) N);
return { vec_sl(u.u8x16[0], shift_indices) };
return SuperVector<16>(vec_sl(u.u8x16[0], shift_indices));
}
template <>
@ -419,7 +419,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_16 (uint8_t const UNUSED N)
{
if (N == 0) return *this;
uint16x8_t shift_indices = vec_splats((uint16_t) N);
return { vec_sl(u.u16x8[0], shift_indices) };
return SuperVector<16>(vec_sl(u.u16x8[0], shift_indices));
}
template <>
@ -427,7 +427,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_32 (uint8_t const N) const
{
if (N == 0) return *this;
uint32x4_t shift_indices = vec_splats((uint32_t) N);
return { vec_sl(u.u32x4[0], shift_indices) };
return SuperVector<16>(vec_sl(u.u32x4[0], shift_indices));
}
template <>
@ -435,7 +435,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_64 (uint8_t const N) const
{
if (N == 0) return *this;
uint64x2_t shift_indices = vec_splats((ulong64_t) N);
return { vec_sl(u.u64x2[0], shift_indices) };
return SuperVector<16>(vec_sl(u.u64x2[0], shift_indices));
}
template <>
@ -443,7 +443,7 @@ really_inline SuperVector<16> SuperVector<16>::vshl_128(uint8_t const N) const
{
if (N == 0) return *this;
SuperVector sl{N << 3};
return { vec_slo(u.u8x16[0], sl.u.u8x16[0]) };
return SuperVector<16>(vec_slo(u.u8x16[0], sl.u.u8x16[0]));
}
template <>
@ -457,7 +457,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_8 (uint8_t const N) const
{
if (N == 0) return *this;
uint8x16_t shift_indices = vec_splats((uint8_t) N);
return { vec_sr(u.u8x16[0], shift_indices) };
return SuperVector<16>(vec_sr(u.u8x16[0], shift_indices));
}
template <>
@ -465,7 +465,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_16 (uint8_t const N) const
{
if (N == 0) return *this;
uint16x8_t shift_indices = vec_splats((uint16_t) N);
return { vec_sr(u.u16x8[0], shift_indices) };
return SuperVector<16>(vec_sr(u.u16x8[0], shift_indices));
}
template <>
@ -473,7 +473,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_32 (uint8_t const N) const
{
if (N == 0) return *this;
uint32x4_t shift_indices = vec_splats((uint32_t) N);
return { vec_sr(u.u32x4[0], shift_indices) };
return SuperVector<16>(vec_sr(u.u32x4[0], shift_indices));
}
template <>
@ -481,7 +481,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_64 (uint8_t const N) const
{
if (N == 0) return *this;
uint64x2_t shift_indices = vec_splats((ulong64_t) N);
return { vec_sr(u.u64x2[0], shift_indices) };
return SuperVector<16>(vec_sr(u.u64x2[0], shift_indices));
}
template <>
@ -489,7 +489,7 @@ really_inline SuperVector<16> SuperVector<16>::vshr_128(uint8_t const N) const
{
if (N == 0) return *this;
SuperVector sr{N << 3};
return { vec_sro(u.u8x16[0], sr.u.u8x16[0]) };
return SuperVector<16>(vec_sro(u.u8x16[0], sr.u.u8x16[0]));
}
template <>
@ -504,7 +504,7 @@ really_inline SuperVector<16> SuperVector<16>::operator>>(uint8_t const N) const
#if defined(HAVE__BUILTIN_CONSTANT_P)
if (N == 0) return *this;
if (__builtin_constant_p(N)) {
return { vec_sld(vec_splat_s8(0), u.s8x16[0], 16 - N) };
return SuperVector<16>(vec_sld(vec_splat_s8(0), u.s8x16[0], 16 - N));
}
#endif
return vshr_128(N);
@ -516,7 +516,7 @@ really_inline SuperVector<16> SuperVector<16>::operator<<(uint8_t const N) const
#if defined(HAVE__BUILTIN_CONSTANT_P)
if (N == 0) return *this;
if (__builtin_constant_p(N)) {
return { vec_sld(u.s8x16[0], vec_splat_s8(0), N)};
return SuperVector<16>(vec_sld(u.s8x16[0], vec_splat_s8(0), N));
}
#endif
return vshl_128(N);
@ -537,14 +537,14 @@ really_inline SuperVector<16> SuperVector<16>::Ones_vshl(uint8_t const N)
template <>
really_inline SuperVector<16> SuperVector<16>::loadu(void const *ptr)
{
return { vec_xl(0, (const long64_t*)ptr) };
return SuperVector<16>(vec_xl(0, (const long64_t*)ptr));
}
template <>
really_inline SuperVector<16> SuperVector<16>::load(void const *ptr)
{
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
return { vec_xl(0, (const long64_t*)ptr) };
return SuperVector<16>(vec_xl(0, (const long64_t*)ptr));
}
template <>
@ -562,14 +562,14 @@ really_inline SuperVector<16> SuperVector<16>::alignr(SuperVector<16> &other, in
if (offset == 16) return *this;
#if defined(HAVE__BUILTIN_CONSTANT_P)
if (__builtin_constant_p(offset)) {
return { vec_sld(u.s8x16[0], other.u.s8x16[0], offset) };
return SuperVector<16>(vec_sld(u.s8x16[0], other.u.s8x16[0], offset));
}
#endif
uint8x16_t sl = vec_splats((uint8_t) (offset << 3));
uint8x16_t sr = vec_splats((uint8_t) ((16 - offset) << 3));
uint8x16_t rhs = vec_slo(u.u8x16[0], sr);
uint8x16_t lhs = vec_sro(other.u.u8x16[0], sl);
return { vec_or(lhs, rhs) };
return SuperVector<16>(vec_or(lhs, rhs));
}
template<>
@ -581,7 +581,7 @@ really_inline SuperVector<16> SuperVector<16>::pshufb<false>(SuperVector<16> b)
below is the version that is converted from Intel to PPC. */
uint8x16_t mask =(uint8x16_t)vec_cmpge(b.u.u8x16[0], vec_splats((uint8_t)0x80));
uint8x16_t res = vec_perm (u.u8x16[0], u.u8x16[0], b.u.u8x16[0]);
return { vec_sel(res, vec_splat_u8(0), mask) };
return SuperVector<16>(vec_sel(res, vec_splat_u8(0), mask));
}
template<>

File diff suppressed because it is too large Load Diff

View File

@ -205,21 +205,21 @@ public:
constexpr SuperVector() {};
SuperVector(SuperVector const &other)
:u(other.u) {};
SuperVector(typename base_type::type const v);
explicit SuperVector(typename base_type::type const v);
template<typename T>
SuperVector(T const other);
explicit SuperVector(T const other);
SuperVector(SuperVector<SIZE/2> const lo, SuperVector<SIZE/2> const hi);
SuperVector(previous_type const lo, previous_type const hi);
static SuperVector dup_u8 (uint8_t other) { return {other}; };
static SuperVector dup_s8 (int8_t other) { return {other}; };
static SuperVector dup_u8 (uint8_t other) { return {SuperVector(other)}; };
static SuperVector dup_s8 (int8_t other) { return {SuperVector(other)}; };
static SuperVector dup_u16(uint16_t other) { return {other}; };
static SuperVector dup_s16(int16_t other) { return {other}; };
static SuperVector dup_u32(uint32_t other) { return {other}; };
static SuperVector dup_s32(int32_t other) { return {other}; };
static SuperVector dup_u64(uint64_t other) { return {other}; };
static SuperVector dup_u64(uint64_t other) { return {SuperVector(other)}; };
static SuperVector dup_s64(int64_t other) { return {other}; };
void operator=(SuperVector const &other);

View File

@ -210,14 +210,14 @@ TEST(Shuffle, PackedExtract_templatized_128_1) {
SuperVector<16> permute = SuperVector<16>::Zeroes();
SuperVector<16> compare = SuperVector<16>::Zeroes();
build_pshufb_masks_onebit(i, &permute.u.v128[0], &compare.u.v128[0]);
EXPECT_EQ(1U, packedExtract<16>(setbit<m128>(i), permute, compare));
EXPECT_EQ(1U, packedExtract<16>(SuperVector<16>(setbit<m128>(i)), permute, compare));
EXPECT_EQ(1U, packedExtract<16>(SuperVector<16>::Ones(), permute, compare));
// we should get zero out of these cases
EXPECT_EQ(0U, packedExtract<16>(SuperVector<16>::Zeroes(), permute, compare));
EXPECT_EQ(0U, packedExtract<16>(not128(setbit<m128>(i)), permute, compare));
EXPECT_EQ(0U, packedExtract<16>(SuperVector<16>(not128(setbit<m128>(i))), permute, compare));
// we should get zero out of all the other bit positions
for (unsigned int j = 0; (j != i && j < 128); j++) {
EXPECT_EQ(0U, packedExtract<16>(setbit<m128>(j), permute, compare));
EXPECT_EQ(0U, packedExtract<16>(SuperVector<16>(setbit<m128>(j)), permute, compare));
}
}
}
@ -251,14 +251,14 @@ TEST(Shuffle, PackedExtract_templatized_256_1) {
SuperVector<32> permute = SuperVector<32>::Zeroes();
SuperVector<32> compare = SuperVector<32>::Zeroes();
build_pshufb_masks_onebit(i, &permute.u.v256[0], &compare.u.v256[0]);
EXPECT_EQ(1U, packedExtract<32>(setbit<m256>(i), permute, compare));
EXPECT_EQ(1U, packedExtract<32>(SuperVector<32>(setbit<m256>(i)), permute, compare));
EXPECT_EQ(1U, packedExtract<32>(SuperVector<32>::Ones(), permute, compare));
// we should get zero out of these cases
EXPECT_EQ(0U, packedExtract<32>(SuperVector<32>::Zeroes(), permute, compare));
EXPECT_EQ(0U, packedExtract<32>(not256(setbit<m256>(i)), permute, compare));
EXPECT_EQ(0U, packedExtract<32>(SuperVector<32>(not256(setbit<m256>(i))), permute, compare));
// we should get zero out of all the other bit positions
for (unsigned int j = 0; (j != i && j < 256); j++) {
EXPECT_EQ(0U, packedExtract<32>(setbit<m256>(j), permute, compare));
EXPECT_EQ(0U, packedExtract<32>(SuperVector<32>(setbit<m256>(j)), permute, compare));
}
}
}
@ -291,14 +291,14 @@ TEST(Shuffle, PackedExtract_templatized_512_1) {
SuperVector<64> permute = SuperVector<64>::Zeroes();
SuperVector<64> compare = SuperVector<64>::Zeroes();
build_pshufb_masks_onebit(i, &permute.u.v512[0], &compare.u.v512[0]);
EXPECT_EQ(1U, packedExtract<64>(setbit<m512>(i), permute, compare));
EXPECT_EQ(1U, packedExtract<64>(SuperVector<64>(setbit<m512>(i)), permute, compare));
EXPECT_EQ(1U, packedExtract<64>(SuperVector<64>::Ones(), permute, compare));
// we should get zero out of these cases
EXPECT_EQ(0U, packedExtract<64>(SuperVector<64>::Zeroes(), permute, compare));
EXPECT_EQ(0U, packedExtract<64>(not512(setbit<m512>(i)), permute, compare));
EXPECT_EQ(0U, packedExtract<64>(SuperVector<64>(not512(setbit<m512>(i))), permute, compare));
// we should get zero out of all the other bit positions
for (unsigned int j = 0; (j != i && j < 512); j++) {
EXPECT_EQ(0U, packedExtract<64>(setbit<m512>(j), permute, compare));
EXPECT_EQ(0U, packedExtract<64>(SuperVector<64>(setbit<m512>(j)), permute, compare));
}
}
}