Changeset 2330 for trunk


Ignore:
Timestamp:
Aug 26, 2012, 12:43:39 PM (6 years ago)
Author:
cameron
Message:

Use typename only within template declarations

File:
1 edited

Legend:

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

    r2329 r2330  
    6161        static IDISA_ALWAYS_INLINE bitblock128_t umin(bitblock128_t arg1, bitblock128_t arg2);
    6262//      template <typename FieldType<fw>::T> static IDISA_ALWAYS_INLINE bitblock128_t constant();
    63         template <int> static IDISA_ALWAYS_INLINE bitblock128_t constant();
     63        template <uint64_t> static IDISA_ALWAYS_INLINE bitblock128_t constant();
    6464        static IDISA_ALWAYS_INLINE bitblock128_t min(bitblock128_t arg1, bitblock128_t arg2);
    6565        static IDISA_ALWAYS_INLINE bitblock128_t umax(bitblock128_t arg1, bitblock128_t arg2);
     
    266266template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srl(bitblock128_t arg1, bitblock128_t shift_mask);
    267267
    268 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant();
    269 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant();
    270 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant();
    271 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::constant();
    272 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::constant();
    273 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::constant();
    274 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::constant();
    275 template <> template <int> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::constant();
     268template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant();
     269template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant();
     270template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant();
     271template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::constant();
     272template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::constant();
     273template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::constant();
     274template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::constant();
     275template <> template <uint64_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::constant();
    276276#if 0
    277277template <> template <fw1_t> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant();
     
    374374template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packss(bitblock128_t arg1, bitblock128_t arg2);
    375375template <> IDISA_ALWAYS_INLINE fw32_t hsimd128<4>::signmask(bitblock128_t arg1);
    376 template <> IDISA_ALWAYS_INLINE typename FieldType<128/8>::T hsimd128<8>::signmask(bitblock128_t arg1);
    377 template <> IDISA_ALWAYS_INLINE typename FieldType<128/16>::T hsimd128<16>::signmask(bitblock128_t arg1);
    378 template <> IDISA_ALWAYS_INLINE typename FieldType<128/32>::T hsimd128<32>::signmask(bitblock128_t arg1);
    379 template <> IDISA_ALWAYS_INLINE typename FieldType<128/64>::T hsimd128<64>::signmask(bitblock128_t arg1);
    380 template <> IDISA_ALWAYS_INLINE typename FieldType<128/128>::T hsimd128<128>::signmask(bitblock128_t arg1);
     376template <> IDISA_ALWAYS_INLINE FieldType<128/8>::T hsimd128<8>::signmask(bitblock128_t arg1);
     377template <> IDISA_ALWAYS_INLINE FieldType<128/16>::T hsimd128<16>::signmask(bitblock128_t arg1);
     378template <> IDISA_ALWAYS_INLINE FieldType<128/32>::T hsimd128<32>::signmask(bitblock128_t arg1);
     379template <> IDISA_ALWAYS_INLINE FieldType<128/64>::T hsimd128<64>::signmask(bitblock128_t arg1);
     380template <> IDISA_ALWAYS_INLINE FieldType<128/128>::T hsimd128<128>::signmask(bitblock128_t arg1);
    381381template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packl(bitblock128_t arg1, bitblock128_t arg2);
    382382template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packl(bitblock128_t arg1, bitblock128_t arg2);
     
    527527
    528528//Implementation Part
     529const uint64_t highbit_64 = ((uint64_t) 1) << 63;
     530const uint32_t highbit_32 = 0x80000000;
     531const uint16_t highbit_16 = 0x8000;
    529532
    530533#define shufflemask4(s1, s2, s3, s4) \
     
    853856template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ult(bitblock128_t arg1, bitblock128_t arg2)
    854857{
    855         bitblock128_t high_bit = simd128<16>::constant<(32768)>();
     858        bitblock128_t high_bit = simd128<16>::constant<(highbit_16)>();
    856859        return simd128<16>::lt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
    857860}
     
    860863template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ult(bitblock128_t arg1, bitblock128_t arg2)
    861864{
    862         bitblock128_t high_bit = simd128<32>::constant<(2147483648ULL)>();
     865        bitblock128_t high_bit = simd128<32>::constant<(highbit_32)>();
    863866        return simd128<32>::lt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
    864867}
     
    920923template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::lt(bitblock128_t arg1, bitblock128_t arg2)
    921924{
    922         bitblock128_t high_bit = simd128<64>::constant<(9223372036854775808ULL)>();
     925        bitblock128_t high_bit = simd128<64>::constant<(highbit_64)>();
    923926        return simd128<64>::ult(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
    924927}
     
    10681071template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ugt(bitblock128_t arg1, bitblock128_t arg2)
    10691072{
    1070         bitblock128_t high_bit = simd128<16>::constant<(32768)>();
     1073        bitblock128_t high_bit = simd128<16>::constant<(highbit_16)>();
    10711074        return simd128<16>::gt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
    10721075}
     
    10751078template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ugt(bitblock128_t arg1, bitblock128_t arg2)
    10761079{
    1077         bitblock128_t high_bit = simd128<32>::constant<(2147483648ULL)>();
     1080        bitblock128_t high_bit = simd128<32>::constant<(highbit_32)>();
    10781081        return simd128<32>::gt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
    10791082}
     
    14291432//The total number of operations is 0
    14301433//template <> template <fw1_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant()
    1431 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant()
     1434template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant()
    14321435{
    14331436        return simd128<32>::constant<(-1*val)>();
     
    14361439//The total number of operations is 0
    14371440//template <> template <fw2_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant()
    1438 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant()
     1441template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant()
    14391442{
    14401443        return simd128<(4)>::constant<((val<<2)|(val&(3)))>();
     
    14431446//The total number of operations is 0
    14441447//template <> template <fw4_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant()
    1445 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant()
     1448template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant()
    14461449{
    14471450        return simd128<(8)>::constant<((val<<4)|(val&(15)))>();
     
    14501453//The total number of operations is 0
    14511454//template <> template <fw8_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::constant()
    1452 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::constant()
    1453 {
    1454         return _mm_set1_epi8((int32_t)(val));
     1455template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::constant()
     1456{
     1457        return _mm_set1_epi8((uint8_t)(val));
    14551458}
    14561459
    14571460//The total number of operations is 0
    14581461//template <> template <fw16_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::constant()
    1459 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::constant()
    1460 {
    1461         return _mm_set1_epi16((int32_t)(val));
     1462template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::constant()
     1463{
     1464        return _mm_set1_epi16((uint16_t)(val));
    14621465}
    14631466
    14641467//The total number of operations is 0
    14651468//template <> template <fw32_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::constant()
    1466 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::constant()
    1467 {
    1468         return _mm_set1_epi32((int32_t)(val));
     1469template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::constant()
     1470{
     1471        return _mm_set1_epi32((uint32_t)(val));
    14691472}
    14701473
    14711474//The total number of operations is 0
    14721475//template <> template <fw64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::constant()
    1473 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::constant()
    1474 {
    1475         return _mm_set_epi32((int32_t)((val>>32)), (int32_t)(val), (int32_t)((val>>32)), (int32_t)(val));
     1476template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::constant()
     1477{
     1478        return _mm_set_epi32((uint32_t)((val>>32)), (uint32_t)(val), (uint32_t)((val>>32)), (uint32_t)(val));
    14761479}
    14771480
    14781481//The total number of operations is 0
    14791482//template <> template <fw128_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::constant()
    1480 template <> template <int val> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::constant()
    1481 {
    1482         return _mm_set_epi32(0, 0, (int32_t)((val>>32)), (int32_t)(val));
     1483template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::constant()
     1484{
     1485        return _mm_set_epi32(0, 0, (uint32_t)((val>>32)), (uint32_t)(val));
    14831486}
    14841487
     
    16101613template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umin(bitblock128_t arg1, bitblock128_t arg2)
    16111614{
    1612         bitblock128_t high_bit = simd128<32>::constant<(2147483648ULL)>();
     1615        bitblock128_t high_bit = simd128<32>::constant<(highbit_32)>();
    16131616        return simd_xor(simd128<32>::min(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
    16141617}
     
    19091912template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umax(bitblock128_t arg1, bitblock128_t arg2)
    19101913{
    1911         bitblock128_t high_bit = simd128<32>::constant<(2147483648ULL)>();
     1914        bitblock128_t high_bit = simd128<32>::constant<(highbit_32)>();
    19121915        return simd_xor(simd128<32>::max(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
    19131916}
     
    20682071
    20692072//The total number of operations is 24.0
    2070 template <> IDISA_ALWAYS_INLINE typename FieldType<128/4>::T hsimd128<4>::signmask(bitblock128_t arg1)
     2073template <> IDISA_ALWAYS_INLINE FieldType<128/4>::T hsimd128<4>::signmask(bitblock128_t arg1)
    20712074{
    20722075        uint32_t tmpAns1 = hsimd128<(8)>::signmask(esimd128<4>::mergeh(arg1, simd128<4>::constant<0>()));
     
    20762079
    20772080//The total number of operations is 1.0
    2078 template <> IDISA_ALWAYS_INLINE typename FieldType<128/8>::T hsimd128<8>::signmask(bitblock128_t arg1)
     2081template <> IDISA_ALWAYS_INLINE FieldType<128/8>::T hsimd128<8>::signmask(bitblock128_t arg1)
    20792082{
    20802083        return _mm_movemask_epi8(arg1);
     
    20822085
    20832086//The total number of operations is 2.0
    2084 template <> IDISA_ALWAYS_INLINE typename FieldType<128/16>::T hsimd128<16>::signmask(bitblock128_t arg1)
     2087template <> IDISA_ALWAYS_INLINE FieldType<128/16>::T hsimd128<16>::signmask(bitblock128_t arg1)
    20852088{
    20862089        return hsimd128<(8)>::signmask(hsimd128<16>::packss(simd128<16>::constant<0>(), arg1));
     
    20882091
    20892092//The total number of operations is 1.0
    2090 template <> IDISA_ALWAYS_INLINE typename FieldType<128/32>::T hsimd128<32>::signmask(bitblock128_t arg1)
     2093template <> IDISA_ALWAYS_INLINE FieldType<128/32>::T hsimd128<32>::signmask(bitblock128_t arg1)
    20912094{
    20922095        return _mm_movemask_ps(_mm_castsi128_ps(arg1));
     
    20942097
    20952098//The total number of operations is 1.0
    2096 template <> IDISA_ALWAYS_INLINE typename FieldType<128/64>::T hsimd128<64>::signmask(bitblock128_t arg1)
     2099template <> IDISA_ALWAYS_INLINE FieldType<128/64>::T hsimd128<64>::signmask(bitblock128_t arg1)
    20972100{
    20982101        return _mm_movemask_pd(_mm_castsi128_pd(arg1));
     
    21002103
    21012104//The total number of operations is 6.33333333333
    2102 template <> IDISA_ALWAYS_INLINE typename FieldType<128/128>::T hsimd128<128>::signmask(bitblock128_t arg1)
     2105template <> IDISA_ALWAYS_INLINE FieldType<128/128>::T hsimd128<128>::signmask(bitblock128_t arg1)
    21032106{
    21042107        return hsimd128<(64)>::signmask(hsimd128<128>::packh(simd128<128>::constant<0>(), arg1));
Note: See TracChangeset for help on using the changeset viewer.