I wrote code to sort an Array using the bubble sort method. The dynamic Instruction is really long about 60k, i need to reduce it to about 20k. Could someone help me optimize the code or give me tips on how to do that? Or if there is a better algorithm? Thanks
.data
Array: .alloc 100
.text
Sort: addi $1, $0, Array
swi 542
loop1: addi $2, $1, 396
addi $3, $0, 0
loop2: lw $5, 0($2)
lw $6, -4($2)
slt $4, $5, $6
beq $4, $0, skip
sw $6, 0($2)
sw $5, -4($2)
addi $3, $0, 1
skip: addi $2, $2, -4
bne $2, $1, loop2
bne $3, $0, loop1
jr $31