#/*
#==============================================================================
#
# simd_sse.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/>.
#
#------------------------------------------------------------------------------
#*/

# include <immintrin.h>

# define SIMD_WIDTH_R4 4
# define SIMD_WIDTH_R8 2

# define SIMD_VECTOR_R4 __m128
# define SIMD_VECTOR_R8 __m128d

# define SIMD_ALIGNMENT_VALUE 16

# define LoadS_r4(a)    _mm_load1_ps((float*) &(a))
# define LoadS_r8(a)    _mm_load1_pd((double*) &(a))

# define Load_r4(a)     _mm_load_ps((float*) &(a))
# define Load_r8(a)     _mm_load_pd((double*) &(a))

# define Store_r4(a, b) _mm_store_ps((float*) &(a), b)
# define Store_r8(a, b) _mm_store_pd((double*) &(a), b)

# define Sum_r4(a, b)   _mm_add_ps(a, b)
# define Sum_r8(a, b)   _mm_add_pd(a, b)

# define Diff_r4(a, b)  _mm_sub_ps(a, b)
# define Diff_r8(a, b)  _mm_sub_pd(a, b)

# define Prod_r4(a, b)  _mm_mul_ps(a, b)
# define Prod_r8(a, b)  _mm_mul_pd(a, b)

# define Fmadd_r4(a, b, c) _mm_add_ps(_mm_mul_ps(a, b), c)
# define Fmadd_r8(a, b, c) _mm_add_pd(_mm_mul_pd(a, b), c)

# define Fmsub_r4(a, b, c) _mm_sub_ps(_mm_mul_ps(a, b), c)
# define Fmsub_r8(a, b, c) _mm_sub_pd(_mm_mul_pd(a, b), c)

# define LoadU_r4(a)     _mm_loadu_ps((float*) &(a))
# define LoadU_r8(a)     _mm_loadu_pd((double*) &(a))
