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

Last change on this file since 4891 was 4891, checked in by cameron, 3 years ago

Initial check-in of s2p generation

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    s2p_step(iBuilder, s0,s1,simd<2>::himask(),1,bit00224466_0,bit11335577_0);
24    s2p_step(iBuilder, s2,s3,simd<2>::himask(),1,bit00224466_1,bit11335577_1);
25    s2p_step(iBuilder, s4,s5,simd<2>::himask(),1,bit00224466_2,bit11335577_2);
26    s2p_step(iBuilder, s6,s7,simd<2>::himask(),1,bit00224466_3,bit11335577_3);
27    s2p_step(iBuilder, bit00224466_0,bit00224466_1,simd<4>::himask(),2,bit00004444_0,bit22226666_0);
28    s2p_step(iBuilder, bit00224466_2,bit00224466_3,simd<4>::himask(),2,bit00004444_1,bit22226666_1);
29    s2p_step(iBuilder, bit11335577_0,bit11335577_1,simd<4>::himask(),2,bit11115555_0,bit33337777_0);
30    s2p_step(iBuilder, bit11335577_2,bit11335577_3,simd<4>::himask(),2,bit11115555_1,bit33337777_1);
31    s2p_step(iBuilder, bit00004444_0,bit00004444_1,simd<8>::himask(),4,p0,p4);
32    s2p_step(iBuilder, bit11115555_0,bit11115555_1,simd<8>::himask(),4,p1,p5);
33    s2p_step(iBuilder, bit22226666_0,bit22226666_1,simd<8>::himask(),4,p2,p6);
34    s2p_step(iBuilder, bit33337777_0,bit33337777_1,simd<8>::himask(),4,p3,p7);
35}
Note: See TracBrowser for help on using the repository browser.