1.27.0[][src]Function core::arch::x86_64::_mm_cmpestri

pub unsafe fn _mm_cmpestri(
    a: __m128i,
    la: i32,
    b: __m128i,
    lb: i32,
    imm8: i32
) -> i32
This is supported on x86-64 and target feature sse4.2 only.

Compares packed strings a and b with lengths la and lb using the control in imm8 and return the generated index. Similar to _mm_cmpistri with the exception that _mm_cmpistri implicitly determines the length of a and b.

Control modes

The control specified by imm8 may be one or more of the following.

Data size and signedness

Comparison options

Result polarity

Bit returned

Examples

#[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;


// The string we want to find a substring in
let haystack = b"Split \r\n\t line  ";

// The string we want to search for with some
// extra bytes we do not want to search for.
let needle = b"\r\n\t ignore this ";

let a = _mm_loadu_si128(needle.as_ptr() as *const _);
let b = _mm_loadu_si128(haystack.as_ptr() as *const _);

// Note: We explicitly specify we only want to search `b` for the
// first 3 characters of a.
let idx = _mm_cmpestri(a, 3, b, 15, _SIDD_CMP_EQUAL_ORDERED);

assert_eq!(idx, 6);Run

Intel's documentation