12

我在弄清楚几个英特尔 SSE 操作的 NEON 等效性时遇到了一些麻烦。NEON 似乎无法一次处理整个 Q 寄存器(128 位值数据类型)。我在 arm_neon.h 标头或NEON 内在函数参考中没有找到任何内容。

我想要做的是以下内容:

// Intel SSE
// shift the entire 128 bit value with 2 bytes to the right; this is done 
// without sign extension by shifting in zeros
__m128i val = _mm_srli_si128(vector_of_8_s16, 2);
// insert the least significant 16 bits of "some_16_bit_val"
// the whole thing in this case, into the selected 16 bit 
// integer of vector "val"(the 16 bit element with index 7 in this case)
val = _mm_insert_epi16(val, some_16_bit_val, 7);

我查看了 NEON 提供的移位操作,但找不到执行上述操作的等效方法(我对 NEON 没有太多经验)。是否有可能做到以上(我想我只是不知道怎么做)?任何指针都非常感谢。

4

1 回答 1

6

您需要 VEXT 指令。你的例子看起来像:

int16x8_t val = vextq_s16(vector_of_8_s16, another_vector_s16, 1);

在此之后,位 0-111val将包含位 16-127 vector_of_8_s16,位 112-127val将包含位 0-15 another_vector_s16

于 2011-08-27T14:53:31.847 回答