Modify the Y86-64 code for the sum function (Figure 4.6) to implement a function absSum that computes
Question:
Modify the Y86-64 code for the sum function (Figure 4.6) to implement a function absSum that computes the sum of absolute values of an array. Use a conditional move instruction within your inner loop.
Figure 4.6
Transcribed Image Text:
x86-64 code T 2 3 4 5 6 7 8 9 10 11 1 2 3 5 6 7 8 10 long sun(long start, long count) start in %rdi, count in rai sun: Y86-64 code 11 12 13 nov1 so. %eax jap .L2 L3: addq addq subq .L2: testq %rai, %rai jne L3 rep: ret (%rdi). %rax $8, %rdi $1. %rsi irmovq $8.%re irmovq $1,%r9 xorq %rax. %rax andq %rsi,%rsi jap test loop: mrmovą (Zrd1). %r10 addq %r10. %rax addq %r8.%rdi subq %r9,%rsi test: jne ret sum - 0 Goto test loop loop: long sun(long start, long count) start in Zrdi, count in irsi sun: Add start to sun start++ count- tent: Tent sun If 1-0, goto loop Return Constant 8 Constant 1 Set CC Goto test Get start Add to sun start++ count- Set CC Stop when 0 Return
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 40% (5 reviews)
This problem gives you a chance to try your hand at writing assembly code with ...View the full answer
Answered By
Pushpinder Singh
Currently, I am PhD scholar with Indian Statistical problem, working in applied statistics and real life data problems. I have done several projects in Statistics especially Time Series data analysis, Regression Techniques.
I am Master in Statistics from Indian Institute of Technology, Kanpur.
I have been teaching students for various University entrance exams and passing grades in Graduation and Post-Graduation.I have expertise in solving problems in Statistics for more than 2 years now.I am a subject expert in Statistics with Assignmentpedia.com.
4.40+
3+ Reviews
10+ Question Solved
Related Book For
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron
Question Posted:
Students also viewed these Computer science questions
-
Modify the Y86-64 code for the sum function (Figure 4.6) to implement a function absSum that computes the sum of absolute values of an array. Use a conditional jump instruction within your inner...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Theresa Pratt works in the business office at Mills College, a technical college in Council Bluffs, Iowa. She has created a workbook to store and analyze registration and employee data. The workbook...
-
Roles define the manager. Do you agree or disagree with this statement? Discuss what you think managers do.
-
Contrast planning cash requirements, especially borrowing, using the statement of cash flows derived from forecast financial statement with a cash budget. Which is likely to be more useful in running...
-
The payroll records of Brownlee Company provided the following information for the weekly pay period ended March 23, 2015: Required 1. Enter the relevant information in the proper columns of a...
-
Differentiate between jet and surface condensers.
-
Pitt Limited is trying to determine the value of its ending inventory as of February 28, 2017, the company's year-end. The accountant counted everything that was in the warehouse as of February 28,...
-
In the figure, a uniform, upward electric field of magnitude 2.00x 103 N/C has been set up between two horizontal plates by charging the lower plate positively and the upper plate negatively. The...
-
Let us determine the behavior of the instruction pushq %rsp for an x86-64 processor. We could try reading the Intel documentation on this instruction, but a simpler approach is to conduct an...
-
Write Y86-64 code to implement a recursive product function rproduct, based on the following C code: Use the same argument passing and register saving conventions as x86-64 code does. You might find...
-
Assume that the car cost 10,000. Would this alter the relevance of the historic cost?
-
Under the shop, _________________ no one is forced to join the union.
-
What are the major factors that an organization needs to analyze before it can consider entering a foreign market?
-
How do you think a learning organization would act in this dynamic environment? What survival chances do the stagnant organizations have?
-
What is the role of codetermination? In your opinion, is the incorporation of lower-level employees on the board appropriate?
-
Discuss the importance of the common-size financial statements in strategic evaluation and control process.
-
What are the disadvantages for the acquirer of obtaining control by a purchase of shares?
-
Write out the formula for the total costs of carrying and ordering inventory, and then use the formula to derive the EOQ model. Andria Mullins, financial manager of Webster Electronics, has been...
-
How many MIPS instructions does it take to implement the C code from Exercise 2.27? If the variables a and b are initialized to 10 and 1 and all elements of D are initially 0, what is the total...
-
Translate the following loop into C. Assume that the C-level integer i is held in register $t1, $s2 holds the C-level integer called result, and $s0 holds the base address of the integer MemArray....
-
Implement the following C code in MIPS assembly. What is the total number of MIPS instructions needed to execute the function int fib(int n){ if (n==0) return 0; else if (n 1) == return 1; else...
-
In the automobile industry, the dimensionless drag coefficient and the area of the vehicle are often combined into one variable - the drag area whereby the drag area is the product of the...
-
When you drop 10 pebbles into the well, you record the times for hearing the splash as 2.94 s, 3.11 s, 3.12 s, 2.97 s, 3.12 s, 2.97 s, 3.06 s, 3.21 s, 3.37 s, and 3.53 s. (a) Find the average time...
-
A 0.55 kg block of ice is sliding by you on a very slippery floor at 3.5 m/s. As it goes by, you give it a kick perpendicular to its path. Your foot is in contact with the ice block for 0.0035...
Study smarter with the SolutionInn App