我在这里有一个非常简单但很大(n很大)的循环:
for (i=0; i<n; i++)
{
dst[i] = src[table[i]];
}
我想使用 NEON 对其进行优化,但我不知道如何处理这部分:src[table[i]]
。
是否可以优化?如果是,怎么办?
最佳答案
感谢@Paul R 和他的评论:
This is effectively a gathered load, and is not supported in NEON.See: stackoverflow.com/questions/11502332/…
由于NEON无法优化,我尝试了OpenMP ,并取得了显着的进步。而且代码也相当简单:
#pragma omp parallel for
for (i=0; i<n; i++)
{
dst[i] = src[table[i]];
}
关于c - 如何使用 NEON 优化 a[i] = b[c[i]],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31423641/