text: /*
  * Simd Library (http://ermig1979.github.io/Simd).
  *
  * Copyright (c) 2011-2019 Yermalayeu Ihar.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  * copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
  #include "Simd/SimdMemory.h"
  #include "Simd/SimdStore.h"
  #include "Simd/SimdArray.h"
  #include "Simd/SimdPow.h"
  #include "Simd/SimdExp.h"
  #include "Simd/SimdBase.h"
  #include "Simd/SimdSynet.h"
  
  namespace Simd
  {
  #ifdef SIMD_AVX2_ENABLE    
      namespace Avx2
      {
          template<bool align> SIMD_INLINE void SynetElu32f(const float * src, const Avx2::Exp & exp, __m256 alpha, float * dst, size_t offset)
          {
              Avx::Store<align>(dst + offset, exp.Elu(Avx::Load<align>(src + offset), alpha));
          }
  
          template<bool align> void SynetElu32f(const float * src, size_t size, const float * alpha, float * dst)
          {
              __m256 _alpha = _mm256_set1_ps(alpha[0]);
              Avx2::Exp exp;
              size_t sizeF = AlignLo(size, F);
              size_t sizeQF = AlignLo(size, QF);
              size_t i = 0;
              for (; i < sizeQF; i += QF)
              {
                  SynetElu32f<align>(src, exp, _alpha, dst, i + 0 * F);
                  SynetElu32f<align>(src, exp, _alpha, dst, i + 1 * F);
                  SynetElu32f<align>(src, exp, _alpha, dst, i + 2 * F);
                  SynetElu32f<align>(src, exp, _alpha, dst, i + 3 * F);
              }
              for (; i < sizeF; i += F)
                  SynetElu32f<align>(src, exp, _alpha, dst, i);
              for (; i < size; ++i)
                  dst[i] = Base::SynetElu32f(src[i], alpha[0]);
          }
  
          void SynetElu32f(const float * src, size_t size, const float * alpha, float * dst)
          {
              if (Aligned(src) && Aligned(dst))
                  SynetElu32f<true>(src, size, alpha, dst);
              else
                  SynetElu32f<false>(src, size, alpha, dst);
          }
      }
  #endif// SIMD_AVX2_ENABLE
  }
  