source: icGREP/icgrep-devel/icgrep/IDISA/s2p_gen.cpp @ 4898

Last change on this file since 4898 was 4895, checked in by cameron, 4 years ago

hi_mask in s2p, lo_mask

File size: 2.1 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 */
5
6
7#include "s2p_gen.h"
8
9void * s2p_step(IDISA_Builder * iBuilder, Value * s0, Value * s1, Value * hi_mask, unsigned shift, Value * p0, Value * p1) {
10    Value * t0 = iBuilder->hsimd_packh(16, s0, s1);
11    Value * t1 = iBuilder->hsimd_packl(16, s0, s1);
12    Value * p0 = iBuilder->simd_if(1, hi_mask, t0, iBuilder->simd_srli(16, t1, shift));
13    Value * p1 = iBuilder->simd_if(1, hi_mask, iBuilder->simd_slli(16, t0, shift), t1);
14}
15
16void * s2p(IDISA_Builder * iBuilder,
17           Value * s0, Value * s1, Value * s2, Value * s3, Value * s4, Value * s5, Value * s6, Value * s7,
18           Value * p0, Value * p1, Value * p2, Value * p3, Value * p4, Value * p5, Value * p6, Value * p7) {
19    Value * bit00224466_0,bit00224466_1,bit00224466_2,bit00224466_3;
20    Value * bit11335577_0,bit11335577_1,bit11335577_2,bit11335577_3;
21    Value * bit00004444_0,bit22226666_0,bit00004444_1,bit22226666_1;
22    Value * bit11115555_0,bit33337777_0,bit11115555_1,bit33337777_1;
23    Value * hi_mask2 = iBuilder->simd_himask(2);
24    Value * hi_mask4 = iBuilder->simd_himask(4);
25    Value * hi_mask8 = iBuilder->simd_himask(8);
26    s2p_step(iBuilder, s0,s1,hi_mask2,1,bit00224466_0,bit11335577_0);
27    s2p_step(iBuilder, s2,s3,hi_mask2,1,bit00224466_1,bit11335577_1);
28    s2p_step(iBuilder, s4,s5,hi_mask2,1,bit00224466_2,bit11335577_2);
29    s2p_step(iBuilder, s6,s7,hi_mask2,1,bit00224466_3,bit11335577_3);
30    s2p_step(iBuilder, bit00224466_0,bit00224466_1,hi_mask4,2,bit00004444_0,bit22226666_0);
31    s2p_step(iBuilder, bit00224466_2,bit00224466_3,hi_mask4,2,bit00004444_1,bit22226666_1);
32    s2p_step(iBuilder, bit11335577_0,bit11335577_1,hi_mask4,2,bit11115555_0,bit33337777_0);
33    s2p_step(iBuilder, bit11335577_2,bit11335577_3,hi_mask4,2,bit11115555_1,bit33337777_1);
34    s2p_step(iBuilder, bit00004444_0,bit00004444_1,hi_mask8,4,p0,p4);
35    s2p_step(iBuilder, bit11115555_0,bit11115555_1,hi_mask8,4,p1,p5);
36    s2p_step(iBuilder, bit22226666_0,bit22226666_1,hi_mask8,4,p2,p6);
37    s2p_step(iBuilder, bit33337777_0,bit33337777_1,hi_mask8,4,p3,p7);
38}
Note: See TracBrowser for help on using the repository browser.