]> git.ipfire.org Git - thirdparty/vectorscan.git/commit
Fix double shufti's vector end false positive (#325)
authorypicchi-arm <67330153+ypicchi-arm@users.noreply.github.com>
Wed, 11 Jun 2025 15:55:10 +0000 (16:55 +0100)
committerGitHub <noreply@github.com>
Wed, 11 Jun 2025 15:55:10 +0000 (18:55 +0300)
commit9e9a10ad01fceb2032ae6e36cb0262c4dbba90c7
tree26fe2108580e22c07d07dead76a044c82911e4b5
parentc057c7f0f0f486656939359b863528fd58f838c3
Fix double shufti's vector end false positive (#325)

* Add regression test for double shufti

It tests for false positive at vector edges.

Signed-off-by: Yoan Picchi <yoan.picchi@arm.com>
* Fix double shufti reporting false positives

Double shufti used to offset one vector, resulting in losing one character
at the end of every vector. This was replaced by a magic value indicating a
match. This meant that if the first char of a pattern fell on the last char of
a vector, double shufti would assume the second character is present and
report a match.
This patch fixes it by keeping the previous vector and feeding its data to the
new one when we shift it, preventing any loss of data.

Signed-off-by: Yoan Picchi <yoan.picchi@arm.com>
* vshl() will call the correct implementation

* implement missing vshr_512_imm(), simplifies caller x86 code

* Fix x86 case, use alignr instead

* it's the reverse, the avx512 alignr is incorrect, need to fix

* Make shufti's OR reduce size agnostic

Signed-off-by: Yoan Picchi <yoan.picchi@arm.com>
* Fix test's array size

Signed-off-by: Yoan Picchi <yoan.picchi@arm.com>
* Fix AVX2/AVX512 alignr implementations and unit tests

* Fix Power VSX alignr

---------

Signed-off-by: Yoan Picchi <yoan.picchi@arm.com>
Co-authored-by: Konstantinos Margaritis <konstantinos@vectorcamp.gr>
src/nfa/arm/shufti.hpp
src/nfa/ppc64el/shufti.hpp
src/nfa/shufti_simd.hpp
src/nfa/shufti_sve.hpp
src/nfa/x86/shufti.hpp
src/util/supervector/arch/ppc64el/impl.cpp
src/util/supervector/arch/x86/impl.cpp
unit/internal/shufti.cpp
unit/internal/supervector.cpp