Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The assembled version of the above sample code contains these lines: ADD R3,RO,R1; R3=a+b LEA R4, c: get address of global variable c STR

image text in transcribedimage text in transcribed

The assembled version of the above sample code contains these lines: ADD R3,RO,R1; R3=a+b LEA R4, c: get address of global variable c STR R3, R4, #0; put result into global variable c LEA RO, LOCK_C AND R1,R1,#0 STR R1,RO,#0 an optimizing compiler, for reasons that only it knows, decides that doing BLOCK stores and writes to memory are better for performance, so it collects all the memory loads and all of the memory stores into localized blocks as follows: LEA RO, LOCK_C LEA R4, c; get address of global variable c AND R1,R1,#0 ADD R3,RO,R1; R3=a+b STR R1 R0,#0 STR R3,R4, #0; put result into global variable c What is wrong with this "optimized" version of the code IF you were actually running it in a multi-threaded environment even if it does all the same things as the original code in terms of modifying memory as needed when it ALL runs? Be specific in your answer. The compiler optimization shown here is an example of. for i 1 to N x=x+1 for j=1 to N a (i,j) 100 N+10+1+1+x t1-100 N for i 1 to N x=x+1 for j 1 to N a (i,j) t1+10+1+1+x Constant Propagation Strength Reduction Loop Invariant Code Motion Common Sub-Expression Elimination

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Networking A Top-Down Approach

Authors: James Kurose, Keith Ross

7th edition

978-0133594140

More Books

Students also viewed these Computer Network questions

Question

Does the person have her/his vita posted?

Answered: 1 week ago