Question
1. Streaming SIMD Extensions: Each 128-bit MMX register can be divided into 4- 32 bit single precision floating point register that supports arithmetic operations on
1. Streaming SIMD Extensions:
Each 128-bit MMX register can be divided into 4- 32 bit single precision floating point register that supports arithmetic operations on all the registers simultaneously via the instructions such as:
For documentation on MMX intrinsic refer to the following link for MS Visual Studio:
http://msdn.microsoft.com/en-us/library/y0dh78ez%28v=vs.90%29.aspx and
http://www.linuxjournal.com/content/introduction-gcc-compiler-intrinsics-vector-processing for gcc intrinsics
and further references on page 5 of the article:
http://www.linuxjournal.com/content/introduction-gcc-compiler-intrinsics-vector-processing?page=0,4
(Note that the SSE intrinsics are not part of the C/C++ standard, hence different C/C++ compilers such as MSVC++ and gcc,
(if you are running Linux) define the SIMD operations differently.
Use the extensions defined for the compiler you are using.) Write a C/C++ program using the above intrinsics, to sort an array via bubble sort algorithm, based on the following sequential implementation.
procedure bubbleSort( A : list of sortable items )
n = length(A)
repeat
swapped = false
for i = 1 to n-1 inclusive do
if A[i-1] > A[i] then
swap( A[i-1], A[i] )
swapped = true
end if
end for
until not swapped
end procedure
Depending on the compiler you are working with, you might find the corresponding functions for setting the values of the registers, loading values into the register from a location in memory, adding the components of corresponding registers in parallel, and storing values back to memory to be essential for this exercise.
Eg: _tl_ps, _mm mul_ps, mm add ps, mmstore_ps Are defined for floating point operations. Another set of corresponding intrinsic functions are defined for integer operations also. mm seStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started