From 422b6c976e28445d2a6e14586fa416b0f16c093f Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 24 Jun 2023 20:48:32 +0300 Subject: initial commit --- src/main.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main.c (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..be93061 --- /dev/null +++ b/src/main.c @@ -0,0 +1,32 @@ +#include +#include + +#include "copyjit.h" + +int main() +{ + ctx_t ctx; + compile_start(&ctx); + + compile_uli(&ctx, 0); // total in a + compile_movao(&ctx); + + compile_uli(&ctx, 0); + compile_movyo(&ctx); // iter in y + + void *top = compile_movxa(&ctx); // iter + total in a + compile_add(&ctx); + + compile_incy(&ctx); // increment iter + compile_uli(&ctx, 1000000000); // limit in o + compile_subyo(&ctx); + + compile_uli(&ctx, (uintptr_t)top); // branch target in o + compile_ban(&ctx); + + compile_end(&ctx); + + compile_finish(&ctx); + + run(&ctx); +} -- cgit v1.3