Translate the following code to ARM Assume f and g are in re

Translate the following code to ARM. Assume f and g are in registers X9 and X10.

Translate the following code to ARM. Assume f and g are in registers X9 and X10. if (f != g) {f = 1;} else f = 2;}

Solution

this is the simple ARM code for above if-else conditions

CMP x9,NE x10; //if(f!=g)

MOVLE x9,#1; // f=1;

MOVEGT x9,#2; // else f=2;

1st line we are comparing f with g and NE indicates not equal to g

2nd line LE means signed less that or equal to i.e. we are making f value to 1

3rd line GT means signed greated than or equal i.e.if the above condition fails making f value to 2

Translate the following code to ARM. Assume f and g are in registers X9 and X10. Translate the following code to ARM. Assume f and g are in registers X9 and X10

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site