// Copyright Naoki Shibata and contributors 2010 - 2023. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #if !(defined(ENABLE_SVE) || defined(ENABLE_SVENOFMA) || defined(ENABLE_RVVM1) || defined(ENABLE_RVVM1NOFMA) || defined(ENABLE_RVVM2) || defined(ENABLE_RVVM2NOFMA)) typedef struct { vdouble x, y, z; } vdouble3; static INLINE CONST VECTOR_CC vdouble vd3getx_vd_vd3(vdouble3 v) { return v.x; } static INLINE CONST VECTOR_CC vdouble vd3gety_vd_vd3(vdouble3 v) { return v.y; } static INLINE CONST VECTOR_CC vdouble vd3getz_vd_vd3(vdouble3 v) { return v.z; } static INLINE CONST VECTOR_CC vdouble3 vd3setxyz_vd3_vd_vd_vd(vdouble x, vdouble y, vdouble z) { vdouble3 v = { x, y, z }; return v; } static INLINE CONST VECTOR_CC vdouble3 vd3setx_vd3_vd3_vd(vdouble3 v, vdouble d) { v.x = d; return v; } static INLINE CONST VECTOR_CC vdouble3 vd3sety_vd3_vd3_vd(vdouble3 v, vdouble d) { v.y = d; return v; } static INLINE CONST VECTOR_CC vdouble3 vd3setz_vd3_vd3_vd(vdouble3 v, vdouble d) { v.z = d; return v; } // typedef struct { vdouble2 a, b; } dd2; static dd2 dd2setab_dd2_vd2_vd2(vdouble2 a, vdouble2 b) { dd2 r = { a, b }; return r; } static vdouble2 dd2geta_vd2_dd2(dd2 d) { return d.a; } static vdouble2 dd2getb_vd2_dd2(dd2 d) { return d.b; } // typedef struct { vmask e; vdouble3 d3; } tdx; static INLINE CONST VECTOR_CC vmask tdxgete_vm_tdx(tdx t) { return t.e; } static INLINE CONST VECTOR_CC vdouble3 tdxgetd3_vd3_tdx(tdx t) { return t.d3; } static INLINE CONST VECTOR_CC vdouble tdxgetd3x_vd_tdx(tdx t) { return t.d3.x; } static INLINE CONST VECTOR_CC vdouble tdxgetd3y_vd_tdx(tdx t) { return t.d3.y; } static INLINE CONST VECTOR_CC vdouble tdxgetd3z_vd_tdx(tdx t) { return t.d3.z; } static INLINE CONST VECTOR_CC tdx tdxsete_tdx_tdx_vm(tdx t, vmask e) { t.e = e; return t; } static INLINE CONST VECTOR_CC tdx tdxsetd3_tdx_tdx_vd3(tdx t, vdouble3 d3) { t.d3 = d3; return t; } static INLINE CONST VECTOR_CC tdx tdxsetx_tdx_tdx_vd(tdx t, vdouble x) { t.d3.x = x; return t; } static INLINE CONST VECTOR_CC tdx tdxsety_tdx_tdx_vd(tdx t, vdouble y) { t.d3.y = y; return t; } static INLINE CONST VECTOR_CC tdx tdxsetz_tdx_tdx_vd(tdx t, vdouble z) { t.d3.z = z; return t; } static INLINE CONST VECTOR_CC tdx tdxsetxyz_tdx_tdx_vd_vd_vd(tdx t, vdouble x, vdouble y, vdouble z) { t.d3 = (vdouble3) { x, y, z }; return t; } static INLINE CONST VECTOR_CC tdx tdxseted3_tdx_vm_vd3(vmask e, vdouble3 d3) { return (tdx) { e, d3 }; } static INLINE CONST VECTOR_CC tdx tdxsetexyz_tdx_vm_vd_vd_vd(vmask e, vdouble x, vdouble y, vdouble z) { return (tdx) { e, (vdouble3) { x, y, z } }; } static INLINE CONST VECTOR_CC vmask vqgetx_vm_vq(vquad v) { return v.x; } static INLINE CONST VECTOR_CC vmask vqgety_vm_vq(vquad v) { return v.y; } static INLINE CONST VECTOR_CC vquad vqsetxy_vq_vm_vm(vmask x, vmask y) { return (vquad) { x, y }; } static INLINE CONST VECTOR_CC vquad vqsetx_vq_vq_vm(vquad v, vmask x) { v.x = x; return v; } static INLINE CONST VECTOR_CC vquad vqsety_vq_vq_vm(vquad v, vmask y) { v.y = y; return v; } // typedef struct { vdouble d; vint i; } di_t; static INLINE CONST VECTOR_CC vdouble digetd_vd_di(di_t d) { return d.d; } static INLINE CONST VECTOR_CC vint digeti_vi_di(di_t d) { return d.i; } static INLINE CONST VECTOR_CC di_t disetdi_di_vd_vi(vdouble d, vint i) { di_t r = { d, i }; return r; } // typedef struct { vdouble2 dd; vint i; } ddi_t; static INLINE CONST VECTOR_CC vdouble2 ddigetdd_vd2_ddi(ddi_t d) { return d.dd; } static INLINE CONST VECTOR_CC vint ddigeti_vi_ddi(ddi_t d) { return d.i; } static INLINE CONST VECTOR_CC ddi_t ddisetddi_ddi_vd2_vi(vdouble2 v, vint i) { ddi_t r = { v, i }; return r; } static INLINE CONST VECTOR_CC ddi_t ddisetdd_ddi_ddi_vd2(ddi_t ddi, vdouble2 v) { ddi.dd = v; return ddi; } // typedef struct { vdouble3 td; vint i; } tdi_t; static INLINE CONST VECTOR_CC vdouble3 tdigettd_vd3_tdi(tdi_t d) { return d.td; } static INLINE CONST VECTOR_CC vdouble tdigetx_vd_tdi(tdi_t d) { return d.td.x; } static INLINE CONST VECTOR_CC vint tdigeti_vi_tdi(tdi_t d) { return d.i; } static INLINE CONST VECTOR_CC tdi_t tdisettdi_tdi_vd3_vi(vdouble3 v, vint i) { tdi_t r = { v, i }; return r; } #endif #if defined(ENABLE_MAIN) // Functions for debugging #include #include static void printvmask(char *mes, vmask g) { uint64_t u[VECTLENDP]; vstoreu_v_p_vd((double *)u, vreinterpret_vd_vm(g)); printf("%s ", mes); for(int i=0;i