https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115362

--- Comment #1 from Jon Daniel <jondaniel879 at gmail dot com> ---
the generated code should be similar to the following using __m128 as
FIRST/OTHER type for floating point.

inline constexpr uint8_t mask4dp(size_t n)
{
        switch(n)
        {
                case 1: return 0xff >> 3;
                case 2: return 0xff >> 2;
                case 3: return 0xff >> 1;
                case 4: return 0xff >> 0;
        }
}

template<size_t N, typename FIRST, typename... OTHER>
static inline constexpr FIRST dot(FIRST first, OTHER&&... other)
{
   return _mm_dp_ps(first, (... * std::forward<OTHER>(other)), mask4dp(N));
}

Reply via email to