Advertisement
xopsuei

Untitled

May 13th, 2014
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2.     .align 4
  3.     .globl procesar
  4.     .type   procesar, @function
  5. procesar:
  6.     pushl   %ebp
  7.     movl    %esp, %ebp
  8.     subl    $16, %esp
  9.     pushl   %ebx
  10.     pushl   %esi
  11.     pushl   %edi
  12.  
  13. # Aqui has de introducir el codigo
  14.   xorl %edi, %edi # edi <- i = 0
  15.   movl 16(%ebp), %esi # esi = N
  16.   imul %esi, %esi # esi = N*N
  17.        
  18.   movl 8(%ebp), %ecx # ecx = *mata
  19.   movl 12(%ebp), %edx # edx = *matb
  20.        
  21.   #for 0 -> n^2
  22. bucle:
  23.     cmpl %esi, %edi
  24.   jge fifor
  25.    
  26.   movdqu (%ecx, %edi), %xmm0
  27.   paddb %xmm0, %xmm0 # mata[i*n+j]*2
  28.   paddb %xmm0, %xmm0 # mata[i*n+j]*4
  29.   paddb %xmm0, %xmm0 # mata[i*n+j]*8
  30.   paddb %xmm0, %xmm0 # mata[i*n+j]*16
  31.   movdqu %xmm0, (%edx, %edi) # matb[i*n+j] <- mata[i*n+j]*16
  32.  
  33.   addl $16, %edi #add 16
  34.   jmp bucle    
  35. fifor:
  36.  
  37. # El final de la rutina ya esta programado
  38.  
  39.     emms    # Instruccion necesaria si os equivocais y usais MMX
  40.     popl    %edi
  41.     popl    %esi
  42.     popl    %ebx
  43.     movl %ebp,%esp
  44.     popl %ebp
  45.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement