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

Last change on this file since 5309 was 5309, checked in by nmedfort, 2 years ago

Replaced short vector construction in IDISA_Builder with stack allocated arrays.

File size: 1.6 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
11Value * IDISA_I64_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) {
12    Value * a_ = a;
13    Value * b_ = b;
14    for (unsigned w = fw; w < mBitBlockWidth; w *= 2) {
15        Value * himask_odd = simd_and(simd_himask(w), simd_himask(2*w));  // high half of odd fields
16        Value * himask_even = simd_and(simd_himask(w), simd_lomask(2*w));  // high half of even fields
17        b_ = simd_or(simd_and(b_, himask_odd), simd_slli(mBitBlockWidth, simd_and(b_, himask_even), w/2));
18        a_ = simd_or(simd_and(a_, himask_odd), simd_slli(mBitBlockWidth, simd_and(a_, himask_even), w/2));
19    }
20    return simd_or(b_, simd_srli(mBitBlockWidth, a_, mBitBlockWidth/2));
21}
22
23Value * IDISA_I64_Builder::hsimd_packl(unsigned fw, Value * a, Value * b) {
24    Value * a_ = a;
25    Value * b_ = b;
26    for (unsigned w = fw; w < mBitBlockWidth; w *= 2) {
27        Value * lomask_odd = simd_and(simd_lomask(w), simd_himask(2*w));  // high half of odd fields
28        Value * lomask_even = simd_and(simd_lomask(w), simd_lomask(2*w));  // high half of even fields
29        b_ = simd_or(simd_and(b_, lomask_even), simd_srli(mBitBlockWidth, simd_and(b_, lomask_odd), w/2));
30        a_ = simd_or(simd_and(a_, lomask_even), simd_srli(mBitBlockWidth, simd_and(a_, lomask_odd), w/2));
31    }
32    return simd_or(simd_slli(mBitBlockWidth, b_, mBitBlockWidth/2), a_);
33}
34
35}
Note: See TracBrowser for help on using the repository browser.