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: 33% (6 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...
-
Aspen Company estimates its manufacturing overhead to be $625,000 and its direct labor costs to be $500,000 for year 2. Aspen worked on three jobs for the year. Job 2-1, which was sold during year 2,...
-
Allocate the revenues of a bundled package to the individual products in that package
-
In 2003, Karen Pearson and Steve and Tara Carlson agreed to buy a 2004 Dynasty recreational vehicle (RV) from DeMartinis RV Sales in Grass Valley, California. On September 29, Pearson, the Carlsons,...
-
At year-end (December 31), Chan Company estimates its bad debts as 0.70% of its annual credit sales of $902,000. Chan records its Bad Debts Expense for that estimate. On the following February 1,...
-
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...
-
When a de Laval nozzle has expansion ratio of 4, what does that mean?
-
Suppose that you own the only company in the market to produce a certain product, and therefore you can determine the market price P dollars for each unit. Due to government regulations, the price of...
-
describes how the blast pressure front can bounce off solid, immovable obstacles and be redirected in another direction in a linear angle to the angle of the obstacle hat was struck
-
As the accounting clerk, you are tasked by the CFO to determine the cost of goods sold of Del Mundo Company for the year ended December 31, 2020. During Operating cost data annd inventory account...
-
Using the ideas of kinetic particle theory when you come home from school and open the door you can smell food being cooked
-
The following information relates to Salamat Corporation for the last year.Salamat uses direct labor hours as an overhead base. Estimated direct labor hours 360,000 hours Estimated manufacturing...
-
Determine the humidity ratio and the partial pressure of the dry air if, for the atmospheric air: a) Tdb 5 60 8F, P atm 5 14.7 psia, and f 5 60% b) Tdb 5 120 8F, P atm 5 14.4 psia, and f 5 15%
-
Outline some of the major problems confronting an international advertiser.
-
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...
-
Flint Corporation issued 1.900 shares of stock. Prepare the entry for the issuance under the following assumptions. (List all debit entries before credit entries. Credit account titles are...
-
v Campbell Electronics is considering investing in manufacturing equipment expected to cost $240,000. The equipment has an estimated useful life of four years and a salvage value of $18,000. It is...
-
EZ Clean Corporation uses the calendar year and accrual method of accounting. It sells contracts to provide monthly cleaning services to customers. A one-year contract costs $1,200 ($100 per month);...
Study smarter with the SolutionInn App