Write a MIPS32 assembly subroutine that finds the absolute v

Write a MIPS32 assembly subroutine that finds the absolute value of an integer input. Follow register conventions. |x| rightarrow The absolute value of a number is its distance from zero.//C-based function prototype: int abs(int x)

Solution

.file 1 \"\" .section .mdebug.abi32 .previous .gnu_attribute 4, 1 .abicalls .text .align 2 .globl abs $LFB0 = . .set nomips16 .ent abs .type abs, @function abs: .frame $fp,8,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 .mask 0x40000000,-4 .fmask 0x00000000,0 .set noreorder .set nomacro addiu $sp,$sp,-8 $LCFI0: sw $fp,4($sp) $LCFI1: move $fp,$sp movz $31,$31,$0 $LCFI2: sw $4,8($fp) lw $2,8($fp) nop bgez $2,$L2 nop lw $2,8($fp) nop subu $2,$0,$2 b $L3 nop $L2: lw $2,8($fp) $L3: move $sp,$fp lw $fp,4($sp) addiu $sp,$sp,8 j $31 nop .set macro .set reorder .end abs $LFE0: .size abs, .-abs .ident \"GCC: (Debian 4.4.5-8) 4.4.5\"
 Write a MIPS32 assembly subroutine that finds the absolute value of an integer input. Follow register conventions. |x| rightarrow The absolute value of a numbe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site