【x86向量化】三种不同方式的AGC算法代码运行速度对比
warmonkey2019/01/01软件综合 IP:广东

前言

在使用通用处理器如x86-64开发软件无线电算法的过程中,充分利用cpu的simd指令集(mmx/sse/avx/neon等)对于性能是至关重要的。现代的x86-64处理器能够支持很大的浮点向量运算,例如intel haswell(2011年发布)平台支持的avx指令集,ymm 0 ~ ymm15寄存器宽度为256bit,每条指令能实现8个单精度浮点数乘法或加法,4GHz主频运行linpack实测速度可达100Gflops。

AGC(自动增益控制)是软件无线电处理中最基本的算法之一。其目的是保持输出信号幅度基本稳定,以方便后续算法处理。AGC算法的工作流程可以总结为三步:

1. 放大信号。乘法运算,调整信号的幅度;

2. 检测信号幅度。对输出信号使用功率检波或者有效值检波,测量信号的实际幅度;

3. 调整增益。比较设定值与实际幅度的偏差,据此调整增益设置。

为了能够尽可能充分利用处理器的运算能力,编译器会对代码进行自动向量化,将多个浮点操作打包在一起,生成simd指令。因此,编写合适的代码结构对于性能是至关重要的。本文将对3种不同结构的AGC算法代码进行性能对比测试,以找出最优的方案。

算法实现方案

其中x y为float complex,pwr reference gain为float,全部对齐到16字节地址

<code class="hljs glsl"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(i=<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>;i<n;i++) { step1: y="gain" * x; <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//MUL=2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
    step2: pwr = y.re * y.re + y.im * y.im;   <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//MUL=2 ADD=1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
}
step3: <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(pwr > reference) gain *= <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0.99</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>; <br>       <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">else</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> gain *= <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1.01</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>;  <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//CMP=1 MUL=1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></n;i++)></span></code>

Total FLOPS = n * 5 + 2;

根据gcc编译器自动向量化的说明 (XXXXXXXXXXXXXXXXXXX/projects/tree-ssa/XXXXXXXXXXXXXXXXml) 编写了相应的测试代码。

其中算法1使用libvolk()库的avx2实现,算法2和算法3使用c语言编写

<code class="hljs bash">//算法1<br><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> (i=0; i<*_num_iterations; i++) {   volk_32<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">fc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>_s32<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">fc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>_multiply_32<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">fc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y, x, gain, n);
    volk_32<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">fc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>_magnitude_squared_32f(pwry, y, n);
    *pwr = 0;<br>    volk_32f_accumulator_s32f(pwr, pwry, n);
    *pwr /= n;
    <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(*pwr > d_reference) gain *= a1;
    <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">else</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> gain *= a2;<br>}</*_num_iterations;></span></code>
<code class="hljs verilog"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//算法2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">*pwr = 0;</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> i = <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>; i < n; i++)
{
    y[i] = x[i] * gain;<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//step1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
    pwry[i] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i]) + imag(y[i])*imag(y[i]);<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//step2.1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
}
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> i = <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>; i < n; i++)
{
    *pwr += pwry[i];<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//step2.2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
}
*pwr /= n;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(*pwr > d_reference) gain *= a1;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">else</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> gain *= a2;<br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//备注:经过测试, step1和step2.1放在同个循环,step2.2放在另外的循环中,速度最快。</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//step1 2.1 2.2分开三个循环,或者step1 2.1 2.2放在一起,或者step1分开step2.1 2.2放在一起,速度都会减慢</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//不使用pwry中间变量,直接累加到pwr,速度也会减慢</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br></span></code>
<code class="hljs verilog"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//算法3,手动展开循环,其中n是8的倍数</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">*pwr = 0;</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> i = <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>; i < n; i+=<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">8</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>)
{
    y[i] = x[i] * gain;
    pwry[i] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i]) + imag(y[i])*imag(y[i]);
    y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = x[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] * gain;
    pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]) + imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]);
    y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = x[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] * gain;
    pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]) + imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]);
    y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = x[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] * gain;
    pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]) + imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]);
    y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = x[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] * gain;
    pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]) + imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]);
    y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = x[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] * gain;
    pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]) + imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]);
    y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = x[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] * gain;
    pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]) + imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]);
    y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = x[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] * gain;
    pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">real</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]) + imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>])*imag(y[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]);
}
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> i = <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>; i < n; i+=<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">8</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>)
{
    *pwr += pwry[i]    + pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] + pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] + pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] 
          + pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>]  + pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">5</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] + pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">6</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>] + pwry[i+<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>];
}
*pwr /= n;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>(*pwr > d_reference) gain *= a1;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">else</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> gain *= a2;</code>

以上测试代码分别循环iter次,其中iter=256*1048576/n,即测试的数据总长度不变。

使用getrusage函数得到循环的执行时间,进而计算出每秒处理的数据个数。

编译时,算法2和3均成功向量化

<code class="hljs less">gcc 7<span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.4</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.0</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//算法2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">agc_gr_bench.cc:105:20: note: loop vectorized</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:105</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:20</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">versioned</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">vectorization</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">because</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">of</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">possible</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">aliasing</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:105</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:20</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">turned</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">into</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">non-loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>; it never loops.
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:105</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:20</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">with</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">iterations</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">completely</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">unrolled</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:110</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:20</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">unrolled</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">7</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">times</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:105</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:20</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">unrolled</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">times</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:108</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:12</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">unrolled</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">times</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//算法3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">agc_gr_bench.cc:139:20: note: loop vectorized</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:139</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:20</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">versioned</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">for</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">vectorization</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">because</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">of</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">possible</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">aliasing</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:159</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:20</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">unrolled</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">3</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">times</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">agc_gr_bench</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class"><span class="hljs-selector-class">.cc</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:142</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo"><span class="hljs-selector-pseudo">:12</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">note</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>: <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">loop</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">unrolled</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">1</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag"><span class="hljs-selector-tag">times</span></span></span></span></span></span></span></span></span></span></span><br></span></span></span></span></code>

备注: 作为对比,导入了gnuradio feed_forward_agc中的快速开平方拟合算法, 仅执行检波算法

<code class="hljs cpp"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//算法: agc_gr </span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//测试方法:循环执行该函数iter*n次 </span></span></span></span></span></span></span></span></span></span><br><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">inline static float envelope(gr_complex x)</span></span></span></span></span></span></span></span></span></span>
{
    <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">float</span></span></span></span></span></span></span></span></span></span> r_abs = <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">std</span></span></span></span></span></span></span></span></span></span>::<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">fabs</span></span></span></span></span></span></span></span></span></span>(x.real());
    <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">float</span></span></span></span></span></span></span></span></span></span> i_abs = <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">std</span></span></span></span></span></span></span></span></span></span>::<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">fabs</span></span></span></span></span></span></span></span></span></span>(x.imag());

    <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span></span></span></span></span></span></span>(r_abs > i_abs)
        <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span></span></span></span></span></span></span> r_abs + <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0.4</span></span></span></span></span></span></span></span></span></span> * i_abs;
    <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">else</span></span></span></span></span></span></span></span></span></span>
        <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span></span></span></span></span></span></span> i_abs + <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0.4</span></span></span></span></span></span></span></span></span></span> * r_abs;
}</code>

测试环境

i7-4770k 2.6GHz

DDR3 2400 8GB

ubuntu 16.04 LTS

gcc 7.4.0 (备注: gcc 5.4.0速度减少10-15%,clang 3.8速度减少50%)

libvolk 1.4 (备注:未使用volk_modtool生成配置文件,使用默认的算法选择逻辑。)

存在问题:使用过volk_modtool之后最高可损失40%性能,架构选择a_sse3 u_sse3 a_avx u_avx均有此问题,原因不明。

测试结果

bench.png

 volk库速度最快,在向量长度n=1024时,处理速率1.75Gsps;

其次是手动展开循环的c代码(算法3),n=32时,处理速率1.24Gsps;

最慢的是简单循环(算法2),n=16时,处理速率0.85Gsps;

总结

若算法允许每次迭代处理多个数据(n值较大),应该优先使用libvolk库。

若算法要求迭代周期尽可能短(小的n值),应该用c语言自行编写展开的循环。

保持n值不要太大(使得数据能放入L1或L2缓存),否则性能会快速下降

源代码

attachment icon agc_bench.tar.gz 31.88KB GZ 66次下载

[修改于 5年11个月前 - 2019/01/03 17:57:01]

来自:计算机科学 / 软件综合
3
 
4
已屏蔽 原因:{{ notice.reason }}已屏蔽
{{notice.noticeContent}}
~~空空如也
薛定谔的猫
5年11个月前 IP:陕西
853360

SDR的算法有并行化加速的空间吗

引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
风雨不眠隔夜的你
5年11个月前 IP:四川
853365

现在正在学编代码的同学前来膜拜。

引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论

想参与大家的讨论?现在就 登录 或者 注册

所属专业
所属分类
上级专业
同级专业
warmonkey
学者 机友
文章
363
回复
7989
学术分
12
2008/10/11注册,53分2秒前活动

Cubesat

主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:未同步
文件下载
加载中...
{{errorInfo}}
{{downloadWarning}}
你在 {{downloadTime}} 下载过当前文件。
文件名称:{{resource.defaultFile.name}}
下载次数:{{resource.hits}}
上传用户:{{uploader.username}}
所需积分:{{costScores}},{{holdScores}}下载当前附件免费{{description}}
积分不足,去充值
文件已丢失

当前账号的附件下载数量限制如下:
时段 个数
{{f.startingTime}}点 - {{f.endTime}}点 {{f.fileCount}}
视频暂不能访问,请登录试试
仅供内部学术交流或培训使用,请先保存到本地。本内容不代表科创观点,未经原作者同意,请勿转载。
音频暂不能访问,请登录试试
支持的图片格式:jpg, jpeg, png
插入公式
评论控制
加载中...
文号:{{pid}}
投诉或举报
加载中...
{{tip}}
请选择违规类型:
{{reason.type}}

空空如也

加载中...
详情
详情
推送到专栏从专栏移除
设为匿名取消匿名
查看作者
回复
只看作者
加入收藏取消收藏
收藏
取消收藏
折叠回复
置顶取消置顶
评学术分
鼓励
设为精选取消精选
管理提醒
编辑
通过审核
评论控制
退修或删除
历史版本
违规记录
投诉或举报
加入黑名单移除黑名单
查看IP
{{format('YYYY/MM/DD HH:mm:ss', toc)}}