Skip to content
Snippets Groups Projects
Commit cc7ef8c4 authored by Sergey Gorbunov's avatar Sergey Gorbunov
Browse files

L1: SIMD vectors: remove IsHorizontallyEqual()

parent 577e6594
No related branches found
No related tags found
1 merge request!939L1: cleanup SIMD vectors
......@@ -67,26 +67,9 @@ void L1FieldSlice::CheckConsistency() const
{
/* Check SIMD data vectors for consistent initialization */
for (int i = 0; i < L1Constants::size::kMaxNFieldApproxCoefficients; ++i) {
if (!IsHorizontallyEqual(cx[i])) {
std::stringstream msg;
msg << "L1FieldSlice: \"cx[" << i
<< "]\" SIMD vector is inconsistent not all of the words are equal each other: " << cx[i];
throw std::logic_error(msg.str());
}
if (!IsHorizontallyEqual(cy[i])) {
std::stringstream msg;
msg << "L1FieldSlice: \"cy[" << i
<< "]\" SIMD vector is inconsistent not all of the words are equal each other: " << cy[i];
throw std::logic_error(msg.str());
}
if (!IsHorizontallyEqual(cz[i])) {
std::stringstream msg;
msg << "L1FieldSlice: \"cz[" << i
<< "]\" SIMD vector is inconsistent not all of the words are equal each other: " << cz[i];
throw std::logic_error(msg.str());
}
L1Utils::CheckSimdVectorEquality(cx[i], "L1FieldSlice: cx");
L1Utils::CheckSimdVectorEquality(cy[i], "L1FieldSlice: cy");
L1Utils::CheckSimdVectorEquality(cz[i], "L1FieldSlice: cz");
}
}
......
......@@ -44,7 +44,11 @@ namespace L1Utils
[[gnu::always_inline]] inline void CheckSimdVectorEquality(fvec v, const char* name)
{
if (!IsHorizontallyEqual(v)) {
bool ok = true;
for (size_t i = 1; i < fvec::size(); i++) {
ok = ok && (v[i] == v[0]);
}
if (!ok) {
std::stringstream msg;
msg << name << " SIMD vector is inconsistent, not all of the words are equal each other: " << v;
throw std::logic_error(msg.str());
......
......@@ -272,21 +272,6 @@ public:
#define _fvecalignment __attribute__((aligned(fvec::size() * sizeof(fscal))))
/// Checks, if all bands are equal
/// NOTE: two values defined as signaling_NaN() are not equal, thus if there are all or one
/// of the words are kNaN, the function returns false
inline bool IsHorizontallyEqual(const fvec& v)
{
fscal s = v[0];
bool ret = true;
for (int i = 1; i < fvec::size(); i++) {
ret = ret && (v[i] == s);
}
return ret;
}
#include "std_alloc.h"
#endif
......@@ -25,21 +25,6 @@ inline fvec operator+(const fvec& a, fscal b) { return a + fvec(b); }
inline fvec operator-(fscal a, const fvec& b) { return fvec(a) - b; }
inline fvec operator-(const fvec& a, fscal b) { return a - fvec(b); }
/// Checks, if all bands are equal
/// NOTE: two values defined as signaling_NaN() are not equal, thus if there are all or one
/// of the words are kNaN, the function returns false
inline bool IsHorizontallyEqual(const fvec& v)
{
fscal s = v[0];
bool ret = true;
for (size_t i = 1; i < fvec::size(); i++) {
ret = ret && (v[i] == s);
}
return ret;
}
#include "std_alloc.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment