计算机组成课程个人作业
参考:
https://blog.csdn.net/yangjianqiao0/article/details/69388595
https://blog.csdn.net/dahan_wangtao/article/details/1944153
核心代码
#include<iostream> using namespace std; __int64 i64_a[2],*p64=i64_a,test=1; unsigned char a[4]={2,2,2,2},b[4]={128,128,128,128},*pa=a,*pb=b; unsigned short step_now=15,step_all=32,stepMMXn[4],stepMMXl[4]; int main(){ // i64_a[0]=0; // i64_a[1]=1; // __asm(" // mov p64,%eax // movq (%eax),%mm0 // movq %mm0,8(%eax) // "); for(int i=0;i<4;i++){ stepMMXn[i]=step_now; stepMMXl[i]=32-step_now; } __asm(" pxor %mm7,%mm7 movd a,%mm0 movd b,%mm1 punpcklbw %mm7,%mm0 punpcklbw %mm7,%mm1 movq stepMMXl,%mm2 movq stepMMXn,%mm3 pmullw %mm2,%mm0 pmullw %mm3,%mm1 paddw %mm1,%mm0 psrlw $5,%mm0 packuswb %mm7,%mm0 movd %mm0,a "); printf("%llx ",test); printf("%d %d ",sizeof(a),sizeof(test)); for(int i=0;i<4;i++) printf("a=%d,b=%d ",a[i],b[i]); return 0; }
完整代码还在写