1
0
mirror of https://github.com/janet-lang/janet synced 2025-05-05 00:44:14 +00:00
janet/examples/sysir/arrays2.janet
Calvin Rose 9a1cd6fdd9 Add janet_sysir_scalarize
Makes it easier to add simpler backends without needing to completely
handle vectorization.
2025-02-24 19:12:17 -06:00

24 lines
491 B
Plaintext

(def ir-asm
'((link-name "add_vectorp")
(parameter-count 2)
# Types
(type-prim Double f64)
(type-array BigVec Double 100)
(type-pointer BigVecP BigVec)
# Declarations
(bind 0 BigVecP)
(bind 1 BigVecP)
(bind 2 BigVecP)
(add 2 0 1)
(return 2)))
(def ctx (sysir/context))
(sysir/asm ctx ir-asm)
(print (sysir/to-c ctx))
(printf "%.99M" (sysir/to-ir ctx))
(print (sysir/scalarize ctx))
(printf "%.99M" (sysir/to-ir ctx))
(print (sysir/to-c ctx))