Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Addressing is slow

唐黎_唐_
Beginner
417 Views

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
417 Views
You can find some ideas at http://en.wikipedia.org/wiki/Find_first_set
0 Kudos
SergeyKostrov
Valued Contributor II
417 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.
0 Kudos
Reply