Method: Write assembly code to implement a simple program given in C, using the outline supplied.
Preparation: Read chapter 2 of H&P through section 2.7
Files to use: posrun.c, posrun.s, posrunDriver.c, posrunDriver.s,
posrunopt.s, posrunoptDriver.c, posrunoptDriver.s
The file posrun.c contains a simple C function which finds the length of the longest contiguous sequence of positive values in a long long int array passed as two parameters, the first the array base address and the second the length of the array. The file posrun.s contains an outline of ARMv8 assembly code for this function as might be generated by a straightforward, non-optimizing compiler. The file posrunDriver.c contains a program that tests this function for several arrays.
Your first task is to fill in the correct assembly code for posrun.s. One instruction per commented line, as guided by the comments should do it. You should save your assembly program as posrun??.s where ?? is your last name followed by your first initial.
Your second task is to optimize the loop in this program so as to decrease the number of instructions executed on each iteration of the loop. This may involve adding additional instructions that are executed either before or after the loop. The file posrunopt.s can be used as a starting point. Include comments in your optimized code which indicate what changes you made and how they improve the code. Name your optimized version posrunopt??.s.
The two driver programs are C programs that would call your function several times to test it.
Hand in your two files posrun??.s and posrunopt??.s by emailing them to the instructor in a zip file: lab2-??. Be sure that your files have your name and initial as part of the filename, e.g. posrunNevisonC.s, posrunoptNevisonC.s, lab2-NevisonC.s.