MIPS instructions to set a register to 1 -
this question has appeared in few past papers cannot find on internet. what 6 single instruction mips can set $v1 hold decimal value of 1? against common misconception, li , la or move not single instruction, pseudo instructions, taking multiple machine instructions execute. because of guess don't come option. here instructions can such thing addi $v1, $zero, 1 addui $v1, $zero, 1 ori $v1, $zero, 1 xori $v1, $zero, 1 # these use comparison slt $v1, $zero, $31 # last 1 can non-empty register slti $v1, $zero, 1 sltu $v1, $zero, $31 # last 1 can non-empty register sltiu $v1, $zero, 1 # these use memory lb $v1, one($zero) lbu $v1, one($zero) lh $v1, one($zero) lhu $v1, one($zero) lw $v1, one($zero) one: .word 1 when counting pseudo instructions, li , la come available too.