<commit_before>//=======================================================================
// Copyright (c) 2014-2015 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#pragma once

#include <immintrin.h>

#ifdef __clang__
#define ETL_INLINE_VEC_128 inline __m128 __attribute__((__always_inline__, __nodebug__))
#define ETL_INLINE_VEC_128D inline __m128d __attribute__((__always_inline__, __nodebug__))
#else
#define ETL_INLINE_VEC_128 inline __m128 __attribute__((__always_inline__))
#define ETL_INLINE_VEC_128D inline __m128d __attribute__((__always_inline__))
#endif

namespace etl {

template<>
struct intrinsic_traits <float> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 4;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128;
};

template<>
struct intrinsic_traits <double> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 2;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128d;
};

template<>
struct intrinsic_traits <std::complex<float>> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 2;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128;
};

template<>
struct intrinsic_traits <std::complex<double>> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 1;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128d;
};

namespace vec {

inline void storeu(float* memory, __m128 value){
    _mm_storeu_ps(memory, value);
}

inline void storeu(double* memory, __m128d value){
    _mm_storeu_pd(memory, value);
}

inline void storeu(std::complex<float>* memory, __m128 value){<commit_msg>Add some debug support<commit_after>//=======================================================================
// Copyright (c) 2014-2015 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#pragma once

#include <immintrin.h>

#ifdef VECT_DEBUG
#include <iostream>
#endif

#ifdef __clang__
#define ETL_INLINE_VEC_128 inline __m128 __attribute__((__always_inline__, __nodebug__))
#define ETL_INLINE_VEC_128D inline __m128d __attribute__((__always_inline__, __nodebug__))
#else
#define ETL_INLINE_VEC_128 inline __m128 __attribute__((__always_inline__))
#define ETL_INLINE_VEC_128D inline __m128d __attribute__((__always_inline__))
#endif

namespace etl {

template<>
struct intrinsic_traits <float> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 4;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128;
};

template<>
struct intrinsic_traits <double> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 2;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128d;
};

template<>
struct intrinsic_traits <std::complex<float>> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 2;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128;
};

template<>
struct intrinsic_traits <std::complex<double>> {
    static constexpr const bool vectorizable = true;
    static constexpr const std::size_t size = 1;
    static constexpr const std::size_t alignment = 16;

    using intrinsic_type = __m128d;
};

namespace vec {

#ifdef VEC_DEBUG

template<typename T>
void debug_d(T value){
    union test {
        __m128d vec; // a data field, maybe a register, maybe not
        double array[2];
        test(__m128d vec) : vec(vec) {}
    };

    test u_value = value;
    std::cout << "[" << u_value.array[0] << "," << u_value.array[1] << "]" << std::endl;
}

template<typename T>
void debug_s(T value){
    union test {
        __m128 vec; // a data field, maybe a register, maybe not
        float array[4];
        test(__m128 vec) : vec(vec) {}
    };

    test u_value = value;
    std::cout << "[" << u_value.array[0] << "," << u_value.array[1] << ","<< u_value.array[2] << ","<< u_value.array[3] << "]" << std::endl;
}

#else

template<typename T>
std::string debug_d(T){}

template<typename T>
std::string debug_s(T){}

#endif

inline void storeu(float* memory, __m128 value){
    _mm_storeu_ps(memory, value);
}

inline void storeu(double* memory, __m128d value){
    _mm_storeu_pd(memory, value);
}

inline void storeu(std::complex<float>* memory, __m128 value){
{'fraction_non_alphanumeric': 0.1614678899082569, 'fraction_numerical': 0.03058103975535168, 'mean_word_length': 4.751465416178195, 'pattern_counts': {'":': 0, '<': 66, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4419623', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1467, 'n_words': 433}