Skip to content

Commit

Permalink
Removed LANGULUS_ERROR macro entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
Epixu committed Oct 18, 2024
1 parent 0041fb5 commit 5f2391a
Show file tree
Hide file tree
Showing 33 changed files with 147 additions and 147 deletions.
20 changes: 10 additions & 10 deletions source/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger32<T>)
return V128<std::uint64_t> {simde_mm_unpacklo_epi32(m, Zero())};
else
LANGULUS_ERROR("Can't unpack this type");
static_assert(false, "Can't unpack this type");
}

NOD() LANGULUS(INLINED)
Expand All @@ -361,7 +361,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger32<T>)
return V128<std::uint64_t> {simde_mm_unpackhi_epi32(m, Zero())};
else
LANGULUS_ERROR("Can't unpack this type");
static_assert(false, "Can't unpack this type");
}

NOD() LANGULUS(INLINED)
Expand Down Expand Up @@ -418,7 +418,7 @@ namespace Langulus::SIMD
return V128<std::uint32_t> {simde_mm_castpd_si128(ordered)};
#endif
}
else LANGULUS_ERROR("Can't unpack this type");
else static_assert(false, "Can't unpack this type");
}
};

Expand Down Expand Up @@ -533,7 +533,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger32<T>)
return V256<std::uint64_t> {simde_mm256_cvtepu32_epi64(simde_mm256_extractf128_si256(m, 0))};
else
LANGULUS_ERROR("Can't unpack this type");
static_assert(false, "Can't unpack this type");
}

NOD() LANGULUS(INLINED)
Expand All @@ -551,7 +551,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger32<T>)
return V256<std::uint64_t> {simde_mm256_cvtepu32_epi64(simde_mm256_extractf128_si256(m, 1))};
else
LANGULUS_ERROR("Can't unpack this type");
static_assert(false, "Can't unpack this type");
}

NOD() LANGULUS(INLINED)
Expand Down Expand Up @@ -620,7 +620,7 @@ namespace Langulus::SIMD
return V256<std::uint32_t> {simde_mm256_castpd_si256(ordered)};
#endif
}
else LANGULUS_ERROR("Can't unpack this type");
else static_assert(false, "Can't unpack this type");
}
};

Expand Down Expand Up @@ -735,7 +735,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger32<T>)
return V512<std::uint64_t> {simde_mm512_unpacklo_epi32(m, Zero())};
else
LANGULUS_ERROR("Can't unpack this type");
static_assert(false, "Can't unpack this type");
}

NOD() LANGULUS(INLINED)
Expand All @@ -753,7 +753,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger32<T>)
return V512<std::uint64_t> {simde_mm512_unpackhi_epi32(m, Zero())};
else
LANGULUS_ERROR("Can't unpack this type");
static_assert(false, "Can't unpack this type");
}

NOD() LANGULUS(INLINED)
Expand Down Expand Up @@ -783,7 +783,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger64<T>)
return V256<std::uint32_t> {simde_mm512_cvtepi64_epi32(m)};
else
LANGULUS_ERROR("Can't pack this type");
static_assert(false, "Can't pack this type");
}
};

Expand Down Expand Up @@ -1120,7 +1120,7 @@ namespace Langulus::SIMD
constexpr int8_t imm8 = static_cast<int8_t>(Shuffle(0, 1, 2, 3));
return simde_mm_shuffle_epi32(what.m, imm8);
}
else LANGULUS_ERROR("TODO");
else static_assert(false, "TODO");
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion source/Convert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Double<T>) return ConvertFrom512d<TO>(in);
else if constexpr (CT::Integer<T>) return ConvertFrom512i<TO>(in);
}
else LANGULUS_ERROR("Can't convert from unsupported");
else static_assert(false, "Can't convert from unsupported");
}

/// Convert scalars/arrays at compile-time, if possible
Expand Down
6 changes: 3 additions & 3 deletions source/Fill.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Langulus::SIMD
else if constexpr (CT::UnsignedInteger64<T>) return V128<T> {simde_x_mm_set1_epu64 ( GetFirst(s))};
else if constexpr (CT::Float<T>) return V128<T> {simde_mm_broadcast_ss (&GetFirst(s))};
else if constexpr (CT::Double<T>) return V128<T> {simde_mm_set1_pd ( GetFirst(s))};
else LANGULUS_ERROR("Unsupported type for filling V128");
else static_assert(false, "Unsupported type for filling V128");
}
else
#endif
Expand All @@ -46,7 +46,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) return V256<T> {simde_mm256_set1_epi64x ( GetFirst(s))};
else if constexpr (CT::Float<T>) return V256<T> {simde_mm256_broadcast_ss (&GetFirst(s))};
else if constexpr (CT::Double<T>) return V256<T> {simde_mm256_broadcast_sd (&GetFirst(s))};
else LANGULUS_ERROR("Unsupported type for filling of V256");
else static_assert(false, "Unsupported type for filling of V256");
}
else
#endif
Expand All @@ -60,7 +60,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) return V512<T> {simde_mm512_set1_epi64 (GetFirst(s))};
else if constexpr (CT::Float<T>) return V512<T> {simde_mm512_set1_ps (GetFirst(s))};
else if constexpr (CT::Double<T>) return V512<T> {simde_mm512_set1_pd (GetFirst(s))};
else LANGULUS_ERROR("Unsupported type for filling of V512");
else static_assert(false, "Unsupported type for filling of V512");
}
else
#endif
Expand Down
8 changes: 4 additions & 4 deletions source/Load.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace Langulus::SIMD
else {
// Cast into another type of regiter, filling the blanks with
// DEF value
LANGULUS_ERROR("TODO use _mm_cast...");
static_assert(false, "TODO use _mm_cast...");
}
}

Expand Down Expand Up @@ -87,7 +87,7 @@ namespace Langulus::SIMD
if constexpr (CT::Float<T>) return V128<T> {simde_mm_loadu_ps (&GetFirst(v))};
else if constexpr (CT::Double<T>) return V128<T> {simde_mm_loadu_pd (&GetFirst(v))};
else if constexpr (CT::Integer<T>) return V128<T> {simde_mm_loadu_si128(&GetFirst(v))};
else LANGULUS_ERROR("Unsupported element");
else static_assert(false, "Unsupported element");
}
else return Set<DEF, 16>(v);
}
Expand All @@ -104,7 +104,7 @@ namespace Langulus::SIMD
if constexpr (CT::Float<T>) return V256<T> {simde_mm256_loadu_ps (&GetFirst(v))};
else if constexpr (CT::Double<T>) return V256<T> {simde_mm256_loadu_pd (&GetFirst(v))};
else if constexpr (CT::Integer<T>) return V256<T> {simde_mm256_loadu_si256(&GetFirst(v))};
else LANGULUS_ERROR("Unsupported element");
else static_assert(false, "Unsupported element");
}
else return Set<DEF, 32>(v);
}
Expand All @@ -121,7 +121,7 @@ namespace Langulus::SIMD
if constexpr (CT::Float<T>) return V512<T> {simde_mm512_loadu_ps (&GetFirst(v))};
else if constexpr (CT::Double<T>) return V512<T> {simde_mm512_loadu_pd (&GetFirst(v))};
else if constexpr (CT::Integer<T>) return V512<T> {simde_mm512_loadu_si512(&GetFirst(v))};
else LANGULUS_ERROR("Unsupported element");
else static_assert(false, "Unsupported element");
}
else return Set<DEF, 64>(v);
}
Expand Down
8 changes: 4 additions & 4 deletions source/SetGet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) return V128<T> {simde_mm_set_epi64x(Get<int64_t, DEF, INDICES, 2, true>(values)...)};
else if constexpr (CT::Float<T>) return V128<T> {simde_mm_setr_ps (Get<simde_float32, DEF, INDICES, 4>(values)...)};
else if constexpr (CT::Double<T>) return V128<T> {simde_mm_setr_pd (Get<simde_float64, DEF, INDICES, 2>(values)...)};
else LANGULUS_ERROR("Can't set 16-byte package");
else static_assert(false, "Can't set 16-byte package");
}
else
#endif
Expand All @@ -99,7 +99,7 @@ namespace Langulus::SIMD
}
else if constexpr (CT::Float<T>) return V256<T> {simde_mm256_setr_ps(Get<simde_float32, DEF, INDICES, 8>(values)...)};
else if constexpr (CT::Double<T>) return V256<T> {simde_mm256_setr_pd(Get<simde_float64, DEF, INDICES, 4>(values)...)};
else LANGULUS_ERROR("Can't set 32-byte package");
else static_assert(false, "Can't set 32-byte package");
}
else
#endif
Expand All @@ -114,11 +114,11 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) return V512<T> {simde_mm512_setr_epi64(Get<int64_t, DEF, INDICES, 8>(values)...)};
else if constexpr (CT::Float<T>) return V512<T> {simde_mm512_setr_ps (Get<simde_float32, DEF, INDICES, 16>(values)...)};
else if constexpr (CT::Double<T>) return V512<T> {simde_mm512_setr_pd (Get<simde_float64, DEF, INDICES, 8>(values)...)};
else LANGULUS_ERROR("Can't set 64-byte package");
else static_assert(false, "Can't set 64-byte package");
}
else
#endif
LANGULUS_ERROR("Unsupported package");
static_assert(false, "Unsupported package");
}

} // namespace Langulus::SIMD::Inner
Expand Down
30 changes: 15 additions & 15 deletions source/Store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) to = simde_mm_movemask_pd (simde_mm_castsi128_pd(from));
else if constexpr (CT::Float<T>) to = simde_mm_movemask_ps (from);
else if constexpr (CT::Double<T>) to = simde_mm_movemask_pd (from);
else LANGULUS_ERROR("Unsupported type");
else static_assert(false, "Unsupported type");
}
else if constexpr (CT::SIMD256<R>) {
if constexpr (CT::Integer8<T>) to = simde_mm256_movemask_epi8(from);
Expand All @@ -43,7 +43,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) to = simde_mm256_movemask_pd (simde_mm256_castsi256_pd(from));
else if constexpr (CT::Float<T>) to = simde_mm256_movemask_ps (from);
else if constexpr (CT::Double<T>) to = simde_mm256_movemask_pd (from);
else LANGULUS_ERROR("Unsupported type");
else static_assert(false, "Unsupported type");
}
else if constexpr (CT::SIMD512<R>) {
if constexpr (CT::Integer8<T>) to = simde_mm512_movemask_epi8(from);
Expand All @@ -56,9 +56,9 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) to = simde_mm512_movemask_pd (simde_mm512_castsi256_pd(from));
else if constexpr (CT::Float<T>) to = simde_mm512_movemask_ps (from);
else if constexpr (CT::Double<T>) to = simde_mm512_movemask_pd (from);
else LANGULUS_ERROR("Unsupported type");
else static_assert(false, "Unsupported type");
}
else LANGULUS_ERROR("Unsupported register");
else static_assert(false, "Unsupported register");
}

/// Save a register to a vector in memory
Expand Down Expand Up @@ -117,7 +117,7 @@ namespace Langulus::SIMD
simde_mm_storeu_pd(&GetFirst(to), from);
}
}
else LANGULUS_ERROR("Shouldn't be reached (storing one double)");
else static_assert(false, "Shouldn't be reached (storing one double)");
}
else if constexpr (CT::Integer<T>) {
// To integer array
Expand All @@ -138,7 +138,7 @@ namespace Langulus::SIMD
memcpy(&GetFirst(to), temp, sizeof(to));
}
}
else LANGULUS_ERROR("Unsupported output");
else static_assert(false, "Unsupported output");
}
else if constexpr (CT::SIMD256<R>) {
if constexpr (CT::Float<T>) {
Expand Down Expand Up @@ -198,7 +198,7 @@ namespace Langulus::SIMD
memcpy(&GetFirst(to), temp, sizeof(to));
}
}
else LANGULUS_ERROR("Unsupported output");
else static_assert(false, "Unsupported output");
}
else if constexpr (CT::SIMD512<R>) {
if constexpr (CT::Float<T>) {
Expand Down Expand Up @@ -258,9 +258,9 @@ namespace Langulus::SIMD
memcpy(&GetFirst(to), temp, sizeof(to));
}
}
else LANGULUS_ERROR("Unsupported output");
else static_assert(false, "Unsupported output");
}
else LANGULUS_ERROR("Unsupported register");
else static_assert(false, "Unsupported register");
}

/// Fallback store routine, doesn't use SIMD, hopefully constexpr
Expand All @@ -287,16 +287,16 @@ namespace Langulus::SIMD
for (Offset i = 0; i < S; ++i)
to[i] = from[i];
}
else LANGULUS_ERROR("Bad output to store a bitmask");
else static_assert(false, "Bad output to store a bitmask");
}
else if constexpr (CT::Scalar<TO>) {
if constexpr (CT::Bool<E>) {
// Collapse the entire bitmask to a single boolean
GetFirst(to) = from;
}
else LANGULUS_ERROR("Bad output to store a bitmask");
else static_assert(false, "Bad output to store a bitmask");
}
else LANGULUS_ERROR("Unsupported destination");
else static_assert(false, "Unsupported destination");
}
else if constexpr (CT::Vector<FROM>) {
// Extract from any range
Expand Down Expand Up @@ -325,7 +325,7 @@ namespace Langulus::SIMD
}
else GetFirst(to) = from;
}
else LANGULUS_ERROR("Unsupported destination");
else static_assert(false, "Unsupported destination");
}
else if constexpr (CT::Scalar<FROM>) {
// Extract from a scalar
Expand All @@ -336,7 +336,7 @@ namespace Langulus::SIMD
}
else GetFirst(to) = from;
}
else LANGULUS_ERROR("Unsupported source");
else static_assert(false, "Unsupported source");
}

} // namespace Langulus::SIMD::Inner
Expand All @@ -353,7 +353,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Supported<FROM>)
Inner::StoreConstexpr(from, to);
//else
// LANGULUS_ERROR("Source not supported");
// static_assert(false, "Source not supported");
}

} // namespace Langulus::SIMD
Expand Down
8 changes: 4 additions & 4 deletions source/binary/Add.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) return simde_mm_add_epi64 (lhs, rhs);
else if constexpr (CT::Float<T>) return simde_mm_add_ps (lhs, rhs);
else if constexpr (CT::Double<T>) return simde_mm_add_pd (lhs, rhs);
else LANGULUS_ERROR("Unsupported type for 16-byte package");
else static_assert(false, "Unsupported type for 16-byte package");
}
else if constexpr (CT::SIMD256<R>) {
if constexpr (CT::SignedInteger8<T>) return simde_mm256_add_epi8 (lhs, rhs);
Expand All @@ -49,7 +49,7 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) return simde_mm256_add_epi64 (lhs, rhs);
else if constexpr (CT::Float<T>) return simde_mm256_add_ps (lhs, rhs);
else if constexpr (CT::Double<T>) return simde_mm256_add_pd (lhs, rhs);
else LANGULUS_ERROR("Unsupported type for 32-byte package");
else static_assert(false, "Unsupported type for 32-byte package");
}
else if constexpr (CT::SIMD512<R>) {
if constexpr (CT::SignedInteger8<T>) return simde_mm512_add_epi8 (lhs, rhs);
Expand All @@ -60,9 +60,9 @@ namespace Langulus::SIMD
else if constexpr (CT::Integer64<T>) return simde_mm512_add_epi64 (lhs, rhs);
else if constexpr (CT::Float<T>) return simde_mm512_add_ps (lhs, rhs);
else if constexpr (CT::Double<T>) return simde_mm512_add_pd (lhs, rhs);
else LANGULUS_ERROR("Unsupported type for 64-byte package");
else static_assert(false, "Unsupported type for 64-byte package");
}
else LANGULUS_ERROR("Unsupported type");
else static_assert(false, "Unsupported type");
}

/// Get sum of values as constexpr, if possible
Expand Down
Loading

0 comments on commit 5f2391a

Please sign in to comment.