Function safe_arch::search_implicit_str_for_index
source · pub fn search_implicit_str_for_index<const IMM: i32>(
needle: m128i,
haystack: m128i,
) -> i32
Available with target feature
sse4.2
only.Expand description
Search for needle
in `haystack, with implicit string length.
In the constant you need to provide (combine with |
):
- A comparison unit:
STR_CMP_U8
,STR_CMP_U16
,STR_CMP_I8
, orSTR_CMP_I16
. - A comparison op:
STR_CMP_EQ_ANY
,STR_CMP_RANGES
,STR_CMP_EQ_EACH
, orSTR_CMP_EQ_ORDERED
. - The desired output:
STR_CMP_FIRST_MATCH
orSTR_CMP_LAST_MATCH
.
The first 0 unit is a null terminator for the string. If the string has no 0 units then the string ends at the end of the register.
If there’s no match the output is the length of the haystack.
- Intrinsic:
_mm_cmpistri
- Assembly:
pcmpistri xmm, xmm, imm8