Ignore:
Timestamp:
Jul 2, 2012, 2:39:28 PM (7 years ago)
Author:
cameron
Message:

Library updates: simplify simd<fw>::constant

File:
1 edited

Legend:

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

    r1953 r2230  
    107107IDISA_ALWAYS_INLINE bitblock128_t simd_andc(bitblock128_t arg1, bitblock128_t arg2);
    108108IDISA_ALWAYS_INLINE bitblock128_t simd_or(bitblock128_t arg1, bitblock128_t arg2);
     109IDISA_ALWAYS_INLINE bitblock128_t simd_xor(bitblock128_t arg1, bitblock128_t arg2);
    109110IDISA_ALWAYS_INLINE bitblock128_t simd_and(bitblock128_t arg1, bitblock128_t arg2);
    110 IDISA_ALWAYS_INLINE bitblock128_t simd_xor(bitblock128_t arg1, bitblock128_t arg2);
    111111template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::max(bitblock128_t arg1, bitblock128_t arg2);
    112112template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::max(bitblock128_t arg1, bitblock128_t arg2);
     
    409409template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::fill(uint64_t val1);
    410410template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::fill(uint64_t val1);
     411template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::fill(uint64_t val1);
    411412template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<1>::extract(bitblock128_t arg1);
    412413template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<2>::extract(bitblock128_t arg1);
     
    500501
    501502//The total number of operations is 1.0
     503IDISA_ALWAYS_INLINE bitblock128_t simd_xor(bitblock128_t arg1, bitblock128_t arg2)
     504{
     505        return veorq_u64(arg1, arg2);
     506}
     507
     508//The total number of operations is 1.0
    502509IDISA_ALWAYS_INLINE bitblock128_t simd_and(bitblock128_t arg1, bitblock128_t arg2)
    503510{
    504511        return vandq_u64(arg1, arg2);
    505 }
    506 
    507 //The total number of operations is 1.0
    508 IDISA_ALWAYS_INLINE bitblock128_t simd_xor(bitblock128_t arg1, bitblock128_t arg2)
    509 {
    510         return veorq_u64(arg1, arg2);
    511512}
    512513
     
    819820template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srli(bitblock128_t arg1)
    820821{
    821         return ((sh == 64) ? neon_shift_right_64_bits(arg1) : ((sh > 64) ? simd128<64>::srli<(sh-64)>(neon_shift_right_64_bits(arg1)) : simd_or(neon_shift_right_64_bits(simd128<64>::slli<(64-sh)>(arg1)), simd128<64>::srli<sh>(arg1))));
     822        return ((sh == 64) ? neon_shift_right_64_bits(arg1) : ((sh > 64) ? simd128<64>::srli<(sh&63)>(neon_shift_right_64_bits(arg1)) : simd_or(neon_shift_right_64_bits(simd128<64>::slli<(64-sh)>(arg1)), simd128<64>::srli<sh>(arg1))));
    822823}
    823824
     
    11031104template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::slli(bitblock128_t arg1)
    11041105{
    1105         return ((sh == 128) ? simd128<32>::constant<0>() : ((sh >= 64) ? simd128<64>::slli<(sh-64)>(neon_shift_left_64_bits(arg1)) : simd_or(neon_shift_left_64_bits(simd128<64>::srli<(64-sh)>(arg1)), simd128<64>::slli<sh>(arg1))));
     1106        return ((sh == 128) ? simd128<32>::constant<0>() : ((sh >= 64) ? simd128<64>::slli<(sh&63)>(neon_shift_left_64_bits(arg1)) : simd_or(neon_shift_left_64_bits(simd128<64>::srli<(64-sh)>(arg1)), simd128<64>::slli<sh>(arg1))));
    11061107}
    11071108
     
    12571258template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant()
    12581259{
    1259         return ((val < 0) ? simd128<(4)>::constant<((val<<2)|(val^(-4)))>() : simd128<(4)>::constant<((val<<2)|val)>());
     1260        return simd128<(4)>::constant<((val<<2)|(val&(3)))>();
    12601261}
    12611262
     
    12631264template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant()
    12641265{
    1265         return ((val < 0) ? simd128<(8)>::constant<((val<<4)|(val^(-16)))>() : simd128<(8)>::constant<((val<<4)|val)>());
     1266        return simd128<(8)>::constant<((val<<4)|(val&(15)))>();
    12661267}
    12671268
     
    24512452}
    24522453
     2454//The total number of operations is 3.0
     2455template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::fill(uint64_t val1)
     2456{
     2457        return mvmd128<(64)>::fill2(0, val1);
     2458}
     2459
    24532460//The total number of operations is 1.0
    24542461template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<1>::extract(bitblock128_t arg1)
Note: See TracChangeset for help on using the changeset viewer.