Changeset 3453 for trunk


Ignore:
Timestamp:
Sep 9, 2013, 1:58:12 PM (4 years ago)
Author:
linmengl
Message:

opt on hsimd_signmask

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bitblock256.hpp

    r3451 r3453  
    9797
    9898IDISA_ALWAYS_INLINE bitblock256_t convert(uint64_t s)
    99 {
    100   ubitblock b = {b._256 = simd256<128>::constant<0>()}; // = {0};
    101   b._64[0] = s;
    102   return b._256;
     99
     100  return _mm256_castsi128_si256(_mm_cvtsi64_si128(s));
     101  // ubitblock b = {b._256 = simd256<128>::constant<0>()}; // = {0};
     102  // b._64[0] = s;
     103  // return b._256;
    103104}
    104105
     
    112113IDISA_ALWAYS_INLINE uint64_t convert(bitblock256_t v)
    113114{
    114   return (uint64_t) mvmd256<64>::extract<0>(v);
     115  return (uint64_t) _mm_cvtsi128_si64(avx_select_lo128(v));
     116  // return (uint64_t) mvmd256<64>::extract<0>(v);
    115117}
    116118
  • trunk/lib/idisa_cpp/idisa_avx2.cpp

    r3448 r3453  
    25042504}
    25052505
    2506 //The total number of operations is 3.0
     2506//The total number of operations is 1.0
    25072507template <> IDISA_ALWAYS_INLINE FieldType<256/8>::T hsimd256<8>::signmask(bitblock256_t arg1)
    2508 {
    2509         return ((((uint64_t)(_mm_movemask_epi8(((__m128i)(avx_select_hi128(arg1))))))<<16)|((uint64_t)(_mm_movemask_epi8(((__m128i)(avx_select_lo128(arg1)))))));
    2510 }
    2511 
    2512 //The total number of operations is 6.0
     2508{       
     2509        return _mm256_movemask_epi8(arg1);
     2510}
     2511
     2512//The total number of operations is 4.0
    25132513template <> IDISA_ALWAYS_INLINE FieldType<256/16>::T hsimd256<16>::signmask(bitblock256_t arg1)
    25142514{
     
    25162516}
    25172517
    2518 //The total number of operations is 9.0
     2518//The total number of operations is 2.0
    25192519template <> IDISA_ALWAYS_INLINE FieldType<256/32>::T hsimd256<32>::signmask(bitblock256_t arg1)
    25202520{
    2521         return hsimd256<(16)>::signmask(hsimd256<32>::packss(simd256<32>::constant<0>(), arg1));
    2522 }
    2523 
    2524 //The total number of operations is 75.5
     2521        return _mm256_movemask_ps(_mm256_castsi256_ps(arg1));
     2522}
     2523
     2524//The total number of operations is 2.0
    25252525template <> IDISA_ALWAYS_INLINE FieldType<256/64>::T hsimd256<64>::signmask(bitblock256_t arg1)
    25262526{
    2527         return hsimd256<(32)>::signmask(hsimd256<64>::packh(simd256<64>::constant<0>(), arg1));
    2528 }
    2529 
    2530 //The total number of operations is 184.666666667
     2527        return _mm256_movemask_pd(_mm256_castsi256_pd(arg1));
     2528}
     2529
     2530//The total number of operations is 111.166666667
    25312531template <> IDISA_ALWAYS_INLINE FieldType<256/128>::T hsimd256<128>::signmask(bitblock256_t arg1)
    25322532{
     
    25342534}
    25352535
    2536 //The total number of operations is 197.666666667
     2536//The total number of operations is 124.166666667
    25372537template <> IDISA_ALWAYS_INLINE FieldType<256/256>::T hsimd256<256>::signmask(bitblock256_t arg1)
    25382538{
Note: See TracChangeset for help on using the changeset viewer.