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: 80% (5 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?
-
At the beginning of the month, Arthur's Olde Consulting Corporation had two jobs in process that had the following costs assigned from previous months: During the month, Jobs SY-400 and SY-403 were...
-
Give examples of the bundling of products that give rise to revenue-allocation issues
-
Upland Company borrowed $40,000 on November 1, 2012, by signing a $40,000, 9%, 3-month note. Prepare Uplands November 1, 2012, entry; the December 31, 2012, annual adjusting entry; and the February...
-
Al Maha ceramics issues OMR 500,000, 10% debentures at premium of 10%. The tax rate is 40%, the cost of debt capital is __________. a. 5% b. 4.6% c. 5.82% d. 5.4% Clear my choice
-
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...
-
For which of the following combinations of P-value and significance level would the null hypothesis be rejected? a. P-value = 0.426 = 0.05 b. P-value = 0.033 = 0.01 c. P-value = 0.046 = 0.10 d....
-
Code in matlab the translational motion via numeric integration of the orbit (two-body orbit sufficient). Use the orbital characteristics of the Centaur V upper stage from the Atlas V launch on...
-
Lolita Company has the following information available for June 2020: Beginning Work in Process Inventory (25% as to conversion) 20,000 units Started 130,000 units Ending Work in Process Inventory...
-
Question 3 (15 marks) Sporty Ltd. produces scooters and skateboards. At the beginning of the year, the following volume of activities were budgeted for the year: Production volume/units Direct labour...
-
Consider a rigid body B with center of mass point B*. A set of coordinate axes is chosen centered at B* and defined by mutually orthogonal unit vectors 61, 62, 63 which are fixed in B. The rigid body...
-
Let A be the matrix 1 0 2 4 1 -6 = 7-4 7 -5 3 (a) (2 points) What must a and b be in order to define the linear transformation T: RR by T(x) = Ax. (b) (3 points) What is the image of the vector 2] 1...
-
Determine the humidity ratio and the partial pressure of the dry air if, for the atmospheric air: a) Tdb 5 20 8C, P atm 5 100 kPa, and f 5 50% b) Tdb 5 40 8C, P atm 5 105 kPa, and f 5 20%
-
The Pletcher Transportation Company uses a responsibility reporting system to measure the performance of its three investment centers: Planes, Taxis, and Limos. Segment performance is measured using...
-
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...
-
A loss from the sale or exchange of property will be disallowed in which of the following situations? a. A transaction between a partnership and a partner who owns 40 percent of the partnership...
-
Oriole Company recently opened for business. The owner wants a cost function estimate to help with future planning. The manager feels that last month's results fairly represent costs over the coming...
-
Indicate whether the following costs should be expensed (E) or capitalized (C) depending on whether the company uses successful efforts or the full cost method of accounting Successful Efforts Full...
Study smarter with the SolutionInn App