Your cart is currently empty!
Please submit individual source files for coding exercises (see naming conventions below) and a single solution document for non-coding exercises (.txt or .pdf only). Your code and answers need to be documented to the point that the graders can understand your thought process. Full credit will not be awarded if sufficient work is not shown.…
Please submit individual source files for coding exercises (see naming conventions below) and a single solution document for non-coding exercises (.txt or .pdf only). Your code and answers need to be documented to the point that the graders can understand your thought process. Full credit will not be awarded if sufficient work is not shown.
Suppose we’ve got a procedure that computes the inner product of two vectors u and v.
Consider the following C code:
void inner(float *u, float *v, int length, float *dest) {
int i;
float sum = 0.0f;
for (i = 0; i < length; ++i) {
sum += u[i] * v[i];
}
*dest = sum;
}
The x86-64 assembly code for the inner loop is as follows:
# u in %rbx, v in %rax, length in %rcx, i in %rdx, sum in %xmm1
.L87:
movss (%rbx, %rdx, 4), %xmm0
mulss (%rax, %rdx, 4), %xmm0
adds %xmm0, %xmm1
addq $1, %rdx
cmpq %rcx, %rdx
jl .L87
# Get u[i]
# Multiply by v[i]
# Add to sum
# Increment i
# Compare i to length
# If <, keep looping
Zip the source files and solution document (if applicable), name the .zip file <Your Full Name>Assignment7.zip (e.g., EricWillsAssignment7.zip), and upload the .zip file to Canvas (see Assignments section for submission link).