Question
Create an ARMv8 A64 assembly language program that finds the minimum of y = 2 x 4 -145 x 2 -44 x-14 in the range
Create an ARMv8 A64 assembly language program that finds the minimum of y = 2x4 -145x2-44x-14 in the range -10 <= x <=10, by stepping through the range one by one in a loop and testing. Use only long integers for x, and do not factor the expression. Use the printf() function to display to the screen the values of x, y and the current minimum on each iteration of your loop. You are to create 2 versions of your program:
-
Write the program without macros (i.e. don't use m4), and use only the mul, add, and mov instructions to do your calculations. Use a pre-test loop, where the test is at the top of the loop.
-
Optimize the above program by putting the loop test at the bottom of the loop (make sure it is still a pre-test loop), and by making use of the madd instruction. Also, add macros to the above program to make it more readable (use m4). In particular, provide macros for heavily used registers.
Running Your Program
To verify that your assembly language program works, run both versions under gdb, capturing output from each session using the script UNIX command. For version 1, single step through the program (use ni) for at least one iteration of your loop, displaying the instruction being executed (use display/i $pc). Also, print out the contents of particular registers (use p) at key points in your program to show that it is working as expected. For version 2, set a breakpoint just after the place where the final result is calculated, and then print out the minimum. Do not single step through this version.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started