Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <mips/regdef.h>
- #ifndef SIZE_LONG_LONG
- #define SIZE_LONG_LONG 8
- #endif
- .text
- .abicalls
- .align 2
- .globl trasponer
- .ent trasponer
- trasponer:
- subu sp, sp , 48
- sw ra, 40(sp)
- sw $fp, 36(sp)
- move $fp,sp
- sw gp, 32(sp)
- sw a0, 48(sp) # Cantidad de filas
- sw a1, 52(sp) # Cantidad de columnas
- sw a2, 56(sp)
- sw a3, 60(sp)
- add t0, zero, zero # t0 es el valor de "i" fila
- add t1, zero, zero # t1 es el valor de "j" columna
- addi v0, zero, 0
- FOR_FILAS:
- blt t0, a0, FOR_COLUMNAS
- FINISH:
- lw gp, 32(sp)
- lw $fp, 36(sp)
- lw ra, 40(sp)
- addiu sp, sp, 48
- jr ra
- FOR_COLUMNAS:
- blt t1, a1, TRASPOSE
- add t1, zero, zero
- addi t0, zero, 1
- b FOR_FILAS
- TRASPOSE:
- mul t2, t1, a0
- addu t2, t2, t0
- addi t3, zero, SIZE_LONG_LONG
- mul t2, t3, t2 # t2 es la posicion de entrada
- mul t4, t0, a1
- addu t4, t4, t1
- addi t3, zero, SIZE_LONG_LONG
- mul t4, t3, t4 # t4 es la posicion de salida
- addu t5, t2, a2
- ld t6, t5
- addu t7, t4, a3
- sd t6, t7
- addi t1, t1, 1
- b FOR_COLUMNAS
- .end trasponer
- # .size trasponer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement