IPC분류정보
국가/구분 |
United States(US) Patent
등록
|
국제특허분류(IPC7판) |
|
출원번호 |
US-0185244
(2011-07-18)
|
등록번호 |
US-9009447
(2015-04-14)
|
발명자
/ 주소 |
|
출원인 / 주소 |
- Oracle International Corporation
|
대리인 / 주소 |
|
인용정보 |
피인용 횟수 :
1 인용 특허 :
4 |
초록
▼
A processor, method, and medium for using vector instructions to perform string comparisons. A single instruction compares the elements of two vectors and simultaneously checks for the null character. If an inequality or the null character is found, then the string comparison loop terminates, and a
A processor, method, and medium for using vector instructions to perform string comparisons. A single instruction compares the elements of two vectors and simultaneously checks for the null character. If an inequality or the null character is found, then the string comparison loop terminates, and a further check is performed to determine if the strings are equal. If all elements are equal and the null character is not found, then another iteration of the string comparison loop is executed. The vectors are loaded with the next portions of the strings, and then the next comparison is performed. The loop continues until either an inequality or the null character is found.
대표청구항
▼
1. A method comprising: loading a portion of a first string into a first vector register and loading a portion of a second string into a second vector register, wherein each of the first and second vector registers comprises a plurality of N elements, wherein N is an integer;performing two compariso
1. A method comprising: loading a portion of a first string into a first vector register and loading a portion of a second string into a second vector register, wherein each of the first and second vector registers comprises a plurality of N elements, wherein N is an integer;performing two comparison operations simultaneously, wherein a first comparison operation compares each element of the first vector register to a corresponding element of the second vector register, and wherein a second comparison operation compares each element of the first vector register to a null terminating character;storing results of said first and second comparison operations in a third vector register; andresponsive to said results indicating no inequalities or null terminating characters were found, repeating said loading, performing, and storing steps. 2. The method as recited in claim 1, wherein storing results of said first and second comparison operations in a third vector register comprises: responsive to finding an inequality as a result of said first comparison operation, storing a first indicator in a corresponding element of the third vector register;responsive to finding the null terminating character as a result of said second comparison operation, storing a second indicator in a corresponding element of the third vector register; andresponsive to finding neither an inequality as a result of said first comparison nor a null terminating character as a result of said second comparison, storing a third indicator in a corresponding element of the third vector register. 3. The method as recited in claim 1, wherein the third vector register contains both a value for an inequality and a value for the null terminating character. 4. The method as recited in claim 1, wherein a first counter indicates which portion of the first string to load into the first vector register, wherein a second counter indicates which portion of the second string to load into the second vector register, and wherein the method further comprising incrementing the first and second counters by N prior to repeating said loading, performing, and storing steps. 5. The method as recited in claim 1, responsive to said results indicating an inequality or a null terminating character was found, the method further comprising branching to another set of instructions. 6. The method as recited in claim 1, responsive to said results indicating an inequality and a null terminating character were found, the method further comprising assigning priority to a leftmost occurrence of the inequality or the null terminating character. 7. The method as recited in claim 1, wherein each of the first and second strings are terminated with a null terminating character. 8. A processor comprising: a vector unit; anda vector register file, wherein the vector register file comprises a plurality of vector registers, and wherein the vector register file is coupled to the vector unit;wherein the vector unit comprises circuitry configured to: load a portion of a first string into a first vector register and load a portion of a second string into a second vector register, wherein each of the first and second vector registers comprises a plurality of N elements, wherein N is an integer;perform two comparison operations simultaneously, wherein a first comparison operation compares each element of the first vector register to a corresponding element of the second vector register, and wherein a second comparison operation compares each element of the first vector register to a null terminating character;store results of said first and second comparison operations in a third vector register; andresponsive to said results indicating no inequalities or null terminating characters were found, repeat said loading, performing, and storing steps. 9. The processor as recited in claim 8, wherein storing results of said first and second comparison operations in a third vector register comprises: responsive to finding an inequality as a result of said first comparison operation, storing a first indicator in a corresponding element of the third vector register;responsive to finding the null terminating character as a result of said second comparison operation, storing a second indicator in a corresponding element of the third vector register; andresponsive to finding neither an inequality as a result of said first comparison nor a null terminating character as a result of said second comparison, storing a third indicator in a corresponding element of the third vector register. 10. The processor as recited in claim 8, wherein the third vector register contains both a value for an inequality and a value for the null terminating character. 11. The processor as recited in claim 8, wherein a first counter indicates which portion of the first string to load into the first vector register, wherein a second counter indicates which portion of the second string to load into the second vector register, and wherein the vector unit is further configured to increment the first and second counters by N prior to repeating said loading, performing, and storing steps. 12. The processor as recited in claim 8, responsive to said results indicating an inequality or a null terminating character was found, the vector unit is further configured to branch to another set of instructions. 13. The processor as recited in claim 8, responsive to said results indicating an inequality and a null terminating character were found, the vector unit is further configured to assign priority to a leftmost occurrence of the inequality or the null terminating character. 14. The processor as recited in claim 8, wherein each of the first and second strings are terminated with a null terminating character. 15. A non-transitory computer readable storage medium comprising program instructions, wherein when executed the program instructions are operable to: load a portion of a first string into a first vector register and load a portion of a second string into a second vector register, wherein each of the first and second vector registers comprises a plurality of N elements, wherein N is an integer;perform two comparison operations simultaneously, wherein a first comparison operation compares each element of the first vector register to a corresponding element of the second vector register, and wherein a second comparison operation compares each element of the first vector register to a null terminating character;store results of said first and second comparison operations in a third vector register; andresponsive to said results indicating no inequalities or null terminating characters were found, repeat said loading, performing, and storing steps. 16. The non-transitory computer readable storage medium as recited in claim 15, wherein storing results of said first and second comparison operations in a third vector register comprises: responsive to finding an inequality as a result of said first comparison operation, storing a first indicator in a corresponding element of the third vector register;responsive to finding the null terminating character as a result of said second comparison operation, storing a second indicator in a corresponding element of the third vector register; andresponsive to finding neither an inequality as a result of said first comparison nor a null terminating character as a result of said second comparison, storing a third indicator in a corresponding element of the third vector register. 17. The non-transitory computer readable storage medium as recited in claim 15, wherein the third vector register contains both a value for an inequality and a value for the null terminating character. 18. The non-transitory computer readable storage medium as recited in claim 15, wherein a first counter indicates which portion of the first string to load into the first vector register, wherein a second counter indicates which portion of the second string to load into the second vector register, and wherein when executed the program instructions are further operable to increment the first and second counters by N prior to repeating said loading, performing, and storing steps. 19. The non-transitory computer readable storage medium as recited in claim 15, responsive to said results indicating an inequality or a null terminating character was found, the program instructions are further operable to branch to another set of instructions. 20. The non-transitory computer readable storage medium as recited in claim 15, responsive to said results indicating an inequality and a null terminating character were found, the program instructions are further operable to assign priority to a leftmost occurrence of the inequality or the null terminating character.
※ AI-Helper는 부적절한 답변을 할 수 있습니다.