Changeset 406 for trunk/lib/sse_simd_t.h


Ignore:
Timestamp:
May 26, 2010, 5:41:47 PM (9 years ago)
Author:
ksherdy
Message:

Add SSE2 pack<32>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/sse_simd_t.h

    r401 r406  
    6363typedef __m128i SIMD_type;
    6464
    65 static inline void print_bit_block(const char * var_name, SIMD_type v);
     65static void print_bit_block(const char * var_name, SIMD_type v);
     66static void print_simd_register(const char * var_name, SIMD_type v);
    6667
    6768/*------------------------------------------------------------*/
     
    232233
    233234// Shuffle 8-bit
     235#ifdef __SSSE3__
    234236template <> inline SIMD_type simd<8>::shuffle(SIMD_type r, SIMD_type s) {
    235237  return _mm_shuffle_epi8(r,s); // SSSE3 dependency
    236238}
     239#endif
     240
    237241
    238242/* Shift immediate operations with direct implementation by built-ins. */
     
    480484  #endif
    481485
    482   // Fall back, SSSE3 dependency
    483   return  simd_or (_mm_shuffle_epi8(simd_andc(r1, simd<32>::himask()), _mm_set_epi8(0,1,4,5,8,9,12,13,2,3,6,7,10,11,14,15)),
    484                      _mm_shuffle_epi8(simd_andc(r2, simd<32>::himask()), _mm_set_epi8(2,3,6,7,10,11,14,15,0,1,4,5,8,9,12,13)));
    485 
     486  #ifdef __SSSE3__
     487        return  simd_or (_mm_shuffle_epi8(simd_andc(r1, simd<32>::himask()), _mm_set_epi8(13,12,9,8,5,4,1,0,15,15,15,15,15,15,15,15)),
     488                     _mm_shuffle_epi8(simd_andc(r2, simd<32>::himask()), _mm_set_epi8(15,15,15,15,15,15,15,15,13,12,9,8,5,4,1,0))); // 15 contains 0
     489  #endif
     490
     491  SIMD_type temp1 = simd_andc(simd<16>::pack(r1,r2), simd<16>::himask());
     492  SIMD_type temp2 = simd<16>::slli<8>(simd<16>::pack(simd<16>::srli<8>(r1),simd<16>::srli<8>(r2)));
     493
     494  return simd_or(temp1, temp2);
    486495}
    487496
     
    490499
    491500
    492   return  simd_or(_mm_shuffle_epi32(simd_andc(r1, simd<64>::himask()), _MM_SHUFFLE(2,0,3,1)),
    493                   _mm_shuffle_epi32(simd_andc(r2, simd<64>::himask()), _MM_SHUFFLE(3,1,2,0))); // 1,3 contain 0
     501  return  simd_or(_mm_shuffle_epi32(simd_andc(r1, simd<64>::himask()), _MM_SHUFFLE(2,0,3,3)),
     502                  _mm_shuffle_epi32(simd_andc(r2, simd<64>::himask()), _MM_SHUFFLE(3,3,2,0))); // 3 contains 0
    494503 
    495504}
Note: See TracChangeset for help on using the changeset viewer.