|
|
|
@ -110,9 +110,9 @@ VSX_FINLINE(rt) fnm(const rg& a, const rg& b) { return fn2(a, b); } |
|
|
|
|
#if defined(__GNUG__) && !defined(__clang__) |
|
|
|
|
|
|
|
|
|
// inline asm helper
|
|
|
|
|
#define VSX_IMPL_1RG(rt, rto, rg, rgo, opc, fnm) \ |
|
|
|
|
VSX_FINLINE(rt) fnm(const rg& a) \
|
|
|
|
|
{ rt rs; __asm__ __volatile__(#opc" %x0,%x1" : "="#rto (rs) : #rgo (a)); return rs; } |
|
|
|
|
#define VSX_IMPL_1RG(rt, rg, opc, fnm) \ |
|
|
|
|
VSX_FINLINE(rt) fnm(const rg& a) \
|
|
|
|
|
{ rt rs; __asm__ __volatile__(#opc" %x0,%x1" : "=wa" (rs) : "wa" (a)); return rs; } |
|
|
|
|
|
|
|
|
|
#define VSX_IMPL_1VRG(rt, rg, opc, fnm) \ |
|
|
|
|
VSX_FINLINE(rt) fnm(const rg& a) \
|
|
|
|
@ -257,44 +257,38 @@ VSX_REDIRECT_1RG(vec_float4, vec_double2, vec_cvfo, __builtin_vsx_xvcvdpsp) |
|
|
|
|
VSX_REDIRECT_1RG(vec_double2, vec_float4, vec_cvfo, __builtin_vsx_xvcvspdp) |
|
|
|
|
|
|
|
|
|
// converts word and doubleword to double-precision
|
|
|
|
|
#ifdef vec_ctd |
|
|
|
|
# undef vec_ctd |
|
|
|
|
#endif |
|
|
|
|
VSX_IMPL_1RG(vec_double2, wd, vec_int4, wa, xvcvsxwdp, vec_ctdo) |
|
|
|
|
VSX_IMPL_1RG(vec_double2, wd, vec_uint4, wa, xvcvuxwdp, vec_ctdo) |
|
|
|
|
VSX_IMPL_1RG(vec_double2, wd, vec_dword2, wi, xvcvsxddp, vec_ctd) |
|
|
|
|
VSX_IMPL_1RG(vec_double2, wd, vec_udword2, wi, xvcvuxddp, vec_ctd) |
|
|
|
|
#undef vec_ctd |
|
|
|
|
VSX_IMPL_1RG(vec_double2, vec_int4, xvcvsxwdp, vec_ctdo) |
|
|
|
|
VSX_IMPL_1RG(vec_double2, vec_uint4, xvcvuxwdp, vec_ctdo) |
|
|
|
|
VSX_IMPL_1RG(vec_double2, vec_dword2, xvcvsxddp, vec_ctd) |
|
|
|
|
VSX_IMPL_1RG(vec_double2, vec_udword2, xvcvuxddp, vec_ctd) |
|
|
|
|
|
|
|
|
|
// converts word and doubleword to single-precision
|
|
|
|
|
#undef vec_ctf |
|
|
|
|
VSX_IMPL_1RG(vec_float4, wf, vec_int4, wa, xvcvsxwsp, vec_ctf) |
|
|
|
|
VSX_IMPL_1RG(vec_float4, wf, vec_uint4, wa, xvcvuxwsp, vec_ctf) |
|
|
|
|
VSX_IMPL_1RG(vec_float4, wf, vec_dword2, wi, xvcvsxdsp, vec_ctfo) |
|
|
|
|
VSX_IMPL_1RG(vec_float4, wf, vec_udword2, wi, xvcvuxdsp, vec_ctfo) |
|
|
|
|
VSX_IMPL_1RG(vec_float4, vec_int4, xvcvsxwsp, vec_ctf) |
|
|
|
|
VSX_IMPL_1RG(vec_float4, vec_uint4, xvcvuxwsp, vec_ctf) |
|
|
|
|
VSX_IMPL_1RG(vec_float4, vec_dword2, xvcvsxdsp, vec_ctfo) |
|
|
|
|
VSX_IMPL_1RG(vec_float4, vec_udword2, xvcvuxdsp, vec_ctfo) |
|
|
|
|
|
|
|
|
|
// converts single and double precision to signed word
|
|
|
|
|
#undef vec_cts |
|
|
|
|
VSX_IMPL_1RG(vec_int4, wa, vec_double2, wd, xvcvdpsxws, vec_ctso) |
|
|
|
|
VSX_IMPL_1RG(vec_int4, wa, vec_float4, wf, xvcvspsxws, vec_cts) |
|
|
|
|
VSX_IMPL_1RG(vec_int4, vec_double2, xvcvdpsxws, vec_ctso) |
|
|
|
|
VSX_IMPL_1RG(vec_int4, vec_float4, xvcvspsxws, vec_cts) |
|
|
|
|
|
|
|
|
|
// converts single and double precision to unsigned word
|
|
|
|
|
#undef vec_ctu |
|
|
|
|
VSX_IMPL_1RG(vec_uint4, wa, vec_double2, wd, xvcvdpuxws, vec_ctuo) |
|
|
|
|
VSX_IMPL_1RG(vec_uint4, wa, vec_float4, wf, xvcvspuxws, vec_ctu) |
|
|
|
|
VSX_IMPL_1RG(vec_uint4, vec_double2, xvcvdpuxws, vec_ctuo) |
|
|
|
|
VSX_IMPL_1RG(vec_uint4, vec_float4, xvcvspuxws, vec_ctu) |
|
|
|
|
|
|
|
|
|
// converts single and double precision to signed doubleword
|
|
|
|
|
#ifdef vec_ctsl |
|
|
|
|
# undef vec_ctsl |
|
|
|
|
#endif |
|
|
|
|
VSX_IMPL_1RG(vec_dword2, wi, vec_double2, wd, xvcvdpsxds, vec_ctsl) |
|
|
|
|
VSX_IMPL_1RG(vec_dword2, wi, vec_float4, wf, xvcvspsxds, vec_ctslo) |
|
|
|
|
#undef vec_ctsl |
|
|
|
|
VSX_IMPL_1RG(vec_dword2, vec_double2, xvcvdpsxds, vec_ctsl) |
|
|
|
|
VSX_IMPL_1RG(vec_dword2, vec_float4, xvcvspsxds, vec_ctslo) |
|
|
|
|
|
|
|
|
|
// converts single and double precision to unsigned doubleword
|
|
|
|
|
#ifdef vec_ctul |
|
|
|
|
# undef vec_ctul |
|
|
|
|
#endif |
|
|
|
|
VSX_IMPL_1RG(vec_udword2, wi, vec_double2, wd, xvcvdpuxds, vec_ctul) |
|
|
|
|
VSX_IMPL_1RG(vec_udword2, wi, vec_float4, wf, xvcvspuxds, vec_ctulo) |
|
|
|
|
#undef vec_ctul |
|
|
|
|
VSX_IMPL_1RG(vec_udword2, vec_double2, xvcvdpuxds, vec_ctul) |
|
|
|
|
VSX_IMPL_1RG(vec_udword2, vec_float4, xvcvspuxds, vec_ctulo) |
|
|
|
|
|
|
|
|
|
// just in case if GCC doesn't define it
|
|
|
|
|
#ifndef vec_xl |
|
|
|
|