Skip to content

Commit

Permalink
constexpr simd vec: simd helpers: apply always_inline attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkautarch committed Sep 14, 2024
1 parent da8fe30 commit 7f7eb3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions glm/detail/simd_constexpr/simd_helpers.inl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace glm::detail
using gcc_vec_t = PaddedVec<L, T, Q>::GccV;
using data_t = typename detail::storage<L, T, detail::is_aligned<Q>::value>::type;

static inline auto gcc_vec_to_data(PaddedVec<L, T, Q> v) {
static inline auto __attribute__((always_inline)) gcc_vec_to_data(PaddedVec<L, T, Q> v) {
if constexpr (L == 3 && !BIsAlignedQ<Q>()) {
data_t d;
std::memcpy(&d, &v, sizeof(d));
Expand All @@ -23,14 +23,14 @@ namespace glm::detail
}
}

static inline auto simd_ctor_scalar(arithmetic auto scalar) {
static inline auto __attribute__((always_inline)) simd_ctor_scalar(arithmetic auto scalar) {
PaddedVec<L, T, Q> v = {};
v.gcc_vec = v.gcc_vec + ( (T)scalar );
return gcc_vec_to_data(v);
}

template <length_t Lx, typename Tx, qualifier Qx> requires (Lx == L)
static inline auto simd_ctor(::glm::vec<Lx, Tx, Qx> v)
static inline auto __attribute__((always_inline)) simd_ctor(::glm::vec<Lx, Tx, Qx> v)
{
using OtherPaddedVec = PaddedVec<Lx, Tx, Qx>;
OtherPaddedVec o = std::bit_cast<OtherPaddedVec>(v.data);
Expand All @@ -39,7 +39,7 @@ namespace glm::detail
}

template <length_t Lx, typename Tx, qualifier Qx> requires (Lx != L && Lx < L)
static inline auto simd_ctor(::glm::vec<Lx, Tx, Qx> v)
static inline auto __attribute__((always_inline)) simd_ctor(::glm::vec<Lx, Tx, Qx> v)
{
using OtherPaddedVec = PaddedVec<Lx, Tx, Qx>;
using OurSizeTheirType = PaddedVec<L, Tx, Qx>;
Expand All @@ -59,7 +59,7 @@ namespace glm::detail
}

template <arithmetic... A>
static inline auto simd_ctor_multi_scalars(A... scalars) requires ( isLengthOfVector<A...>() && SameArithmeticTypes<A...>())
static inline auto __attribute__((always_inline)) simd_ctor_multi_scalars(A... scalars) requires ( isLengthOfVector<A...>() && SameArithmeticTypes<A...>())
{
//assuming that number of scalars is always the same as the length of the to-be-constructed vector
using Tx = typename GetFirstType<A...>::FirstTx;
Expand Down

0 comments on commit 7f7eb3c

Please sign in to comment.