blob: c0e757fae8d6c5590fff813b578cd29302d39e7a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* SPDX-License-Identifier: copyleft-next-0.3.1 */
#include <stdint.h>
#include <stddef.h>
#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);
}
|