DRVTiny

add_asm.cr

Aug 5th, 2021
728
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def add(a, b)
  2.   asm("
  3.    movl ($0), %eax
  4.    addl ($1), %eax
  5.    movl %eax, ($0)
  6.  " :: "r"(pointerof(a)),"r"(pointerof(b)))
  7.   a
  8. end
  9.  
  10. x=12_i32
  11. y=14_i32
  12.  
  13. #add(pointerof(x),pointerof(y))
  14. puts add(x,y)
  15.  
RAW Paste Data