Changeset 1923


Ignore:
Timestamp:
Feb 11, 2012, 4:56:04 PM (8 years ago)
Author:
cameron
Message:

Corrections for simd<64>::sll, srl (mod 64 shift)

Location:
trunk
Files:
8 edited

Legend:

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

    r1897 r1923  
    990990}
    991991
    992 //The total number of operations is 7.0
     992//The total number of operations is 10.0
    993993template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sll(bitblock128_t arg1, bitblock128_t shift_mask)
    994994{
    995         return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_sll_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     995        return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_sll_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    996996}
    997997
     
    13781378}
    13791379
    1380 //The total number of operations is 7.0
     1380//The total number of operations is 10.0
    13811381template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srl(bitblock128_t arg1, bitblock128_t shift_mask)
    13821382{
    1383         return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_srl_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     1383        return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_srl_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    13841384}
    13851385
  • trunk/lib/idisa_cpp/idisa_sse3.cpp

    r1897 r1923  
    990990}
    991991
    992 //The total number of operations is 7.0
     992//The total number of operations is 10.0
    993993template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sll(bitblock128_t arg1, bitblock128_t shift_mask)
    994994{
    995         return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_sll_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     995        return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_sll_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    996996}
    997997
     
    13781378}
    13791379
    1380 //The total number of operations is 7.0
     1380//The total number of operations is 10.0
    13811381template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srl(bitblock128_t arg1, bitblock128_t shift_mask)
    13821382{
    1383         return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_srl_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     1383        return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_srl_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    13841384}
    13851385
  • trunk/lib/idisa_cpp/idisa_sse4_1.cpp

    r1897 r1923  
    10001000}
    10011001
    1002 //The total number of operations is 7.0
     1002//The total number of operations is 10.0
    10031003template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sll(bitblock128_t arg1, bitblock128_t shift_mask)
    10041004{
    1005         return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_sll_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     1005        return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_sll_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    10061006}
    10071007
     
    13881388}
    13891389
    1390 //The total number of operations is 7.0
     1390//The total number of operations is 10.0
    13911391template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srl(bitblock128_t arg1, bitblock128_t shift_mask)
    13921392{
    1393         return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_srl_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     1393        return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_srl_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    13941394}
    13951395
  • trunk/lib/idisa_cpp/idisa_sse4_2.cpp

    r1897 r1923  
    992992}
    993993
    994 //The total number of operations is 7.0
     994//The total number of operations is 10.0
    995995template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sll(bitblock128_t arg1, bitblock128_t shift_mask)
    996996{
    997         return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_sll_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     997        return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_sll_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    998998}
    999999
     
    13781378}
    13791379
    1380 //The total number of operations is 7.0
     1380//The total number of operations is 10.0
    13811381template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srl(bitblock128_t arg1, bitblock128_t shift_mask)
    13821382{
    1383         return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_srl_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     1383        return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_srl_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    13841384}
    13851385
  • trunk/lib/idisa_cpp/idisa_ssse3.cpp

    r1897 r1923  
    995995}
    996996
    997 //The total number of operations is 7.0
     997//The total number of operations is 10.0
    998998template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sll(bitblock128_t arg1, bitblock128_t shift_mask)
    999999{
    1000         return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_sll_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     1000        return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_sll_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    10011001}
    10021002
     
    13831383}
    13841384
    1385 //The total number of operations is 7.0
     1385//The total number of operations is 10.0
    13861386template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srl(bitblock128_t arg1, bitblock128_t shift_mask)
    13871387{
    1388         return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_srl_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
     1388        return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, (int32_t)(8)), _mm_cvtsi32_si128((int32_t)(63)))), _mm_srl_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128((int32_t)(63)))));
    13891389}
    13901390
  • trunk/libgen/Library_Generator/StrategyPool.py

    r1897 r1923  
    573573                {
    574574                "body":r'''
    575 return simd_ifh(1, simd_himask(128), _mm_sll_epi64(arg1, _mm_srli_si128(shift_mask, 8)), _mm_sll_epi64(arg1, simd_andc(shift_mask, simd_himask(128))))''',
     575return simd_ifh(1, simd_himask(128), _mm_sll_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, 8), _mm_cvtsi32_si128(63))), _mm_sll_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128(63))))''',
    576576                "Ops":["simd_sll"],
    577577                "Fws":[64],
     
    674674                {
    675675                "body":r'''
    676 return simd_ifh(1, simd_himask(128), _mm_srl_epi64(arg1, _mm_srli_si128(shift_mask, 8)), _mm_srl_epi64(arg1, simd_andc(shift_mask, simd_himask(128))))''',
     676return simd_ifh(1, simd_himask(128), _mm_srl_epi64(arg1, simd_and(_mm_srli_si128(shift_mask, 8), _mm_cvtsi32_si128(63))), _mm_srl_epi64(arg1, simd_and(shift_mask, _mm_cvtsi32_si128(63))))''',
    677677                "Ops":["simd_srl"],
    678678                "Fws":[64],
  • trunk/libgen/Library_Tester/CalculatingModules/simd_sll.py

    r1767 r1923  
    1111        while i<sz:
    1212                sh = int(count[i:i+fw], 2) if fw<=32 else int(count[i+fw-32:i+fw], 2)
    13                 if sh >= fw:
    14                         ans += "0" * fw
    15                 else:
    16                         ans += simd_slli.GetResult(fw, sh, [arg1[i:i+fw]])
     13                sh &= (fw - 1)
     14                ans += simd_slli.GetResult(fw, sh, [arg1[i:i+fw]])
    1715                i += fw
    1816       
  • trunk/libgen/Library_Tester/CalculatingModules/simd_srl.py

    r1767 r1923  
    1111        while i<sz:
    1212                sh = int(count[i:i+fw], 2) if fw<=32 else int(count[i+fw-32:i+fw], 2)
    13                 if sh >= fw:
    14                         ans += "0" * fw
    15                 else:
    16                         ans += simd_srli.GetResult(fw, sh, [arg1[i:i+fw]])
     13                sh &= (fw - 1)
     14                ans += simd_srli.GetResult(fw, sh, [arg1[i:i+fw]])
    1715                i += fw
    1816       
Note: See TracChangeset for help on using the changeset viewer.