

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The sparc assembly instructions to define global variables and performs optimization on a given c code fragment. It includes instructions to set and manipulate registers, as well as an optimized version of the assembly code.
Typology: Quizzes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


#1. a) Write the SPARC assembly instructions to define the following global variables in the data segment: char jet[] = "Cold Hard B!!!!!"; double mint = 103.5; short stop = -420;
#2. What is the value ( in hex ) of %o1 after each set of instructions:
a) set 0xCAFE5742, %o set 0xC359C359, %o btog %o2, %o
Value in %o1 at this point is 0x ______________________________________________
b) set 0xCAFE5742, %o sll %o1, 8, %o
Value in %o1 at this point is 0x ______________________________________________
c) set 0xCAFE5742, %o set 0xC359C359, %o or %o1, %o2, %o
Value in %o1 at this point is 0x ______________________________________________
d) set 0xCAFE5742, %o sra %o1, 12, %o
Value in %o1 at this point is 0x ______________________________________________ (over)
#3. Write the equivalent unoptimized SPARC assembly language instructions to perform the following C code fragment. Do not use the ba test way of setting up a loop.
C SPARC assembly for ( i = 420; i < 4902; ++i ) { /* i is mapped to %l1 / x = i / 17; / x is mapped to %l3 */ } x = x + 5;
Now optimize your answer to eliminate any delay slots: Optimized version of above SPARC assembly