#/*
#==============================================================================
#
# simd.h
#
#------------------------------------------------------------------------------
#
# Copyright (C) 2012-2016 Hinnerk Stueben
#
# This file is part of BQCD -- Berlin Quantum ChromoDynamics program
#
# BQCD is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BQCD 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BQCD.  If not, see <http://www.gnu.org/licenses/>.
#
#------------------------------------------------------------------------------
#*/

#ifndef SIMD
#ifndef USE_SIMD_GENERIC
# define USE_SIMD_GENERIC
#endif
#endif

#ifdef USE_SIMD_GENERIC
# include "simd_generic.h"
#elif USE_SIMD_GENERIC2
# include "simd_generic2.h"
#elif USE_SIMD_SSE
# include "simd_sse.h"
#elif USE_SIMD_AVX
# include "simd_avx.h"
#elif USE_SIMD_AVX2
# include "simd_avx2.h"
#elif USE_SIMD_AVX512
# include "simd_avx512.h"
#elif USE_SIMD_QPX
# include "simd_qpx.h"
#endif

#ifdef PRECISION_R4
# define SIMD_WIDTH SIMD_WIDTH_R4
# define SIMD_VECTOR SIMD_VECTOR_R4
#endif
#ifdef PRECISION_R8
# define SIMD_WIDTH SIMD_WIDTH_R8
# define SIMD_VECTOR SIMD_VECTOR_R8
#endif

#ifdef PRECISION_R4
# define LoadS(a) LoadS_r4(a)
# define Load(a) Load_r4(a)
# define LoadU(a) LoadU_r4(a)
# define Store(a, b) Store_r4(a, b)
# define ShiftLeft2(a, b, n) ShiftLeft2_r4(a, b, n)
# define Sum(a, b) Sum_r4(a, b)
# define Diff(a, b) Diff_r4(a, b)
# define Prod(a, b) Prod_r4(a, b)
# define Fmadd(a, b, c) Fmadd_r4(a, b, c)
# define Fmsub(a, b, c) Fmsub_r4(a, b, c)
#endif
#ifdef PRECISION_R8
# define LoadS(a) LoadS_r8(a)
# define Load(a) Load_r8(a)
# define LoadU(a) LoadU_r8(a)
# define Store(a, b) Store_r8(a, b)
# define ShiftLeft2(a, b, n) ShiftLeft2_r8(a, b, n)
# define Sum(a, b) Sum_r8(a, b)
# define Diff(a, b) Diff_r8(a, b)
# define Prod(a, b) Prod_r8(a, b)
# define Fmadd(a, b, c) Fmadd_r8(a, b, c)
# define Fmsub(a, b, c) Fmsub_r8(a, b, c)
#endif

# define Add(a, b) Sum(a, b)
# define Sub(a, b) Diff(a, b)
# define Mul(a, b) Prod(a, b)

#ifdef LANGUAGE_FORTRAN
# define Real(a) a%r
# define Imag(a) a%i
#endif

#ifdef LANGUAGE_C
# define Real(a) (a).r
# define Imag(a) (a).i
#endif
