#include "stdafx.h" #include "emmintrin.h" #include <iostream> #include <iomanip> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { short B2[4][4];//input 2-D array short B3[4][4]; // Transformed matrix int n=0; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++, n++) B2[i][j] = n; __asm{ // computing b3-transformed matrix movq mm1, B2 movq mm2, B2+8 movq mm3, B2+16 movq mm4, B2+24 //add-sub register element paddw mm1,xmm4 paddw xmm2,xmm3 psubw mm1,xmm3 psubw mm3,xmm4 //move result in b3 movq B3, mm1 movq B3+8, mm2 movq B3+16, mm1 movq B3+24, mm3 emms } for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) cout << B2[i][j] << " "; cout << endl; } cout << endl; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) cout << B3[i][j] << " "; cout << endl; } return 0; }
mm
xmm
paddw mm1, xmm4
paddw xmm2, xmm3
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)