Let’s do one last matrix operation that is useful: transposing. We have coded two versions, one using unpacking and one using shuffling.
Example Transposing Code
Listing
37-1 shows the
code.
; transpose4x4.asm
extern printf
section .data
fmt0 db "4x4 DOUBLE PRECISION FLOATING POINT MATRIX TRANSPOSE",10,0
fmt1 db 10,"This is the matrix:",10,0
fmt2 db 10,"This is the transpose (unpack):",10,0
fmt3 db 10,"This is the transpose (shuffle):",10,0
align 32
matrix dq 1., 2., 3., 4.
dq 5., 6., 7., 8. ...