Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <windows.h>
  4. #include <iomanip>
  5. #include <ctime>
  6. #include <stdio.h>
  7. #include <cmath>
  8. #include <stdlib.h>
  9. #include <conio.h>
  10. #include <math.h>
  11. #define N 255
  12.  
  13. using namespace std;
  14.  
  15. short int A[N], B[N];
  16. int temp[2];
  17. int R;
  18. int i, n;
  19.  
  20. void main() {
  21. n = 5;
  22.  
  23. A[0] = 2;
  24. A[1] = 3;
  25. A[2] = 4;
  26. A[3] = 5;
  27. A[4] = 1;
  28.  
  29. B[0] = 6;
  30. B[1] = 7;
  31. B[2] = 8;
  32. B[3] = 9;
  33. B[4] = 10;
  34.  
  35. //cout << "‚vvedite dlinu vektora-stroki i vysotu vektora-stolbca (ne bol'she 256) N = \n";
  36. //cin >> n;
  37.  
  38. //for (i = 0;i < n;i++) {
  39. // cout << "‚vvedite " << i + 1 << " jelement vektora-stroki (ne bol'she 256)\n";
  40. // cin >> A[i];
  41. //}
  42. //for (i = 0;i < n;i++) {
  43. // cout << "‚vvedite " << i + 1 << " jelement vektora-stolbca (ne bol'she 256)\n";
  44. // cin >> B[i];
  45. //}
  46.  
  47. __asm {
  48. pusha;
  49. mov ecx, n;
  50. lea eax, A;
  51. lea ebx, B;
  52. cycle:
  53. MOVQ MM0, [eax];
  54. MOVQ MM1, [ebx];
  55. PMADDWD MM1, MM0;
  56. PADDD MM3, MM1;
  57. add eax, 8;
  58. add ebx, 8;
  59. sub ecx, 4;
  60. cmp ecx, 0;
  61. jnle cycle;
  62. MOVQ temp, MM3;
  63. popa;
  64. }
  65.  
  66. R = temp[0] + temp[1];
  67. cout << "\nR = " << R;
  68.  
  69. _getch();
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement