_offc_probe_5args.nx source
↩ module page · 19 lines · 510 B
1// Tests nxc.elf codegen for: 5-arg function call.
2// regalloc_test.nx fails at ir_emit_binop (5 args). If this fails, the
3// bug is in arg passing or call ABI for >4 args.
4
5import "syscalls.nx"
6
7func sum5(a: i64, b: i64, c: i64, d: i64, e: i64) -> i64 {
8 return a + b + c + d + e
9}
10
11func main() -> i64 {
12 let n: i64 = sum5(10, 20, 5, 4, 3) // 42
13 let msg: *u8 = sys_mmap(8)
14 msg[0] = 0x30 + (n / 10)
15 msg[1] = 0x30 + (n - (n/10)*10)
16 msg[2] = 0x0A
17 sys_write(1, msg, 3)
18 return 0
19}