<commit_before>/*  This file is part of the Vc library.

    Copyright (C) 2009 <NAME> <<EMAIL>>

    Vc is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
    published by the Free Software Foundation, either version 3 of
    the License, or (at your option) any later version.

    Vc is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with Vc.  If not, see <http://www.gnu.org/licenses/>.

*/

// when compiling with optimizations the compiler can use an int parameter as an immediate. When
// compiling without optimizations then the parameter has to be used either as register or memory
// location.
#ifdef NO_OPTIMIZATION
#define IMM "r"
#else
#define IMM "n"
#endif

namespace SSE
{
    struct GeneralHelpers
    {
        template<typename VectorType, typename EntryType> static inline VectorType set4(
                const EntryType *m, const unsigned long a, const unsigned long b,
                const unsigned long c, const unsigned long d
                ) {
            VectorType v;
            __m128 t1, t2, t3;
#ifdef __GNUC__
            __asm__("movd 0(%4,%5,4), %3\n\t"
                    "movd 0(%4,%6,4), %2\n\t"
                    "movd 0(%4,%7,4), %1\n\t"
                    "movd 0(%4,%8,4), %0\n\t"
                    "unpcklps %3, %2\n\t"
                    "unpcklps %1, %0\n\t"
                    "movlhps %2, %0\n\t"
                    : "=x"(v), "=x"(t1), "=x"(t2), "=x"(t3)
                    : "r"(m), "r"(a), "r"(b), "r"(c), "r"(d)
                   );
#elif defined(_MSC_VER)
            t3 = _mm_castsi128_ps(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[a])));
            t2 = _mm_castsi128_ps(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[b])));
            t1 = _mm_castsi128_ps(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[c])));
            v  = _mm_castsi128_ps(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[d])));
            t2 = _mm_unpacklo_ps(t2, t3);
            v  = _mm_unpacklo_ps(v , t1);
            v  = _mm_movelh_ps(v, t2);
#else
#error "Check whether inline asm works, or use else clause"
#endif
            return v;
        }

        template<typename Base, typename IndexType, typename EntryType>
        static inline void maskedGatherStructHelper(
                Base &v, const IndexType &indexes, int mask, const EntryType *baseAddr, const int scale
                ) {<commit_msg>add correct casts for v which can be != __m128<commit_after>/*  This file is part of the Vc library.

    Copyright (C) 2009 <NAME> <<EMAIL>>

    Vc is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
    published by the Free Software Foundation, either version 3 of
    the License, or (at your option) any later version.

    Vc is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with Vc.  If not, see <http://www.gnu.org/licenses/>.

*/

#include "casts.h"

// when compiling with optimizations the compiler can use an int parameter as an immediate. When
// compiling without optimizations then the parameter has to be used either as register or memory
// location.
#ifdef NO_OPTIMIZATION
#define IMM "r"
#else
#define IMM "n"
#endif

namespace SSE
{
    struct GeneralHelpers
    {
        template<typename VectorType, typename EntryType> static inline VectorType set4(
                const EntryType *m, const unsigned long a, const unsigned long b,
                const unsigned long c, const unsigned long d
                ) {
            VectorType v;
            __m128 t1, t2, t3;
#ifdef __GNUC__
            __asm__("movd 0(%4,%5,4), %3\n\t"
                    "movd 0(%4,%6,4), %2\n\t"
                    "movd 0(%4,%7,4), %1\n\t"
                    "movd 0(%4,%8,4), %0\n\t"
                    "unpcklps %3, %2\n\t"
                    "unpcklps %1, %0\n\t"
                    "movlhps %2, %0\n\t"
                    : "=x"(v), "=x"(t1), "=x"(t2), "=x"(t3)
                    : "r"(m), "r"(a), "r"(b), "r"(c), "r"(d)
                   );
#elif defined(_MSC_VER)
            t3 = _mm_castsi128_ps(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[a])));
            t2 = _mm_castsi128_ps(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[b])));
            t1 = _mm_castsi128_ps(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[c])));
            v  = mm128_reinterpret_cast<VectorType>(_mm_cvtsi32_si128(reinterpret_cast<const int &>(m[d])));
            t2 = _mm_unpacklo_ps(t2, t3);
            v  = mm128_reinterpret_cast<VectorType>(_mm_unpacklo_ps(mm128_reinterpret_cast<__m128>(v) , t1));
            v  = mm128_reinterpret_cast<VectorType>(_mm_movelh_ps(mm128_reinterpret_cast<__m128>(v), t2));
#else
#error "Check whether inline asm works, or use else clause"
#endif
            return v;
        }

        template<typename Base, typename IndexType, typename EntryType>
        static inline void maskedGatherStructHelper(
                Base &v, const IndexType &indexes, int mask, const EntryType *baseAddr, const int scale
                ) {
{'fraction_non_alphanumeric': 0.10570974014495316, 'fraction_numerical': 0.03234930175004419, 'mean_word_length': 2.3638525564803805, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '312928', 'n_tokens_mistral': 1941, 'n_tokens_neox': 1784, 'n_words': 584}