Changeset 1870 for trunk/lib/idisa_cpp


Ignore:
Timestamp:
Jan 21, 2012, 1:39:58 PM (7 years ago)
Author:
cameron
Message:

signmask built-ins for 32 and 64 bits on SSE

Location:
trunk/lib/idisa_cpp
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/idisa_cpp/idisa_sse2.cpp

    r1807 r1870  
    20392039template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<16>::signmask(bitblock128_t arg1)
    20402040{
    2041         return hsimd128<(8)>::signmask(hsimd128<16>::packh(simd128<16>::constant<0>(), arg1));
    2042 }
    2043 
    2044 //The total number of operations is 8.0
     2041        uint64_t tmpAns1 = hsimd128<(32)>::signmask(esimd128<16>::mergeh(arg1, simd128<16>::constant<0>()));
     2042        uint64_t tmpAns2 = hsimd128<(32)>::signmask(esimd128<16>::mergel(arg1, simd128<16>::constant<0>()));
     2043        return ((tmpAns1<<(4))+tmpAns2);
     2044}
     2045
     2046//The total number of operations is 1.0
    20452047template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<32>::signmask(bitblock128_t arg1)
    20462048{
    2047         return (((((mvmd128<32>::extract<3>(arg1)>>28)&8)|((mvmd128<32>::extract<2>(arg1)>>29)&4))|((mvmd128<32>::extract<1>(arg1)>>30)&2))|(mvmd128<32>::extract<0>(arg1)>>31));
    2048 }
    2049 
    2050 //The total number of operations is 8.0
     2049        return _mm_movemask_ps(((__m128)arg1));
     2050}
     2051
     2052//The total number of operations is 1.0
    20512053template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<64>::signmask(bitblock128_t arg1)
    20522054{
    2053         return (((mvmd128<64>::extract<1>(arg1)>>62)&2)|(mvmd128<64>::extract<0>(arg1)>>63));
    2054 }
    2055 
    2056 //The total number of operations is 13.3333333333
     2055        return _mm_movemask_pd(((__m128d)arg1));
     2056}
     2057
     2058//The total number of operations is 6.33333333333
    20572059template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<128>::signmask(bitblock128_t arg1)
    20582060{
  • trunk/lib/idisa_cpp/idisa_sse3.cpp

    r1807 r1870  
    20422042}
    20432043
    2044 //The total number of operations is 8.0
     2044//The total number of operations is 4.0
    20452045template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<32>::signmask(bitblock128_t arg1)
    20462046{
    2047         return (((((mvmd128<32>::extract<3>(arg1)>>28)&8)|((mvmd128<32>::extract<2>(arg1)>>29)&4))|((mvmd128<32>::extract<1>(arg1)>>30)&2))|(mvmd128<32>::extract<0>(arg1)>>31));
    2048 }
    2049 
    2050 //The total number of operations is 8.0
     2047        uint64_t tmpAns1 = hsimd128<(64)>::signmask(esimd128<32>::mergeh(arg1, simd128<32>::constant<0>()));
     2048        uint64_t tmpAns2 = hsimd128<(64)>::signmask(esimd128<32>::mergel(arg1, simd128<32>::constant<0>()));
     2049        return ((tmpAns1<<(2))+tmpAns2);
     2050}
     2051
     2052//The total number of operations is 1.0
    20512053template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<64>::signmask(bitblock128_t arg1)
    20522054{
    2053         return (((mvmd128<64>::extract<1>(arg1)>>62)&2)|(mvmd128<64>::extract<0>(arg1)>>63));
    2054 }
    2055 
    2056 //The total number of operations is 13.3333333333
     2055        return _mm_movemask_pd(((__m128d)arg1));
     2056}
     2057
     2058//The total number of operations is 6.33333333333
    20572059template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<128>::signmask(bitblock128_t arg1)
    20582060{
  • trunk/lib/idisa_cpp/idisa_sse4_1.cpp

    r1807 r1870  
    20532053template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<32>::signmask(bitblock128_t arg1)
    20542054{
    2055         return (((((mvmd128<32>::extract<3>(arg1)>>28)&8)|((mvmd128<32>::extract<2>(arg1)>>29)&4))|((mvmd128<32>::extract<1>(arg1)>>30)&2))|(mvmd128<32>::extract<0>(arg1)>>31));
    2056 }
    2057 
    2058 //The total number of operations is 4.0
     2055        uint64_t tmpAns1 = hsimd128<(64)>::signmask(esimd128<32>::mergeh(arg1, simd128<32>::constant<0>()));
     2056        uint64_t tmpAns2 = hsimd128<(64)>::signmask(esimd128<32>::mergel(arg1, simd128<32>::constant<0>()));
     2057        return ((tmpAns1<<(2))+tmpAns2);
     2058}
     2059
     2060//The total number of operations is 1.0
    20592061template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<64>::signmask(bitblock128_t arg1)
    20602062{
    2061         return (((mvmd128<64>::extract<1>(arg1)>>62)&2)|(mvmd128<64>::extract<0>(arg1)>>63));
    2062 }
    2063 
    2064 //The total number of operations is 9.33333333333
     2063        return _mm_movemask_pd(((__m128d)arg1));
     2064}
     2065
     2066//The total number of operations is 6.33333333333
    20652067template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<128>::signmask(bitblock128_t arg1)
    20662068{
  • trunk/lib/idisa_cpp/idisa_sse4_2.cpp

    r1807 r1870  
    20352035template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<32>::signmask(bitblock128_t arg1)
    20362036{
    2037         return (((((mvmd128<32>::extract<3>(arg1)>>28)&8)|((mvmd128<32>::extract<2>(arg1)>>29)&4))|((mvmd128<32>::extract<1>(arg1)>>30)&2))|(mvmd128<32>::extract<0>(arg1)>>31));
    2038 }
    2039 
    2040 //The total number of operations is 4.0
     2037        uint64_t tmpAns1 = hsimd128<(64)>::signmask(esimd128<32>::mergeh(arg1, simd128<32>::constant<0>()));
     2038        uint64_t tmpAns2 = hsimd128<(64)>::signmask(esimd128<32>::mergel(arg1, simd128<32>::constant<0>()));
     2039        return ((tmpAns1<<(2))+tmpAns2);
     2040}
     2041
     2042//The total number of operations is 1.0
    20412043template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<64>::signmask(bitblock128_t arg1)
    20422044{
    2043         return (((mvmd128<64>::extract<1>(arg1)>>62)&2)|(mvmd128<64>::extract<0>(arg1)>>63));
    2044 }
    2045 
    2046 //The total number of operations is 9.33333333333
     2045        return _mm_movemask_pd(((__m128d)arg1));
     2046}
     2047
     2048//The total number of operations is 6.33333333333
    20472049template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<128>::signmask(bitblock128_t arg1)
    20482050{
  • trunk/lib/idisa_cpp/idisa_ssse3.cpp

    r1807 r1870  
    20442044}
    20452045
    2046 //The total number of operations is 7.0
     2046//The total number of operations is 4.0
    20472047template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<32>::signmask(bitblock128_t arg1)
    20482048{
    2049         return hsimd128<(16)>::signmask(hsimd128<32>::packh(simd128<32>::constant<0>(), arg1));
    2050 }
    2051 
    2052 //The total number of operations is 8.0
     2049        uint64_t tmpAns1 = hsimd128<(64)>::signmask(esimd128<32>::mergeh(arg1, simd128<32>::constant<0>()));
     2050        uint64_t tmpAns2 = hsimd128<(64)>::signmask(esimd128<32>::mergel(arg1, simd128<32>::constant<0>()));
     2051        return ((tmpAns1<<(2))+tmpAns2);
     2052}
     2053
     2054//The total number of operations is 1.0
    20532055template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<64>::signmask(bitblock128_t arg1)
    20542056{
    2055         return (((mvmd128<64>::extract<1>(arg1)>>62)&2)|(mvmd128<64>::extract<0>(arg1)>>63));
    2056 }
    2057 
    2058 //The total number of operations is 13.3333333333
     2057        return _mm_movemask_pd(((__m128d)arg1));
     2058}
     2059
     2060//The total number of operations is 6.33333333333
    20592061template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<128>::signmask(bitblock128_t arg1)
    20602062{
Note: See TracChangeset for help on using the changeset viewer.