User Tools

Site Tools


No ACL setup yet! Denying access to everyone.
en:edu:zmitac:s1:apl:lab:lab4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:edu:zmitac:s1:apl:lab:lab4 [2024/12/05 12:23] – ktokarzen:edu:zmitac:s1:apl:lab:lab4 [2024/12/05 12:39] (current) – [Tasks to be done during laboratory] ktokarz
Line 26: Line 26:
     MyProc Sum_of_vectors = (MyProc)GetProcAddress(dllHandle, "Sum_of_vectors");     MyProc Sum_of_vectors = (MyProc)GetProcAddress(dllHandle, "Sum_of_vectors");
          
-     +    Sum_of_vectors();
-    +
 } }
 </code> </code>
Line 105: Line 104:
     std::cout << "Result_3 " << (result_vector[2]) << std::endl;     std::cout << "Result_3 " << (result_vector[2]) << std::endl;
     std::cout << "Result_4 " << (result_vector[3]) << std::endl;     std::cout << "Result_4 " << (result_vector[3]) << std::endl;
- 
 } }
 </code> </code>
Line 113: Line 111:
 .code .code
  
-;****************************************************************************  +;**************************************************************************** 
-;   This function +;   Function to calculate the sum of two vectors 
 +;   Accepts two parameters, returns result by third parameter
 ;****************************************************************************  ;**************************************************************************** 
 Sum_of_vectors PROC  Sum_of_vectors PROC 
- 
     MOVUPS XMM0, OWORD PTR [RCX]   ; load content of memory pointed by the first parameter     MOVUPS XMM0, OWORD PTR [RCX]   ; load content of memory pointed by the first parameter
     MOVUPS XMM1, OWORD PTR [RDX]   ; load content of memory pointed by the second parameter     MOVUPS XMM1, OWORD PTR [RDX]   ; load content of memory pointed by the second parameter
Line 134: Line 132:
  
 ===== Tasks to be done during laboratory ===== ===== Tasks to be done during laboratory =====
-  - Compile the examples and observe their behaviour. Set the breakpoint at the beginning of the code and see how the contents of the registers change with every loop pass. Observe XMM registers as calculations are performed there. +  - Compile the examples and observe their behaviour. Set the breakpoint at the beginning of the code and see how the contents of the registers change. Observe XMM registers as calculations are performed there. 
-  - Write additional functions which calculate subtraction, multiplication and division of arguments.+  - Write additional functions to calculate subtraction, multiplication, and division of arguments. 
 +  - Write the program which calculates the average of the values in the table using vector (SIMD) instructions. Program assumptions: 
 +  * Table contains 64 float values and is defined in C++ file. 
 +  * And address of the table is passed to the function as the first argument. 
 +  * A size of the table is passed as a second argument (you can assume that the size of the table is a multiply of 4). 
 +  * Function uses SIMD instructions. 
 +  * Function returns the value as the scalar, traditionally by XMM0. 
 + 
 +=====For the report===== 
 +  - Include the code of additional functions. 
 +  - Include the code of the average program (both C++ and asm files). 
 +  - The above programs must contain comments.
en/edu/zmitac/s1/apl/lab/lab4.1733397828.txt.gz · Last modified: by ktokarz