So SSE4.2 has a lot of hard-to-understand instructions. Here is another explanation.
Alternative explanation of imm8
imm8 is an 8-bit immediate operand specifying whether the characters are bytes or
words and the type of comparison to do.
Bits [1:0]: Determine source data format.
00: 16 unsigned bytes
01: 8 unsigned words
10: 16 signed bytes
11: 8 signed words
Bits [3:2]: Determine comparison type and aggregation method.
00: Subset: Each character in B is compared for equality with all
the characters in A.
01: Ranges: Each character in B is compared to A pairs. The comparison
basis is greater than or equal for even-indexed elements in A,
and less than or equal for odd-indexed elements in A.
10: Match: Compare each pair of corresponding characters in A and
B for equality.
11: Substring: Search B for substring matches of A.
Bits [5:4]: Determine whether to do a one's complement on the bit
mask of the comparison results. \n
00: No effect. \n
01: Negate the bit mask. \n
10: No effect. \n
11: Negate the bit mask only for bits with an index less than or equal
to the size of \a A or \a B.
Compare packed strings in a and b with lengths la and lb using
the control in imm8, and returns 1 if b "does not contain a null character"
and the resulting mask was zero, and 0 otherwise.
Warning: actually it seems the instruction does accept \0 in input, just the length must be >= count.
It's not clear for what purpose.
So SSE4.2 has a lot of hard-to-understand instructions. Here is another explanation.
Alternative explanation of imm8
imm8 is an 8-bit immediate operand specifying whether the characters are bytes or words and the type of comparison to do.
Bits [1:0]: Determine source data format. 00: 16 unsigned bytes 01: 8 unsigned words 10: 16 signed bytes 11: 8 signed words
Bits [3:2]: Determine comparison type and aggregation method. 00: Subset: Each character in B is compared for equality with all the characters in A. 01: Ranges: Each character in B is compared to A pairs. The comparison basis is greater than or equal for even-indexed elements in A, and less than or equal for odd-indexed elements in A. 10: Match: Compare each pair of corresponding characters in A and B for equality. 11: Substring: Search B for substring matches of A.
Bits [5:4]: Determine whether to do a one's complement on the bit mask of the comparison results. \n 00: No effect. \n 01: Negate the bit mask. \n 10: No effect. \n 11: Negate the bit mask only for bits with an index less than or equal to the size of \a A or \a B.
Compare packed strings in a and b with lengths la and lb using the control in imm8, and returns 1 if b "does not contain a null character" and the resulting mask was zero, and 0 otherwise. Warning: actually it seems the instruction does accept \0 in input, just the length must be >= count. It's not clear for what purpose.