Advertisement
cirossmonteiro

tensor.asm

Mar 5th, 2025
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [BITS 64]
  2.  
  3. section .data
  4.     order_a equ 5
  5.     dimensions_a dd 1,2,3,4,5
  6.     product_a dd 0
  7.  
  8.     order_b equ 4
  9.     dimensions_b dd 3,4,5,6
  10.     product_b dd 0
  11.  
  12. section .text
  13.     global _start
  14.  
  15. _start:
  16.  
  17. ; compute product_a
  18.     mov eax, 1
  19.     mov ecx, order_a
  20.     mov rsi, dimensions_a
  21.  
  22. fproduct_a:
  23.     mov ebx, [rsi]
  24.     imul eax, ebx
  25.     add rsi, 4
  26.     loop fproduct_a
  27.  
  28.     mov [product_a], eax
  29.     mov ebx, [product_a]
  30.  
  31. ; compute product_b
  32.     mov eax, 1
  33.     mov ecx, order_b
  34.     mov rsi, dimensions_b
  35.  
  36. fproduct_b:
  37.     mov ebx, [rsi]
  38.     imul eax, ebx
  39.     add rsi, 4
  40.     loop fproduct_b
  41.  
  42.     mov [product_b], eax
  43.     mov ebx, [product_b]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement