Changeset 615


Ignore:
Timestamp:
Sep 13, 2010, 10:47:17 AM (9 years ago)
Author:
cameron
Message:

Update sse_simd_t.h with minor optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/sse_simd_t.h

    r406 r615  
    171171/* Constant generator functions for various field widths. */
    172172
    173 template<> inline SIMD_type simd<2>::himask() {return _mm_set1_epi8(0xAA);}
    174 
    175 template<> inline SIMD_type simd<4>::himask() {return _mm_set1_epi8(0xCC);}
    176 
    177 template<> inline SIMD_type simd<8>::himask() {return _mm_set1_epi8(0xF0);}
    178 
    179 template<> inline SIMD_type simd<16>::himask() {return _mm_set1_epi16(0xFF00);}
     173template<> inline SIMD_type simd<2>::himask() {return _mm_set1_epi32(0xAAAAAAAA);}
     174
     175template<> inline SIMD_type simd<4>::himask() {return _mm_set1_epi32(0xCCCCCCCC);}
     176
     177template<> inline SIMD_type simd<8>::himask() {return _mm_set1_epi32(0xF0F0F0F0);}
     178
     179template<> inline SIMD_type simd<16>::himask() {return _mm_set1_epi32(0xFF00FF00);}
    180180
    181181template<> inline SIMD_type simd<32>::himask() {return _mm_set1_epi32(0xFFFF0000);}
     
    185185template<> inline SIMD_type simd<128>::himask() {return _mm_set_epi32(-1,-1,0,0);}
    186186
    187 template<> inline SIMD_type simd<16>::lomask() {return _mm_set1_epi16(0x00FF);}
     187template<> inline SIMD_type simd<16>::lomask() {return _mm_set1_epi32(0x00FF00FF);}
    188188
    189189template<> inline SIMD_type simd<32>::lomask() {return _mm_set1_epi32(0x0000FFFF);}
     
    201201template<> template <int n> inline SIMD_type simd<32>::constant() {return _mm_set1_epi32(n);}
    202202
    203 template<> template <> inline SIMD_type simd<1>::constant<0>() {return simd<8>::constant<0>();}
    204 template<> template <> inline SIMD_type simd<1>::constant<1>() {return simd<8>::constant<-1>();}
     203template<> template <> inline SIMD_type simd<1>::constant<0>() {return simd<32>::constant<0>();}
     204template<> template <> inline SIMD_type simd<1>::constant<1>() {return simd<32>::constant<-1>();}
    205205
    206206template<> template <int n> inline SIMD_type simd<2>::constant() {return simd<4>::constant<(n<<2|n)>();}
     
    476476        return _mm_packus_epi16(simd_andc(r2, simd<16>::himask()), simd_andc(r1, simd<16>::himask()));
    477477}
     478//#define simd_pack_16_hh(v1, v2) _mm_packus_epi16(_mm_srli_epi16(v2, 8), _mm_srli_epi16(v1, 8))
     479template<> template<>
     480inline SIMD_type simd<16>::pack<h,h>(SIMD_type r1, SIMD_type r2) {
     481        return _mm_packus_epi16(_mm_srli_epi16(r2, 8), _mm_srli_epi16(r1, 8));
     482}
     483template<> template<>
     484inline SIMD_type simd<16>::pack<l,l>(SIMD_type r1, SIMD_type r2) {
     485        return _mm_packus_epi16(simd_andc(r2, simd<16>::himask()), simd_andc(r1, simd<16>::himask()));
     486}
     487
     488
    478489
    479490template<>
Note: See TracChangeset for help on using the changeset viewer.