Community
cancel
Showing results for 
Search instead for 
Did you mean: 
唐黎_唐_
Beginner
79 Views

Addressing is slow

Hi,

I am using AVX and want to mplement a simple serial search. My code is like the following:

    __m256 cmp = _mm256_load_ps(array);
    __m256 keys = _mm256_broadcast_ss(key);
    __m256 res= _mm256_cmp_ps(keys, cmp, 0);
    int tmp =  _mm256_movemask_ps(res);
    switch (tmp) {
      case 0: ind = 0;
      case 1: ind = 1;
      case 2: ind = 2;
      case 4: ind = 3;
      case 8: ind = 4;
      ......
    }

I also tried lookup table, but they are both very slow. Any ideas to improve it? Thanks

0 Kudos
2 Replies
styc
Beginner
79 Views

You can find some ideas at http://en.wikipedia.org/wiki/Find_first_set
SergeyKostrov
Valued Contributor II
79 Views

>>...I also tried lookup table, but they are both very slow. Any ideas to improve it? I recommend you to look at a latest version of Intel Optimization Manual ( 04.2012 ) at: www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html The Manual has a new chapter dedicated to string processing.
Reply