找到与sse指令对应的氖指令

时间:2013-10-28 09:46:28

标签: arm sse simd neon

我想知道Neon指令中SSE指令的等效指令/代码是什么。

__m128i a,b,c;
c = _mm_packs_epi32(a, b);

将a和b中的8个带符号的32位整数打包成带符号的16位整数和饱和。

我检查了ARM网站上的等效指令,但我没有找到任何等效指令。 http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Bcfjicfj.html

2 个答案:

答案 0 :(得分:3)

没有指令可以直接执行您想要的操作,但是构建一个的所有构建块都在那里:

饱和/窄指令是:

int16x4_t vqmovn_s32 (int32x4_t)  

该内在函数从带符号的32位饱和到带符号的16位整数,以64位宽的变量返回四个变窄的整数。

将这些组合到您的_mm_packs_epi32中很简单:只需为a和b执行此操作,然后合并结果:

  int32x4_t a,b;
  int16x8_t c;

  c = vcombine_s16 (vqmovn_s32(a), vqmovn_s32(b));

您可能必须交换vcombine_s16参数的顺序。

答案 1 :(得分:2)

此打包/饱和操作属于NEON中的MOV指令类别:

VQMOVN (Vector Saturating Move and Narrow) copies each element of the operand vector to the corresponding element of the destination vector. The result element is half the width of the operand element, and values are saturated to the result width.

相关问题