arm neon 相关文档和指令意义
arm neon 方面的文档真的很少,所以整理下intrinsics指令的内容和文档 :)
vext_type: 取第2个输入vector的低n个元素放入新vector的高位,新vector剩下的元素取自第1个输入vector最高的几个元素(可实现vector内元素位置的移动)
vextq_type: 如:src1 = {1,2,3,4,5,6,7,8} src2 = {9,10,11,12,13,14,15,16} dst = vext_type(src1,src2,3)时,则dst = {4,5,6,7,8, 9,10,11}
vtbl1_type: 第二个vector是索引,根据索引去第一个vector(相当于数组)中搜索相应的元素,并输出新的vector,超过范围的索引返回的是0. 如:src1 = {1,2,3,4,5,6,7,8} src2 = {0,0,1,1,2,2,7,8} dst = vtbl1_u8(src1,src2)时,则dst = {1,1,2,2,3,3,8,0}
vtbl2_type: 数组长度扩大到2个vector 如:src.val[0] = {1,2,3,4,5,6,7,8} src.val[1] = {9,10,11,12,13,14,15,16} src2 = {0,0,1,1,2,2,8,10} dst = vtbl2_u8(src,src2)时,则dst = {1,1,2,2,3,3,9,11}
vtbl3_type:
vtbl4_type:
vtbx1_type: 根vtbl1_type功能一样,不过搜索到的元素是用来替换第一个vector中的元素,并输出替换后的新vector,当索引超出范围时,则不替换第一个vector中相应的元素。
vtbx2_type:
vtbx3_type:
vtbx4_type:
vrev16_type: 将vector中的元素位置反转
vrev16q_type: 如:src1 = {1,2,3,4,5,6,7,8} dst = vrev16_u8(src1)时,则dst = {2,1,4,3,6,5,8,7}
vrev32_type:
vrev32q_type: 如:src1 = {1,2,3,4,5,6,7,8} dst = vrev32_u8(src1)时,则dst = {4,3,2,1,8,7,6,5}
vrev64_type:
vrev64q_type: 如:src1 = {1,2,3,4,5,6,7,8} dst = vrev32_u8(src1)时,则dst = {8,7,6,5,4,3,2,1}
vtrn_type: 将两个输入vector的元素通过转置生成一个有两个vector的矩阵
vtrnq_type: 如:src.val[0] = {1,2,3,4,5,6,7,8} src.val[1] = {9,10,11,12,13,14,15,16} dst = vtrn_u8(src.val[0], src.val[1])时, 则 dst.val[0] = {1,9, 3,11,5,13,7,15} dst.val[1] = {2,10,4,12,6,14,8,16}
vzip_type: 将两个输入vector的元素通过交叉生成一个有两个vector的矩阵
vzipq_type: 如:src.val[0] = {1,2,3,4,5,6,7,8} src.val[1] = {9,10,11,12,13,14,15,16} dst = vzip_u8(src.val[0], src.val[1])时, 则dst.val[0] = {1,9, 2,10,3,11,4,12} dst.val[1] = {5,13,6,14,7,15,8,16}
vuzp_type: 将两个输入vector的元素通过反交叉生成一个有两个vector的矩阵(通过这个可实现n-way 交织)
vuzpq_type: 如:src.val[0] = {1,2,3,4,5,6,7,8} src.val[1] = {9,10,11,12,13,14,15,16} dst = vuzp_u8(src.val[0], src.val[1])时, 则dst.val[0] = {1,3,5,7,9, 11,13,15} dst.val[1] = {2,4,6,8,10,12,14,16}
vcombine_type: 将两个元素类型相同的输入vector拼接成一个同类型但大小是输入vector两倍的新vector。新vector中低部分元素存放的是第一个输入vector元素。
vbsl_type:按位选择,参数为(mask, src1, src2)。mask的某个bit为1,则选择src1中对应的bit,为0,则选择src2中对应的bit。
vbslq_type:
vshl_type: ri = ai << bi 如果bi是负数,则变成右移
vshlq_type:
vshl_n_type: ri = ai << b 这里b是常数,如果传入的不是常数(即在编译的时候就要知道b的值),编译时会报错
vshlq_n_type:
vqshl_type: ri = sat(ai << bi)
vqshlq_type:
vrshl_type: ri = round(ai << bi)
vrshlq_type:
vqrshl_type: ri = sat&round(ai << bi)
vqrshlq_type:
vqshl_n_type: ri = sat(ai << b)
vqshlq_n_type:
vqshlu_n_type: ri = ai << b 输入vector是有符号,输出vector是无符号
vqshluq_n_type:
vshll_n_type:
vshr_n_type: ri = ai >> b
vshrq_n_type:
vrshr_n_type: ri = round(ai >> b)
vrshrq_n_type:
vsra_n_type: ri = (ai >> c) + (bi >> c)
vsraq_n_type:
vrsra_n_type: ri = round((ai >> c) + (bi >> c))
vrsraq_n_type:
vshrn_n_type: 窄指令ri = ai >> b
vqshrun_n_type:
vqrshrun_n_type:
vqshrn_n_type:
vrshrn_n_type:
vqrshrn_n_type:
vsri_n_type:
vsriq_n_type:
vsli_n_type:
vsliq_n_type: