 Timestamp:
 Mar 16, 2016, 9:06:41 AM (3 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

icGREP/icgrepdevel/icgrep/IDISA/idisa_i64_builder.cpp
r4975 r4977 13 13 namespace IDISA { 14 14 15 /*16 15 Value * IDISA_I64_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) { 17 Value * mask0 = getInt64(0xFF00000000000000); 18 Value * mask1 = getInt64(0x0000FF0000000000); 19 Value * mask2 = getInt64(0x00000000FF000000); 20 Value * mask3 = getInt64(0x000000000000FF00); 21 22 return simd_or(simd_or(simd_or(simd_and(b, mask0), simd_slli(64, simd_and(b, mask1), 8)) 23 , simd_or(simd_slli(64, simd_and(b, mask2), 16),simd_slli(64, simd_and(b, mask3), 24))), 24 simd_or(simd_or(simd_srli(64, simd_and(a, mask0), 32), simd_srli(64, simd_and(a, mask1), 24)) 25 ,simd_or(simd_srli(64, simd_and(a, mask2), 16), simd_srli(64, simd_and(a, mask3), 8)))); 16 Value * a_ = a; 17 Value * b_ = b; 18 for (unsigned w = fw; w < mBitBlockWidth; w *= 2) { 19 Value * himask_odd = simd_and(simd_himask(w), simd_himask(2*w)); // high half of odd fields 20 Value * himask_even = simd_and(simd_himask(w), simd_lomask(2*w)); // high half of even fields 21 b_ = simd_or(simd_and(b_, himask_odd), simd_slli(mBitBlockWidth, simd_and(b_, himask_even), w/2)); 22 a_ = simd_or(simd_and(a_, himask_odd), simd_slli(mBitBlockWidth, simd_and(a_, himask_even), w/2)); 23 } 24 Value * pk = simd_or(b_, simd_srli(mBitBlockWidth, a_, mBitBlockWidth/2)); 25 return pk; 26 26 } 27 27 28 Value * IDISA_I64_Builder::hsimd_packl(unsigned fw, Value * a, Value * b) {29 Value * mask0 = getInt64(0x00FF000000000000);30 Value * mask1 = getInt64(0x000000FF00000000);31 Value * mask2 = getInt64(0x0000000000FF0000);32 Value * mask3 = getInt64(0x00000000000000FF);33 28 34 return simd_or(simd_or(simd_or(simd_slli(64, simd_and(b, mask0), 8), simd_slli(64, simd_and(b, mask1), 16)) 35 , simd_or(simd_slli(64, simd_and(b, mask2), 24),simd_slli(64, simd_and(b, mask3), 32))), 36 simd_or(simd_or(simd_srli(64, simd_and(a, mask0), 24), simd_srli(64, simd_and(a, mask1), 16)) 37 ,simd_or(simd_srli(64, simd_and(a, mask2), 8), simd_and(a, mask3)))); 29 Value * IDISA_I64_Builder::hsimd_packl(unsigned fw, Value * a, Value * b) { 30 Value * a_ = a; 31 Value * b_ = b; 32 for (unsigned w = fw; w < mBitBlockWidth; w *= 2) { 33 Value * lomask_odd = simd_and(simd_lomask(w), simd_himask(2*w)); // high half of odd fields 34 Value * lomask_even = simd_and(simd_lomask(w), simd_lomask(2*w)); // high half of even fields 35 b_ = simd_or(simd_and(b_, lomask_even), simd_srli(mBitBlockWidth, simd_and(b_, lomask_odd), w/2)); 36 a_ = simd_or(simd_and(a_, lomask_even), simd_srli(mBitBlockWidth, simd_and(a_, lomask_odd), w/2)); 37 } 38 Value * pk = simd_or(simd_slli(mBitBlockWidth, b_, mBitBlockWidth/2), a_); 39 return pk; 40 } 38 41 39 42 } 40 */41 42 /*Value * IDISA_I64_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) {43 Value * mask02 = getInt64(0xFF000000FF000000);44 Value * mask13 = getInt64(0x0000FF000000FF00);45 46 Value * b1 = simd_or(simd_and(b, mask02), simd_slli(64, simd_and(b, mask13), 8));47 Value * a1 = simd_or(simd_and(a, mask02), simd_slli(64, simd_and(a, mask13), 8));48 49 Value * mask01 = getInt64(0xFFFF000000000000);50 Value * mask23 = getInt64(0x00000000FFFF0000);51 52 Value * b2 = simd_or(simd_and(b1, mask01), simd_slli(64, simd_and(b1, mask23), 16));53 Value * a2 = simd_or(simd_srli(64, simd_and(a1, mask01), 32), simd_srli(64, simd_and(a1, mask23), 16));54 55 return simd_or(b2, a2);56 }57 */58 Value * IDISA_I64_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) {59 Value * a_ = a;60 Value * b_ = b;61 for (unsigned w = fw; w < mBitBlockWidth; w *= 2) {62 Value * himask_odd = simd_and(simd_himask(w), simd_himask(2*w)); // high half of odd fields63 Value * himask_even = simd_and(simd_himask(w), simd_lomask(2*w)); // high half of even fields64 b_ = simd_or(simd_and(b_, himask_odd), simd_slli(mBitBlockWidth, simd_and(b_, himask_even), w/2));65 a_ = simd_or(simd_and(a_, himask_odd), simd_slli(mBitBlockWidth, simd_and(a_, himask_even), w/2));66 }67 Value * pk = simd_or(b_, simd_srli(mBitBlockWidth, a_, mBitBlockWidth/2));68 return pk;69 }70 71 72 Value * IDISA_I64_Builder::hsimd_packl(unsigned fw, Value * a, Value * b) {73 Value * a_ = a;74 Value * b_ = b;75 for (unsigned w = fw; w < mBitBlockWidth; w *= 2) {76 Value * lomask_odd = simd_and(simd_lomask(w), simd_himask(2*w)); // high half of odd fields77 Value * lomask_even = simd_and(simd_lomask(w), simd_lomask(2*w)); // high half of even fields78 b_ = simd_or(simd_and(b_, lomask_even), simd_srli(mBitBlockWidth, simd_and(b_, lomask_odd), w/2));79 a_ = simd_or(simd_and(a_, lomask_even), simd_srli(mBitBlockWidth, simd_and(a_, lomask_odd), w/2));80 }81 Value * pk = simd_or(simd_slli(mBitBlockWidth, b_, mBitBlockWidth/2), a_);82 return pk;83 }84 85 }
Note: See TracChangeset
for help on using the changeset viewer.