VEC-C 进阶 指令解析及寻址模式
来源:互联网 发布:如何用淘宝内部券赚钱 编辑:程序博客网 时间:2024/05/16 15:12
1,逻辑移位与算术移位:logicshift不考虑符号,空位用0补,arithmaticshift要保证符号不变。
2,vec-c中数据类型转换只能是显式的:
char16 c;short16 s = c; //not allowedshort16 s = (short16)c; //allowedushort16 u;uchar16 c = vcast(satu,u);
3,要把vec-c中的type+数字型的类型看作是一个很长的变量,比如short16 in;就表示16X2X8bit长的一个变量。
要赋值给它,当然是与给short变量赋值是一个道理了。
例
short16 inN;
short in[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};inN=*(short16*)in;
例
3,从内存中加载数据到vector寄存器,可以直接用地址初始化:uint8 t = (uint8)0x00020000;short16 v2 = (short16)t;
例 注意这里千万别写错成short16 v0=(short16)*(short*)p_u8Src;
uchar* p_u8Src;short16 v0=(short16)*(uchar16*)p_u8Src;
或者用vpld:
例
short16 inN;
short in[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
inN=*(short16*)in;
short16 v0=(short16)vpld(in,inN);
4,将向量输出到内存中去用vst:
例
short p_out_u8[16];
vst(v0,(short*)p_out_u8,(short)0xffff);
5,矢量的裁剪与组合:
6,Vselectshort32 vec;short16 vec_lo = vunpack_lo(vec);short16 vec_hi = vunpack_hi(vec);short16 vec_lo;short16 vec_hi;short32 vec = vpack(vec_lo,vec_hi);
int8 v1, v2, v3;unsigned char vpr0;…v3 = vselect(v1, v2, vpr0);
For every ith element of v3, if the ith bit of vpr0 is set, it will contain the ith element of v1, otherwise it will contain the ith element of v2.
7,intrinsic中的mnemonic释义
vrA.t : t表示所有的类型,vr表示向量寄存器v0−v39vW.t : w表示destination ,v表示向量寄存器v0−v23vlZ.t : vl表示v0−v23arA.t : a表示general register file?prX : 表示这条命令是否执行?vprX : 向量运算中每一位的开关srX : General notation for all SRF registers.moduN : Modulo registers : modu0 through modu3sX, sZ :Step registers: s0 through s7sp: Stack PointervacchZ.t : 中的acch为accumulator累加,acc表示v24−v39,acch表示v32−v39vaccZp.t : 中的p表示向量或累加器的高位或低位,用h (high) or l (low)表示vrZ0p.dc32 : 中的d表示unsigned 或singed don't care#[u]immXx : 立即数,X表示标识符,x表示多少bit长
prZ,vprZ :这是一个操作占位符,表示这里进行许多操作如:cmp, ffs, flcopy, fpcmp, max, min, prm,shiftl, shiftr, tst,vacccmp, vcmp, vcmpacc, vcmpmov,
vfpcmp, vld.h, vmax, vmin, vmov, vpop等
8,寻址模式
(#imm32).t: 直接寻址(rN.ui).t [+pm]: 间接寻址(rN.ui).t + #imm32: 间接寻址(#uimmN32).t:长直接寻址(rM.ui + rN.i).t[+pm]:索引寻址(rM.ui +
其中:pm表示Post-modification相当于定语后置,进行地址的偏移修饰
9,数字的表示
10,符号的意义
11,用ld或pop给寄存器赋值
Sign-/zero-extended表示 没有u的话,用0填充,有u用1填充
When storing or pushing a register, the high part is the first part written to memory.
When loading or popping a register, the low part is the first part read from memory.12,vec-c 直接优化的数学运算:
1,vector inversion (向量倒置) inv
2,vector (inverse) square root (向量平方根,或平方根的倒置) sqrt / sqrti
阅读全文
0 0
- VEC-C 进阶 指令解析及寻址模式
- VEC-C之VPLD的rel与abslute两种寻址模式理解源码
- 指令及寻址方式三
- X86指令编码内幕 --- ModRM 寻址模式
- 其它寻址模式与其它指令
- X86指令编码内幕 --- ModRM 寻址模式
- ARM寻址方式及相关指令汇总
- 指令及操作数的寻址方式
- ARM寻址方式及相关指令汇总
- VEC-C基础
- VEC-C直方图
- VEC-C滑窗
- 65C02指令集,寻址模式及其指令编码
- vec
- 51 单片机汇编指令的 寻址方式的通俗解析
- 初探处理器体系结构及寻址模式
- 初探处理器体系结构及寻址模式
- X86/X64处理器体系结构及寻址模式
- 利用vue实现多层循环
- 从Twitter下载视频
- Leetcode#389. Find the Difference(位运算=异或)
- 序列化二叉树
- EXCEL预览正常,打印却是空白的解决方法之一
- VEC-C 进阶 指令解析及寻址模式
- list对象转json 解决办法
- redis服务器配置小结
- springmvc使用小细节
- C++名词解释
- 英语短语
- Android手机设备唯一标识符
- 安卓设计模式——桥接模式
- realloc、malloc、以及calloc函数的区别