mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
SuperVector vsh* implementations
This commit is contained in:
parent
b1f53f8e49
commit
e084c2d6e4
@ -235,9 +235,9 @@ static really_inline m128 set1_2x64(u64a c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static really_inline u32 movd(const m128 in) {
|
static really_inline u32 movd(const m128 in) {
|
||||||
//return vgetq_lane_u32((uint32x4_t) in, 0);
|
u32 ALIGN_ATTR(16) a[4];
|
||||||
return !!diff128(in, zeroes128());
|
vec_xst((uint32x4_t) in, 0, a);
|
||||||
// #warning FIXME
|
return a[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static really_inline u64a movq(const m128 in) {
|
static really_inline u64a movq(const m128 in) {
|
||||||
@ -254,68 +254,41 @@ m128 load_m128_from_u64a(const u64a *p) {
|
|||||||
|
|
||||||
|
|
||||||
static really_inline u32 extract32from128(const m128 in, unsigned imm) {
|
static really_inline u32 extract32from128(const m128 in, unsigned imm) {
|
||||||
/*
|
u32 ALIGN_ATTR(16) a[4];
|
||||||
#if defined(HS_OPTIMIZE)
|
vec_xst((uint32x4_t) in, 0, a);
|
||||||
return vgetq_lane_u32((uint32x4_t) in, imm);
|
|
||||||
#else
|
|
||||||
switch (imm) {
|
switch (imm) {
|
||||||
case 0:
|
case 0:
|
||||||
return vgetq_lane_u32((uint32x4_t) in, 0);
|
return a[0];break;
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
return vgetq_lane_u32((uint32x4_t) in, 1);
|
return a[1];break;
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
return vgetq_lane_u32((uint32x4_t) in, 2);
|
return a[2];break;
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
return vgetq_lane_u32((uint32x4_t) in, 3);
|
return a[3];break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
// #warning FIXME
|
|
||||||
return vec_any_ne(in,lshift_m128(in,imm));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static really_inline u64a extract64from128(const m128 UNUSED in, unsigned UNUSED imm) {
|
static really_inline u64a extract64from128(const m128 in, unsigned UNUSED imm) {
|
||||||
/* is this
|
|
||||||
#if defined(HS_OPTIMIZE)
|
|
||||||
return vgetq_lane_u64((uint64x2_t) in, imm);
|
|
||||||
#else
|
|
||||||
switch (imm) {
|
|
||||||
case 0:
|
|
||||||
return vgetq_lane_u64((uint32x4_t) in, 0);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
return vgetq_lane_u64((uint32x4_t) in, 1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
u64a ALIGN_ATTR(16) a[2];
|
u64a ALIGN_ATTR(16) a[2];
|
||||||
vec_xst((uint64x2_t) in, 0, a);
|
vec_xst((uint64x2_t) in, 0, a);
|
||||||
switch (imm) {
|
switch (imm) {
|
||||||
case 0: return a[0]; break;
|
case 0:
|
||||||
case 1: return a[1]; break;
|
return a[0];break;
|
||||||
default: return 0; break;
|
case 1:
|
||||||
}
|
return a[1];break;
|
||||||
*/
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static really_inline m128 low64from128(const m128 in) {
|
static really_inline m128 low64from128(const m128 in) {
|
||||||
//u64a ALIGN_ATTR(16) a[2];
|
//u64a ALIGN_ATTR(16) a[2];
|
||||||
//vec_xst((uint64x2_t) in, 0, a);
|
//vec_xst((uint64x2_t) in, 0, a);
|
||||||
//return a[1];
|
//return a[1];
|
||||||
|
// #warning FIXME
|
||||||
return vec_add(in, in);
|
return vec_add(in, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,6 +296,7 @@ static really_inline m128 high64from128(const m128 in) {
|
|||||||
//u64a ALIGN_ATTR(16) a[2];
|
//u64a ALIGN_ATTR(16) a[2];
|
||||||
//vec_xst((uint64x2_t) in, 0, a);
|
//vec_xst((uint64x2_t) in, 0, a);
|
||||||
//return a[0];
|
//return a[0];
|
||||||
|
// #warning FIXME
|
||||||
return vec_add(in, in);
|
return vec_add(in, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,8 +167,6 @@ really_inline SuperVector<16> SuperVector<16>::operator!() const
|
|||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::opandnot(SuperVector<16> const &b) const
|
really_inline SuperVector<16> SuperVector<16>::opandnot(SuperVector<16> const &b) const
|
||||||
{
|
{
|
||||||
//m128 and_res = vec_and(u.v128[0], b.u.v128[0]);
|
|
||||||
//return vec_xor(and_res,and_res);
|
|
||||||
return vec_xor(vec_and(u.v128[0], b.u.v128[0]), vec_and(u.v128[0], b.u.v128[0]));
|
return vec_xor(vec_and(u.v128[0], b.u.v128[0]), vec_and(u.v128[0], b.u.v128[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,35 +184,31 @@ really_inline SuperVector<16> SuperVector<16>::operator!=(SuperVector<16> const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator>(SuperVector<16> const UNUSED &b) const
|
really_inline SuperVector<16> SuperVector<16>::operator>(SuperVector<16> const &b) const
|
||||||
{
|
{
|
||||||
//return {vcgtq_s8((int16x8_t)u.v128[0], (int16x8_t)b.u.v128[0])};
|
int32x4_t v = {u.s32[0] > b.u.s32[0], u.s32[1] > b.u.s32[1], u.s32[2] > b.u.s32[2], u.s32[3] > b.u.s32[3]};
|
||||||
// #warning FIXME
|
return (m128) v;
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator>=(SuperVector<16> const UNUSED &b) const
|
really_inline SuperVector<16> SuperVector<16>::operator>=(SuperVector<16> const &b) const
|
||||||
{
|
{
|
||||||
//return {vcgeq_s8((int16x8_t)u.v128[0], (int16x8_t)b.u.v128[0])};
|
int32x4_t v = {u.s32[0] >= b.u.s32[0], u.s32[1] >= b.u.s32[1], u.s32[2] >= b.u.s32[2], u.s32[3] >= b.u.s32[3]};
|
||||||
// #warning FIXME
|
return (m128) v;
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator<(SuperVector<16> const UNUSED &b) const
|
really_inline SuperVector<16> SuperVector<16>::operator<(SuperVector<16> const &b) const
|
||||||
{
|
{
|
||||||
//return {vcltq_s8((int16x8_t)u.v128[0], (int16x8_t)b.u.v128[0])};
|
int32x4_t v = {u.s32[0] < b.u.s32[0], u.s32[1] < b.u.s32[1], u.s32[2] < b.u.s32[2], u.s32[3] < b.u.s32[3]};
|
||||||
// #warning FIXME
|
return (m128) v;
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator<=(SuperVector<16> const UNUSED &b) const
|
really_inline SuperVector<16> SuperVector<16>::operator<=(SuperVector<16> const &b) const
|
||||||
{
|
{
|
||||||
//return {vcgeq_s8((int16x8_t)u.v128[0], (int16x8_t)b.u.v128[0])};
|
int32x4_t v = {u.s32[0] <= b.u.s32[0], u.s32[1] <= b.u.s32[1], u.s32[2] <= b.u.s32[2], u.s32[3] <= b.u.s32[3]};
|
||||||
// #warning FIXME
|
return (m128) v;
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -222,7 +216,6 @@ template <>
|
|||||||
really_inline SuperVector<16> SuperVector<16>::eq(SuperVector<16> const &b) const
|
really_inline SuperVector<16> SuperVector<16>::eq(SuperVector<16> const &b) const
|
||||||
{
|
{
|
||||||
return (*this == b);
|
return (*this == b);
|
||||||
//return {(m128) vec_cmpeq((int8x16_t)u.v128[0], (int8x16_t)b.u.v128[0])};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -259,99 +252,88 @@ template <>
|
|||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_8_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshl_8_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sl((int8x16_t)u.v128[0], vec_splats((uint8_t)N)) };
|
||||||
//return {(m128)vshlq_n_s8(u.v128[0], N)};
|
//return {(m128)vshlq_n_s8(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_16_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshl_16_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sl((int16x8_t)u.v128[0], vec_splats((uint16_t)N)) };
|
||||||
//return {(m128)vshlq_n_s16(u.v128[0], N)};
|
//return {(m128)vshlq_n_s16(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_32_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshl_32_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sl((int32x4_t)u.v128[0], vec_splats((uint32_t)N)) };
|
||||||
//return {(m128)vshlq_n_s32(u.v128[0], N)};
|
//return {(m128)vshlq_n_s32(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_64_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshl_64_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sl((int64x2_t)u.v128[0], vec_splats((uint64_t)N)) };
|
||||||
//return {(m128)vshlq_n_s64(u.v128[0], N)};
|
//return {(m128)vshlq_n_s64(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_128_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshl_128_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sld((int8x16_t)u.v128[0], (int8x16_t)vec_splat_s8(0), N)};
|
||||||
//return {vextq_s8(vdupq_n_u8(0), (int16x8_t)u.v128[0], 16 - N)};
|
//return {vextq_s8(vdupq_n_u8(0), (int16x8_t)u.v128[0], 16 - N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshl_imm() const
|
||||||
{
|
{
|
||||||
//return vshl_128_imm<N>();
|
return vshl_128_imm<N>();
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_8_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshr_8_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sr((int8x16_t)u.v128[0], vec_splats((uint8_t)N)) };
|
||||||
//return {(m128)vshrq_n_s8(u.v128[0], N)};
|
//return {(m128)vshrq_n_s8(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_16_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshr_16_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sr((int16x8_t)u.v128[0], vec_splats((uint16_t)N)) };
|
||||||
//return {(m128)vshrq_n_s16(u.v128[0], N)};
|
//return {(m128)vshrq_n_s16(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_32_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshr_32_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sr((int32x4_t)u.v128[0], vec_splats((uint32_t)N)) };
|
||||||
//return {(m128)vshrq_n_s32(u.v128[0], N)};
|
//return {(m128)vshrq_n_s32(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_64_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshr_64_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sr((int64x2_t)u.v128[0], vec_splats((uint64_t)N)) };
|
||||||
//return {(m128)vshrq_n_s64(u.v128[0], N)};
|
//return {(m128)vshrq_n_s64(u.v128[0], N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
template<uint8_t N>
|
template<uint8_t N>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_128_imm() const
|
really_inline SuperVector<16> SuperVector<16>::vshr_128_imm() const
|
||||||
{
|
{
|
||||||
|
return { (m128) vec_sld((int8x16_t)vec_splat_s8(0), (int8x16_t)u.v128[0], 16 - N) };
|
||||||
//return {vextq_s8((int16x8_t)u.v128[0], vdupq_n_u8(0), N)};
|
//return {vextq_s8((int16x8_t)u.v128[0], vdupq_n_u8(0), N)};
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -378,63 +360,56 @@ template SuperVector<16> SuperVector<16>::vshr_128_imm<4>() const;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_8 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshl_8 (uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sl((int8x16_t)u.v128[0], vec_splats((uint8_t)n))}; });
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshlq_n_s8(u.v128[0], n)}; });
|
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshlq_n_s8(u.v128[0], n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_16 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshl_16 (uint8_t const UNUSED N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sl((int16x8_t)u.v128[0], vec_splats((uint16_t)n))}; });
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshlq_n_s16(u.v128[0], n)}; });
|
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshlq_n_s16(u.v128[0], n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_32 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshl_32 (uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sl((int32x4_t)u.v128[0], vec_splats((uint32_t)n))}; });
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshlq_n_s32(u.v128[0], n)}; });
|
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshlq_n_s32(u.v128[0], n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_64 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshl_64 (uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshlq_n_s64(u.v128[0], n)}; });
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sl((int64x2_t)u.v128[0], vec_splats((uint64_t)n))}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshl_128(uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshl_128(uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {vextq_s8(vdupq_n_u8(0), (int16x8_t)u.v128[0], 16 - n)}; });
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sld((int8x16_t)u.v128[0], (int8x16_t)vec_splat_s8(0), n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -444,63 +419,56 @@ really_inline SuperVector<16> SuperVector<16>::vshl(uint8_t const N) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_8 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshr_8 (uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sr((int8x16_t)u.v128[0], vec_splats((uint8_t)n))}; });
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshrq_n_s8(u.v128[0], n)}; });
|
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshrq_n_s8(u.v128[0], n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_16 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshr_16 (uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sr((int16x8_t)u.v128[0], vec_splats((uint16_t)n))}; });
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshrq_n_s16(u.v128[0], n)}; });
|
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshrq_n_s16(u.v128[0], n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_32 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshr_32 (uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sr((int32x4_t)u.v128[0], vec_splats((uint32_t)n))}; });
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshrq_n_s32(u.v128[0], n)}; });
|
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshrq_n_s32(u.v128[0], n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_64 (uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshr_64 (uint8_t const N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128)vshrq_n_s64(u.v128[0], n)}; });
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sr((int64x2_t)u.v128[0], vec_splats((uint64_t)n))}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::vshr_128(uint8_t const UNUSED N) const
|
really_inline SuperVector<16> SuperVector<16>::vshr_128(uint8_t const UNUSED N) const
|
||||||
{
|
{
|
||||||
//if (N == 0) return *this;
|
if (N == 0) return *this;
|
||||||
//if (N == 16) return Zeroes();
|
if (N == 16) return Zeroes();
|
||||||
//SuperVector result;
|
SuperVector result;
|
||||||
//Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {vextq_s8((int16x8_t)u.v128[0], vdupq_n_u8(0), n)}; });
|
Unroller<1, 16>::iterator([&,v=this](auto const i) { constexpr uint8_t n = i.value; if (N == n) result = {(m128) vec_sld((int8x16_t)vec_splat_u8(0), (int8x16_t)u.v128[0], 16 - n)}; });
|
||||||
//return result;
|
return result;
|
||||||
// #warning FIXME
|
|
||||||
return Zeroes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -513,21 +481,21 @@ template <>
|
|||||||
really_inline SuperVector<16> SuperVector<16>::operator>>(uint8_t const N) const
|
really_inline SuperVector<16> SuperVector<16>::operator>>(uint8_t const N) const
|
||||||
{
|
{
|
||||||
switch(N) {
|
switch(N) {
|
||||||
case 1: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 15)}; break;
|
case 1: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 15)}; break;
|
||||||
case 2: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 14)}; break;
|
case 2: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 14)}; break;
|
||||||
case 3: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 13)}; break;
|
case 3: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 13)}; break;
|
||||||
case 4: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 12)}; break;
|
case 4: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 12)}; break;
|
||||||
case 5: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 11)}; break;
|
case 5: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 11)}; break;
|
||||||
case 6: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 10)}; break;
|
case 6: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 10)}; break;
|
||||||
case 7: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 9)}; break;
|
case 7: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 9)}; break;
|
||||||
case 8: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 8)}; break;
|
case 8: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 8)}; break;
|
||||||
case 9: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 7)}; break;
|
case 9: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 7)}; break;
|
||||||
case 10: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 6)}; break;
|
case 10: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 6)}; break;
|
||||||
case 11: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 5)}; break;
|
case 11: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 5)}; break;
|
||||||
case 12: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 4)}; break;
|
case 12: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 4)}; break;
|
||||||
case 13: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 3)}; break;
|
case 13: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 3)}; break;
|
||||||
case 14: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 2)}; break;
|
case 14: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 2)}; break;
|
||||||
case 15: return {(m128) vec_sld((int16x8_t) vec_splat_s8(0), (int16x8_t) u.v128[0], 1)}; break;
|
case 15: return {(m128) vec_sld((int8x16_t) vec_splat_s8(0), (int8x16_t) u.v128[0], 1)}; break;
|
||||||
case 16: return Zeroes(); break;
|
case 16: return Zeroes(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@ -538,21 +506,21 @@ template <>
|
|||||||
really_inline SuperVector<16> SuperVector<16>::operator<<(uint8_t const N) const
|
really_inline SuperVector<16> SuperVector<16>::operator<<(uint8_t const N) const
|
||||||
{
|
{
|
||||||
switch(N) {
|
switch(N) {
|
||||||
case 1: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 1)}; break;
|
case 1: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 1)}; break;
|
||||||
case 2: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 2)}; break;
|
case 2: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 2)}; break;
|
||||||
case 3: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 3)}; break;
|
case 3: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 3)}; break;
|
||||||
case 4: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 4)}; break;
|
case 4: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 4)}; break;
|
||||||
case 5: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 5)}; break;
|
case 5: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 5)}; break;
|
||||||
case 6: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 6)}; break;
|
case 6: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 6)}; break;
|
||||||
case 7: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 7)}; break;
|
case 7: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 7)}; break;
|
||||||
case 8: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 8)}; break;
|
case 8: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 8)}; break;
|
||||||
case 9: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 9)}; break;
|
case 9: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 9)}; break;
|
||||||
case 10: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 10)}; break;
|
case 10: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 10)}; break;
|
||||||
case 11: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 11)}; break;
|
case 11: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 11)}; break;
|
||||||
case 12: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 12)}; break;
|
case 12: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 12)}; break;
|
||||||
case 13: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 13)}; break;
|
case 13: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 13)}; break;
|
||||||
case 14: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 14)}; break;
|
case 14: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 14)}; break;
|
||||||
case 15: return {(m128) vec_sld((int16x8_t) u.v128[0], (int16x8_t) vec_splat_s8(0), 15)}; break;
|
case 15: return {(m128) vec_sld((int8x16_t) u.v128[0], (int8x16_t) vec_splat_s8(0), 15)}; break;
|
||||||
case 16: return Zeroes(); break;
|
case 16: return Zeroes(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@ -587,7 +555,7 @@ really_inline SuperVector<16> SuperVector<16>::load(void const *ptr)
|
|||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::loadu_maskz(void const *ptr, uint8_t const len)
|
really_inline SuperVector<16> SuperVector<16>::loadu_maskz(void const *ptr, uint8_t const len)
|
||||||
{
|
{
|
||||||
SuperVector<16> mask = Ones().rshift128_var(16 -len);
|
SuperVector<16> mask = Ones_vshr(16 -len);
|
||||||
mask.print8("mask");
|
mask.print8("mask");
|
||||||
SuperVector<16> v = loadu(ptr);
|
SuperVector<16> v = loadu(ptr);
|
||||||
v.print8("v");
|
v.print8("v");
|
||||||
@ -642,38 +610,8 @@ really_inline SuperVector<16> SuperVector<16>::pshufb<true>(SuperVector<16> b)
|
|||||||
template<>
|
template<>
|
||||||
really_inline SuperVector<16> SuperVector<16>::pshufb_maskz(SuperVector<16> b, uint8_t const len)
|
really_inline SuperVector<16> SuperVector<16>::pshufb_maskz(SuperVector<16> b, uint8_t const len)
|
||||||
{
|
{
|
||||||
SuperVector<16> mask = Ones().rshift128_var(16 -len);
|
SuperVector<16> mask = Ones_vshr(16 -len);
|
||||||
return mask & pshufb(b);
|
return mask & pshufb(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
template<>
|
|
||||||
really_inline SuperVector<16> SuperVector<16>::lshift64(uint8_t const N)
|
|
||||||
{
|
|
||||||
uint64x2_t shift_indices = vec_splats((uint64_t)N);
|
|
||||||
return (m128) vec_sl((int64x2_t)u.v128[0] , shift_indices);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
really_inline SuperVector<16> SuperVector<16>::rshift64(uint8_t const N)
|
|
||||||
{
|
|
||||||
uint64x2_t shift_indices = vec_splats((uint64_t)N);
|
|
||||||
return (m128) vec_sr((int64x2_t)u.v128[0] , shift_indices);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
really_inline SuperVector<16> SuperVector<16>::lshift128(uint8_t const N)
|
|
||||||
{
|
|
||||||
return *this << N;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
really_inline SuperVector<16> SuperVector<16>::rshift128(uint8_t const N)
|
|
||||||
{
|
|
||||||
return *this >> N;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user