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

# define SIMD_ALIGNMENT_VALUE 32
# define SIMD_WIDTH_R4 4
# define SIMD_WIDTH_R8 4

#ifdef LANGUAGE_FORTRAN
# define SIMD_VECTOR_R4 vector(real(8))
# define SIMD_VECTOR_R8 vector(real(8))

# define LoadS_r4(a)    vec_splats(real(a, kind=8))
# define LoadS_r8(a)    vec_splats(a)

# define Load_r4(a)     vec_ld(0, a)
# define Load_r8(a)     vec_ld(0, a)

# define Store_r4(a, b) call vec_st(b, 0, a)
# define Store_r8(a, b) call vec_st(b, 0, a)
#endif

#ifdef LANGUAGE_C
# define SIMD_VECTOR_R4 vector4double
# define SIMD_VECTOR_R8 vector4double

# define LoadS_r4(a)    vec_splats((double) a)
# define LoadS_r8(a)    vec_splats(a)

# define Load_r4(a)     vec_ld(0L, (double*) &(a))
# define Load_r8(a)     vec_ld(0L, (double*) &(a))

# define Store_r4(a, b) vec_st(b, 0L, (double*) &(a))
# define Store_r8(a, b) vec_st(b, 0L, (double*) &(a))
#endif

# define Sum_r4(a, b)   vec_add(a, b)
# define Sum_r8(a, b)   vec_add(a, b)

# define Diff_r4(a, b)  vec_sub(a, b)
# define Diff_r8(a, b)  vec_sub(a, b)

# define Prod_r4(a, b)  vec_mul(a, b)
# define Prod_r8(a, b)  vec_mul(a, b)

# define Fmadd_r4(a, b, c) vec_madd(a, b, c)
# define Fmadd_r8(a, b, c) vec_madd(a, b, c)

# define Fmsub_r4(a, b, c) vec_msub(a, b, c)
# define Fmsub_r8(a, b, c) vec_msub(a, b, c)

# define ShiftLeft2_r4(a, b, n) vec_sldw(a, b, n)
# define ShiftLeft2_r8(a, b, n) vec_sldw(a, b, n)
