Changeset 1870 for trunk


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
Files:
9 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{
  • trunk/libgen/Library_Generator/SSE2Instructions.py

    r1806 r1870  
    326326                "fws":[16],
    327327        },
     328        "_mm_movemask_ps":\
     329        {
     330                "signature":"int _mm_movemask_ps(__m128 arg1)",
     331                "args_type":{"arg1":"__m128"},
     332                "return_type":"signed_int(32)",
     333                "fws":[32],
     334        },
     335        "_mm_movemask_pd":\
     336        {
     337                "signature":"int _mm_movemask_pd(__m128 arg1)",
     338                "args_type":{"arg1":"__m128"},
     339                "return_type":"signed_int(32)",
     340                "fws":[64],
     341        },
    328342}
  • trunk/libgen/Library_Generator/StandardTypes.py

    r1805 r1870  
    113113
    114114def IsSIMDType(typeStr):
    115     return "SIMD_type" == typeStr or "bitblock" in typeStr or "__m128i" in typeStr
     115    return "SIMD_type" == typeStr or "bitblock" in typeStr or "__m128i"  in typeStr or "__m128" in typeStr
    116116
    117117def IsUnsignedIntType(typeStr):
  • trunk/libgen/Library_Generator/StrategyPool.py

    r1767 r1870  
    14531453                },
    14541454       
     1455                "signmask_32_SSE":\
     1456                {
     1457                "body":r'''return  _mm_movemask_ps(IDISA_CASTING("__m128",arg1))''',
     1458                "Ops":["hsimd_signmask"],
     1459                "Fws":[32],
     1460                "Platforms":([configure.SSE2]),
     1461                },
     1462
     1463                "signmask_64_SSE":\
     1464                {
     1465                "body":r'''return  _mm_movemask_pd(IDISA_CASTING("__m128d",arg1))''',
     1466                "Ops":["hsimd_signmask"],
     1467                "Fws":[64],
     1468                "Platforms":([arch for arch in configure.SSE_SERIES]),
     1469                },
     1470
    14551471                "signmask_avx":\
    14561472                {
  • trunk/libgen/Library_Tester/utility.h

    r1740 r1870  
    1 #include "idisa_sse2.h"
     1#include "idisa_sse3.h"
    22#define USE_SSE
    33typedef __m128i SIMD_type;
Note: See TracChangeset for help on using the changeset viewer.