source: icGREP/icgrep-devel/icgrep/IR_Gen/idisa_i64_builder.cpp @ 5374

Last change on this file since 5374 was 5374, checked in by cameron, 2 years ago

Unique names for IDISA builders

File size: 1.7 KB
Line 
1/*
2 *  Copyright (c) 2015 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#include "idisa_i64_builder.h"
8
9namespace IDISA {
10   
11std::string IDISA_I64_Builder::getBuilderUniqueName() { return mBitBlockWidth != 64 ? "C" + std::to_string(mBitBlockWidth) : "C";}
12
13Value * IDISA_I64_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) {
14    Value * a_ = a;
15    Value * b_ = b;
16    for (unsigned w = fw; w < mBitBlockWidth; w *= 2) {
17        Value * himask_odd = simd_and(simd_himask(w), simd_himask(2*w));  // high half of odd fields
18        Value * himask_even = simd_and(simd_himask(w), simd_lomask(2*w));  // high half of even fields
19        b_ = simd_or(simd_and(b_, himask_odd), simd_slli(mBitBlockWidth, simd_and(b_, himask_even), w/2));
20        a_ = simd_or(simd_and(a_, himask_odd), simd_slli(mBitBlockWidth, simd_and(a_, himask_even), w/2));
21    }
22    return simd_or(b_, simd_srli(mBitBlockWidth, a_, mBitBlockWidth/2));
23}
24
25Value * IDISA_I64_Builder::hsimd_packl(unsigned fw, Value * a, Value * b) {
26    Value * a_ = a;
27    Value * b_ = b;
28    for (unsigned w = fw; w < mBitBlockWidth; w *= 2) {
29        Value * lomask_odd = simd_and(simd_lomask(w), simd_himask(2*w));  // high half of odd fields
30        Value * lomask_even = simd_and(simd_lomask(w), simd_lomask(2*w));  // high half of even fields
31        b_ = simd_or(simd_and(b_, lomask_even), simd_srli(mBitBlockWidth, simd_and(b_, lomask_odd), w/2));
32        a_ = simd_or(simd_and(a_, lomask_even), simd_srli(mBitBlockWidth, simd_and(a_, lomask_odd), w/2));
33    }
34    return simd_or(simd_slli(mBitBlockWidth, b_, mBitBlockWidth/2), a_);
35}
36
37}
Note: See TracBrowser for help on using the repository browser.