ARM霓虹灯:条件存储建议 [英] ARM Neon: conditional store suggestion
问题描述
我想弄清楚如何生成ARM霓虹灯有条件的商店。我想这样做是这样的SSE指令等价的:
无效_mm_maskmoveu_si128(__ m128i D,__m128i N,字符* P);
该有条件将Byte d可应对选择n均为字节p.The高位的因素决定D中的相应字节是否将被保存。
如何与NEON内在做任何建议?
谢谢
这是我做过什么:
int8x16_t store_mask = {0,0,0,0,0,0,0xff,为0xFF,0xFF的,为0xFF,0xFF的,为0xFF,0xFF的,为0xFF,0xFF的,0xFF的};int8x16_t tmp_dest = vld1q_u8((*中int8_t)p_dest);
vbslq_u8(源,tmp_dest,store_mask);
vst1q_u8((*中int8_t)p_dest,tmp_dest);
假设16×1字节元素的向量,你将建立一个面具向量,其中每个元素是全0( 0×00
)或全1( 0xFF的
),以确定该元素是否应该被存放在没有。然后,你需要做以下(伪code):
的init遮罩向量= 0×00 /中的每个元素为0xFF
初始化源向量=被选择性地存储的数据
从DEST位置加载DEST载体
适用`与DEST载体,源矢量和掩码矢量vbslq_u8`(`vbit`指令)
店内DEST载体回DEST位置
I'm trying to figure out how to generate a conditional Store in ARM neon. What I would like to do is the equivalent of this SSE instruction:
void _mm_maskmoveu_si128(__m128i d, __m128i n, char *p);
which Conditionally stores byte elements of d to address p.The high bit of each byte in the selector n determines whether the corresponding byte in d will be stored.
Any suggestion on how to do it with NEON intrinsics? Thank you
This is what I did:
int8x16_t store_mask = {0,0,0,0,0,0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
int8x16_t tmp_dest = vld1q_u8((int8_t*)p_dest);
vbslq_u8(source,tmp_dest,store_mask);
vst1q_u8((int8_t*)p_dest,tmp_dest);
Assuming vectors of 16 x 1 byte elements, you would set up a mask vector where each element is either all 0s (0x00
) or all 1s (0xff
) to determine whether the element should be stored on not. Then you need to do the following (pseudo code):
init mask vector = 0x00/0xff in each element
init source vector = data to be selectively stored
load dest vector from dest location
apply `vbslq_u8` (`vbit` instruction) with dest vector, source vector and mask vector
store dest vector back to dest location
这篇关于ARM霓虹灯:条件存储建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!