mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
SuperVector constructors as well as andnot implementation fixed
This commit is contained in:
parent
d9d39d48c5
commit
ba90cdeb5a
@ -43,7 +43,7 @@ const SuperVector<S> blockSingleMask(SuperVector<S> mask_lo, SuperVector<S> mask
|
||||
c_lo = mask_lo.template pshufb<false>(c_lo);
|
||||
c_hi = mask_hi.template pshufb<false>(c_hi);
|
||||
|
||||
return (c_lo & c_hi) > (SuperVector<S>::Zeroes());
|
||||
return (c_lo & c_hi).eq(SuperVector<S>::Zeroes());
|
||||
}
|
||||
|
||||
template <uint16_t S>
|
||||
@ -72,5 +72,5 @@ SuperVector<S> blockDoubleMask(SuperVector<S> mask1_lo, SuperVector<S> mask1_hi,
|
||||
SuperVector<S> t = t1 | (t2.template vshr_128_imm<1>());
|
||||
t.print8("t");
|
||||
|
||||
return !t.eq(SuperVector<S>::Ones());
|
||||
return t.eq(SuperVector<S>::Ones());
|
||||
}
|
||||
|
@ -30,10 +30,10 @@
|
||||
template <>
|
||||
really_really_inline
|
||||
const u8 *firstMatch<16>(const u8 *buf, SuperVector<16> v) {
|
||||
if (unlikely(vec_any_ne(v.u.v128[0], SuperVector<16>::Ones().u.v128[0]))) {
|
||||
SuperVector<16>::movemask_type z = v.movemask();
|
||||
DEBUG_PRINTF("buf %p z %08x \n", buf, z);
|
||||
DEBUG_PRINTF("z %08x\n", z);
|
||||
if (unlikely(z != 0xffff)) {
|
||||
u32 pos = ctz32(~z & 0xffff);
|
||||
DEBUG_PRINTF("~z %08x\n", ~z);
|
||||
DEBUG_PRINTF("match @ pos %u\n", pos);
|
||||
@ -47,10 +47,10 @@ const u8 *firstMatch<16>(const u8 *buf, SuperVector<16> v) {
|
||||
template <>
|
||||
really_really_inline
|
||||
const u8 *lastMatch<16>(const u8 *buf, SuperVector<16> v) {
|
||||
if (unlikely(vec_any_ne(v.u.v128[0], SuperVector<16>::Ones().u.v128[0]))) {
|
||||
SuperVector<16>::movemask_type z = v.movemask();
|
||||
DEBUG_PRINTF("buf %p z %08x \n", buf, z);
|
||||
DEBUG_PRINTF("z %08x\n", z);
|
||||
if (unlikely(z != 0xffff)) {
|
||||
u32 pos = clz32(~z & 0xffff);
|
||||
DEBUG_PRINTF("~z %08x\n", ~z);
|
||||
DEBUG_PRINTF("match @ pos %u\n", pos);
|
||||
|
@ -74,7 +74,7 @@ template<>
|
||||
template<>
|
||||
really_inline SuperVector<16>::SuperVector<uint8_t>(uint8_t const other)
|
||||
{
|
||||
u.v128[0] = (m128) vec_splats(static_cast<int8_t>(other));
|
||||
u.v128[0] = (m128) vec_splats(static_cast<uint8_t>(other));
|
||||
}
|
||||
|
||||
template<>
|
||||
@ -88,7 +88,7 @@ template<>
|
||||
template<>
|
||||
really_inline SuperVector<16>::SuperVector<uint16_t>(uint16_t const other)
|
||||
{
|
||||
u.v128[0] = (m128) vec_splats(static_cast<int8_t>(other));
|
||||
u.v128[0] = (m128) vec_splats(static_cast<uint16_t>(other));
|
||||
}
|
||||
|
||||
template<>
|
||||
@ -102,7 +102,7 @@ template<>
|
||||
template<>
|
||||
really_inline SuperVector<16>::SuperVector<uint32_t>(uint32_t const other)
|
||||
{
|
||||
u.v128[0] = (m128) vec_splats(static_cast<int8_t>(other));
|
||||
u.v128[0] = (m128) vec_splats(static_cast<uint32_t>(other));
|
||||
}
|
||||
|
||||
template<>
|
||||
@ -116,7 +116,7 @@ template<>
|
||||
template<>
|
||||
really_inline SuperVector<16>::SuperVector<uint64_t>(uint64_t const other)
|
||||
{
|
||||
u.v128[0] = (m128) vec_splats(static_cast<int8_t>(other));
|
||||
u.v128[0] = (m128) vec_splats(static_cast<uint64_t>(other));
|
||||
}
|
||||
|
||||
// Constants
|
||||
@ -167,7 +167,8 @@ really_inline SuperVector<16> SuperVector<16>::operator!() const
|
||||
template <>
|
||||
really_inline SuperVector<16> SuperVector<16>::opandnot(SuperVector<16> const &b) const
|
||||
{
|
||||
return vec_xor(vec_and(u.v128[0], b.u.v128[0]), vec_and(u.v128[0], b.u.v128[0]));
|
||||
m128 not_res = vec_xor(u.v128[0], (m128)vec_splat_s8(-1));
|
||||
return {(m128) vec_and(not_res, (m128)b.u.v128[0]) };
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user