Select Git revision
sve_complex_double.hpp
sve_complex_double.hpp 7.35 KiB
/*
Copyright (C) 2019, Forschungszentrum Juelich
Author(s): Bine Brank, b.brank@fz-juelich.de
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name(s) of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SVE_COMPLEX_DOUBLE_HPP
#define SVE_COMPLEX_DOUBLE_HPP
template<>
struct svetype<complex<double>>{
typedef svfloat64x2_t vec;
typedef svuint64_t intvec;
typedef complex<double> scal;
static inline vec vload(svbool_t pg, const scal *base)
{ return svld2_f64(pg, (float64_t *) base); }
static inline vec vload_gatherindex(svbool_t pg, const scal *base, intvec indices )
{
intvec index = svmul_z(pg, indices, 2);
svfloat64_t real = svld1_gather_index(pg, (float64_t *) base, index);
svfloat64_t imag = svld1_gather_index(pg, ((float64_t *) base) + 1, index);
return {real, imag};
}
static inline void vstore(svbool_t pg, scal* base, vec data)
{ svst2_f64(pg, (float64_t *) base, data); }
static inline intvec index(int64_t base, int64_t step)
{ return svindex_u64(base, step); }
static inline uint64_t count()
{ return svcntd(); }
static inline svbool_t svtrue()
{ return svptrue_b64(); }
static inline svbool_t svwhile(int64_t op1, int64_t op2)
{ return svwhilelt_b64(op1, op2); }
static inline vec dup_all(scal op)
{ return {svdup_f64(real(op)), svdup_f64(imag(op))};}