This will be the last article regarding vectors.
This article deals with string (text) search which is finding the first occurrence of an element. An element can be a byte, halfword, or fullword. The string to search is in the second operand Vector Register and the element(s) to search for is(are) in the third Vector Register. The result is an offset to the element in the searched Vector Register (second operand). If you search for multiple elements the result is the first occurrence of any of the searched elements. My example will show it.
In my example I will use byte search which you will most likely use.
The instruction VFAEB will search for the first occurrence of either “D” or “C” in the text string “ABCDEFGHIJKLMNOP”.
Because “C” comes before “D” in the text string the result will be 2, - the offset to “C” in the text string.