2023-10-22 20:42:03 +00:00
|
|
|
(def types-asm
|
|
|
|
'((type-prim Double f64)
|
|
|
|
(type-array BigVec Double 100)))
|
2023-09-03 17:32:28 +00:00
|
|
|
|
2023-10-22 20:42:03 +00:00
|
|
|
(def add-asm
|
|
|
|
'((link-name "add_vector")
|
|
|
|
(parameter-count 2)
|
|
|
|
# Declarations
|
|
|
|
(bind a BigVec)
|
|
|
|
(bind b BigVec)
|
|
|
|
(bind c BigVec)
|
|
|
|
(add c a b)
|
|
|
|
(return c)))
|
2023-09-03 17:32:28 +00:00
|
|
|
|
2023-10-22 20:42:03 +00:00
|
|
|
(def sub-asm
|
|
|
|
'((link-name "sub_vector")
|
|
|
|
(parameter-count 2)
|
|
|
|
(bind a BigVec)
|
|
|
|
(bind b BigVec)
|
|
|
|
(bind c BigVec)
|
|
|
|
(subtract c a b)
|
|
|
|
(return c)))
|
|
|
|
|
|
|
|
(def ctx (sysir/context))
|
|
|
|
(sysir/asm ctx types-asm)
|
|
|
|
(sysir/asm ctx add-asm)
|
|
|
|
(sysir/asm ctx sub-asm)
|
|
|
|
(print (sysir/to-c ctx))
|