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 jump instruction within your inner loop.
Figure 4.6
Transcribed Image Text:
x86-64 code 1 2 3 4 5 6 7 8 9 10 11 1 2 3 5 6 7 8 9 10 11 long sun(long start, long count) start in Zrdi, count in rai sun: 12 13 14 movl So, Zeax L2 jap Y86-64 code L3: addq addq subq .L2: testq %rai, %rai jne .L3 rep: ret (%rdi). %rax $8. %rdi $1. %rai irmovq $8.%r8 irnova $1.%r9 xorq %rax. %rax andq %rsi,%rsi jap test loop: armovą (%rd1).Xr10. addq %r10. %rax addq %r8.%rdi subq %r9.%rs1 test: sum - 0 Goto test jne loop ret loop: long sun(long start, long count) start in %rdi, count in rai sun: Add start to u start++ count- test: Test sum If 1-0, goto loop Return Constant 8 Constant 1 sum - 0 Set CC Goto test Get start Add to num 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: 66% (3 reviews)
This problem gives you a chance to try your hand at writing assembly code 1 2 3 4 5 6 7 8 9 ...View the full answer
Answered By
Utsab mitra
I have the expertise to deliver these subjects to college and higher-level students. The services would involve only solving assignments, homework help, and others.
I have experience in delivering these subjects for the last 6 years on a freelancing basis in different companies around the globe. I am CMA certified and CGMA UK. I have professional experience of 18 years in the industry involved in the manufacturing company and IT implementation experience of over 12 years.
I have delivered this help to students effortlessly, which is essential to give the students a good grade in their studies.
3.50+
2+ 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 move 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...
-
The code that you add to the Craps main method needs to do the following steps in the following order (where indicated by the comments in the code itself): 1. Declare an integer array named counts...
-
A curve C in three dimensions is given parametrically by (x(t), y(t), z(t)), where t is a real parameter, with a t b. Show that the equation of the tangent line at a point P on this curve where t...
-
Comment on the value of the formula (EFR) approach to estimating funding requirements. Could it create more problems than it solves?
-
What is a warrant? Describe how a new bond issue with warrants is valued. How are warrants used in corporate financing?
-
Calculate the heating season auxiliary energy required for the Boston house in Problem 9.8. Problem 9.8 Using the SLR method, calculate the auxiliary energy required in March for a \(2000...
-
Birkenstock is considering an investment in a nylon-knitting machine. The machine requires an initial investment of $25,000, has a 5-year life, and has no residual value at the end of the 5 years....
-
Assume a merchandising company provides the following information from its master budget for the month of May Sales $ 119,000 Cost of goods sold $ 84,000 Selling and administrative expenses $ 18,000...
-
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...
-
Rondo is making a routine decision, but being new, he has no idea what the outcome will be. Classify the problem in each statement according to the structure and condition under which the decision...
-
Being culturally competent is essential in providing quality care. When caring for a person with Autism, what are two cultural considerations to incorporate into this care?
-
Discuss your thoughts on the legal guidelines regarding ethical health issues.
-
Prepare the journal entries to record the following sales transactions in Blue Spruce Corp.'s books. Blue Spruce uses a perpetual inventory system. (List all debit entries before credit entries....
-
Which motivation theory suggests that employees are motivated by a sense of accomplishment and personal growth?
-
In a tug-of-war game on one campus, 15 students pull on a rope at both ends in an effort to displace the central knot to one side or the other. Two students pull with force 198 N each to the right,...
-
A chemist weighed out 5.14 g of a mixture containing unknown amounts of BaO(s) and CaO(s) and placed the sample in a 1.50-L flask containing CO 2 (g) at 30.0 o C and 750. torr. After the reaction to...
-
Listed below are common types of current liabilities, contingencies, and commitments: a. Accounts payable b. Bank loans and commercial paper c. Notes payable d. Dividends payable e. Sales and excise...
-
Functions can oft en be implemented by compilers in-line. An in-line function is when the body of the function is copied into the program space, allowing the overhead of the function call to be...
-
Can we use the tail-call optimization in this function? If no, explain why not. If yes, what is the difference in the number of executed instructions in f with and without the optimization?
-
Right before your function f from Exercise 2.34 returns, what do we know about contents of registers $t5, $s3, $ra, and $sp? Keep in mind that we know what the entire function f looks like, but for...
-
Why CEO of big companies put importance on human happiness? How does it relate to make a successful Human Resource Manager?
-
Evaluate the following inverse Laplace transforms: a. L-1 98-9 l(s+1)- 1-155+5-2 } b. 95-1 (s+3) 4
-
Based on Bite Toothpaste Bits: Creating a New Product Category Answer, 1. Analyze the possibility of success of the pill-based toothpaste category. 2. toothpaste packaged in sustainable plastic and...
Study smarter with the SolutionInn App