Opcode/Instruction | Op/En | 64/32 bit Mode Support | CPUID Feature Flag | Description |
66 0F 3A 60 /r imm8 PCMPESTRM xmm1, xmm2/m128, imm8 | RMI | V/V | SSE4_2 | Perform a packed comparison of string data with explicit lengths, generating a mask, and storing the result in XMM0 |
VEX.128.66.0F3A.WIG 60 /r ib VPCMPESTRM xmm1, xmm2/m128, imm8 | RMI | V/V | AVX | Perform a packed comparison of string data with explicit lengths, generating a mask, and storing the result in XMM0. |
Op/En | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
RMI | ModRM:reg (r) | ModRM:r/m (r) | imm8 | NA |
The instruction compares data from two string fragments based on the encoded value in the imm8 contol byte (see Section 4.1, “Imm8 Control Byte Operation for PCMPESTRI / PCMPESTRM / PCMPISTRI / PCMPISTRM”), and generates a mask stored to XMM0.
Each string fragment is represented by two values. The first value is an xmm (or possibly m128 for the second operand) which contains the data elements of the string (byte or word data). The second value is stored in an input length register. The input length register is EAX/RAX (for xmm1) or EDX/RDX (for xmm2/m128). The length represents the number of bytes/words which are valid for the respective xmm/m128 data.
The length of each input is interpreted as being the absolute-value of the value in the length register. The absolutevalue computation saturates to 16 (for bytes) and 8 (for words), based on the value of imm8[bit3] when the value in the length register is greater than 16 (8) or less than -16 (-8).
The comparison and aggregation operations are performed according to the encoded value of Imm8 bit fields (see Section 4.1). As defined by imm8[6], IntRes2 is then either stored to the least significant bits of XMM0 (zero extended to 128 bits) or expanded into a byte/word-mask and then stored to XMM0.
Note that the Arithmetic Flags are written in a non-standard manner in order to supply the most relevant information:
CFlag - Reset if IntRes2 is equal to zero, set otherwise ZFlag - Set if absolute-value of EDX is < 16 (8), reset otherwise SFlag - Set if absolute-value of EAX is < 16 (8), reset otherwise OFlag -IntRes2[0]AFlag - Reset PFlag - Reset
Note: In VEX.128 encoded versions, bits (VLMAX-1:128) of XMM0 are zeroed. VEX.vvvv is reserved and must be 1111b, VEX.L must be 0, otherwise the instruction will #UD.
Operating mode/size | Operand1 | Operand 2 | Length1 | Length2 | Result |
16 bit | xmm | xmm/m128 | EAX | EDX | XMM0 |
32 bit | xmm | xmm/m128 | EAX | EDX | XMM0 |
64 bit | xmm | xmm/m128 | EAX | EDX | XMM0 |
64 bit + REX.W | xmm | xmm/m128 | RAX | RDX | XMM0 |
__m128i _mm_cmpestrm (__m128i a, int la, __m128i b, int lb, const int mode);
int | _mm_cmpestra (__m128i a, int la, __m128i b, int lb, const int mode); |
int | _mm_cmpestrc (__m128i a, int la, __m128i b, int lb, const int mode); |
int | _mm_cmpestro (__m128i a, int la, __m128i b, int lb, const int mode); |
int | _mm_cmpestrs (__m128i a, int la, __m128i b, int lb, const int mode); |
int | _mm_cmpestrz (__m128i a, int la, __m128i b, int lb, const int mode); |
None.
See Exceptions Type 4; additionally, this instruction does not cause #GP if the memory operand is not aligned to 16 Byte boundary, and
#UD | If VEX.L = 1. If VEX.vvvv != 1111B. |