Reputation: 2507
Are there SSE instructions that could replace part or whole algorithm written below.
There is very long array of short values (byte, or long are acceptable). A value that is greater than some threshold must be found.
Thank you.
Upvotes: 0
Views: 764
Reputation: 212969
Yes, you can just do the following (pseudo code):
Init threshold vector
Found = FALSE
For each vector of N elements
Load vector (_mm_load_si128)
Compare greater than threshold (_mm_cmpgt_XXX)
Move comparison vector to mask (_mm_movemask_epi8)
If mask != 0
Found = TRUE
Break
End
End
Upvotes: 2