making use of zero register

This commit is contained in:
Jakub Doka 2024-11-13 10:28:16 +01:00
parent 3c86eafe72
commit f524013c34
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
66 changed files with 802 additions and 831 deletions

View file

@ -1765,6 +1765,11 @@ impl Nodes {
(*target, self[*target].outputs.as_slice()) (*target, self[*target].outputs.as_slice())
} }
} }
fn is_hard_zero(&self, nid: Nid) -> bool {
self[nid].kind == Kind::CInt { value: 0 }
&& self[nid].outputs.iter().all(|&n| self[n].kind != Kind::Phi)
}
} }
enum CondOptRes { enum CondOptRes {
@ -2943,7 +2948,6 @@ impl<'a> Codegen<'a> {
self.strip_var(&mut rhs); self.strip_var(&mut rhs);
self.implicit_unwrap(right.pos(), &mut rhs); self.implicit_unwrap(right.pos(), &mut rhs);
let (ty, aclass) = self.binop_ty(pos, &mut lhs, &mut rhs, op); let (ty, aclass) = self.binop_ty(pos, &mut lhs, &mut rhs, op);
let fty = ty.bin_ret(op);
if matches!( if matches!(
op, op,
TokenKind::Lt TokenKind::Lt
@ -2967,9 +2971,12 @@ impl<'a> Codegen<'a> {
} }
} }
} }
let inps = [VOID, lhs.id, rhs.id]; let bop = self.ci.nodes.new_node_lit(
let bop = ty.bin_ret(op),
self.ci.nodes.new_node_lit(fty, Kind::BinOp { op }, inps, self.tys); Kind::BinOp { op },
[VOID, lhs.id, rhs.id],
self.tys,
);
self.ci.nodes.pass_aclass(aclass, bop.id); self.ci.nodes.pass_aclass(aclass, bop.id);
Some(bop) Some(bop)
} }

View file

@ -398,7 +398,8 @@ impl Nodes {
fn is_never_used(&self, nid: Nid, tys: &Types) -> bool { fn is_never_used(&self, nid: Nid, tys: &Types) -> bool {
let node = &self[nid]; let node = &self[nid];
match node.kind { match node.kind {
Kind::CInt { .. } => node.outputs.iter().all(|&o| { Kind::CInt { value: 0 } => false,
Kind::CInt { value: 1.. } => node.outputs.iter().all(|&o| {
matches!(self[o].kind, Kind::BinOp { op } matches!(self[o].kind, Kind::BinOp { op }
if op.imm_binop(self[o].ty).is_some() if op.imm_binop(self[o].ty).is_some()
&& self.is_const(self[o].inputs[2]) && self.is_const(self[o].inputs[2])

View file

@ -223,6 +223,7 @@ impl HbvmBackend {
Kind::Die => { Kind::Die => {
self.emit(instrs::un()); self.emit(instrs::un());
} }
Kind::CInt { value: 0 } => self.emit(instrs::cp(atr(allocs[0]), reg::ZERO)),
Kind::CInt { value } if node.ty.is_float() => { Kind::CInt { value } if node.ty.is_float() => {
self.emit(match node.ty { self.emit(match node.ty {
ty::Id::F32 => instrs::li32( ty::Id::F32 => instrs::li32(
@ -563,7 +564,11 @@ impl<'a> Function<'a> {
} }
); );
debug_assert!(self.nodes[nid].kind != Kind::Phi || self.nodes[nid].ty != ty::Id::VOID); debug_assert!(self.nodes[nid].kind != Kind::Phi || self.nodes[nid].ty != ty::Id::VOID);
regalloc2::VReg::new(nid as _, regalloc2::RegClass::Int) if self.nodes.is_hard_zero(nid) {
regalloc2::VReg::new(NEVER as _, regalloc2::RegClass::Int)
} else {
regalloc2::VReg::new(nid as _, regalloc2::RegClass::Int)
}
} }
fn emit_node(&mut self, nid: Nid, prev: Nid) { fn emit_node(&mut self, nid: Nid, prev: Nid) {
@ -680,6 +685,7 @@ impl<'a> Function<'a> {
self.add_instr(nid, vec![]); self.add_instr(nid, vec![]);
self.emit_node(node.outputs[0], nid); self.emit_node(node.outputs[0], nid);
} }
Kind::CInt { value: 0 } if self.nodes.is_hard_zero(nid) => {}
Kind::CInt { .. } => { Kind::CInt { .. } => {
let ops = vec![self.drg(nid)]; let ops = vec![self.drg(nid)];
self.add_instr(nid, ops); self.add_instr(nid, ops);
@ -687,6 +693,11 @@ impl<'a> Function<'a> {
Kind::Entry => { Kind::Entry => {
self.backrefs[nid as usize] = self.add_block(nid); self.backrefs[nid as usize] = self.add_block(nid);
self.add_instr(NEVER, vec![regalloc2::Operand::reg_fixed_def(
regalloc2::VReg::new(NEVER as _, regalloc2::RegClass::Int),
regalloc2::PReg::new(0, regalloc2::RegClass::Int),
)]);
let (ret, mut parama) = self.tys.parama(self.sig.ret); let (ret, mut parama) = self.tys.parama(self.sig.ret);
let mut typs = self.sig.args.args(); let mut typs = self.sig.args.args();
#[expect(clippy::unnecessary_to_owned)] #[expect(clippy::unnecessary_to_owned)]

View file

@ -10,34 +10,34 @@ main:
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
sin: sin:
LI32 r4, 1124073472w LI32 r6, 1124073472w
LI32 r5, 1078530011w LI32 r7, 1078530011w
FMUL32 r7, r2, r4 FMUL32 r9, r2, r6
FDIV32 r9, r7, r5 FDIV32 r11, r9, r7
FTI32 r11, r9, 1b FTI32 r1, r11, 1b
ANDI r10, r11, 255d ANDI r12, r1, 255d
ITF64 r5, r11 ITF64 r6, r1
MULI64 r4, r10, 4d MULI64 r5, r12, 4d
LRA r3, r0, :SIN_TABLE LRA r4, r0, :SIN_TABLE
LI32 r7, 1086918619w LI32 r9, 1086918619w
FC64T32 r9, r5, 1b FC64T32 r11, r6, 1b
ADDI64 r5, r11, 64d ADDI64 r6, r1, 64d
ADD64 r8, r3, r4 ADD64 r10, r4, r5
LI32 r1, 1132462080w LI32 r3, 1132462080w
FMUL32 r6, r9, r7 FMUL32 r8, r11, r9
ANDI r7, r5, 255d ANDI r9, r6, 255d
LI32 r5, 1056964608w LI32 r7, 1056964608w
LD r4, r8, 0a, 4h LD r5, r10, 0a, 4h
FDIV32 r8, r6, r1 FDIV32 r10, r8, r3
MULI64 r6, r7, 4d MULI64 r8, r9, 4d
FMUL32 r10, r4, r5 FMUL32 r12, r5, r7
FSUB32 r11, r2, r8 FSUB32 r1, r2, r10
ADD64 r9, r3, r6 ADD64 r11, r4, r8
FMUL32 r2, r11, r10 FMUL32 r4, r1, r12
LD r12, r9, 0a, 4h LD r2, r11, 0a, 4h
FSUB32 r5, r12, r2 FSUB32 r7, r2, r4
FMUL32 r7, r5, r11 FMUL32 r9, r7, r1
FADD32 r1, r4, r7 FADD32 r1, r5, r9
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 1303 code size: 1303
ret: 826 ret: 826

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -14,13 +14,13 @@ main:
ADDI64 r254, r254, 56d ADDI64 r254, r254, 56d
JALA r0, r31, 0a JALA r0, r31, 0a
pass: pass:
LD r4, r2, 8a, 8h LD r6, r2, 8a, 8h
MULI64 r7, r4, 8d MULI64 r9, r6, 8d
LD r5, r2, 0a, 8h LD r7, r2, 0a, 8h
ADD64 r10, r7, r2 ADD64 r12, r9, r2
ADD64 r9, r4, r5 ADD64 r11, r6, r7
LD r1, r10, 0a, 8h LD r3, r12, 0a, 8h
ADD64 r1, r1, r9 ADD64 r1, r3, r11
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 231 code size: 231
ret: 8 ret: 8

View file

@ -1,6 +1,6 @@
main: main:
LRA r1, r0, :SIN_TABLE LRA r3, r0, :SIN_TABLE
LD r1, r1, 80a, 8h LD r1, r3, 80a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 767 code size: 767
ret: 1736 ret: 1736

View file

@ -2,12 +2,11 @@ main:
LI64 r1, 1d LI64 r1, 1d
JNE r2, r1, :0 JNE r2, r1, :0
JMP :1 JMP :1
0: LI64 r7, 0d 0: JNE r2, r0, :2
JNE r2, r7, :2
LI64 r1, 2d LI64 r1, 2d
JMP :1 JMP :1
2: LI64 r1, 3d 2: LI64 r1, 3d
1: JALA r0, r31, 0a 1: JALA r0, r31, 0a
code size: 79 code size: 69
ret: 2 ret: 2
status: Ok(()) status: Ok(())

View file

@ -11,16 +11,16 @@ main:
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
str_len: str_len:
LI64 r3, 0d CP r5, r0
CP r1, r3 CP r1, r5
2: LD r7, r2, 0a, 1h 2: LD r9, r2, 0a, 1h
ANDI r9, r7, 255d ANDI r11, r9, 255d
JNE r9, r3, :0 JNE r11, r5, :0
JMP :1 JMP :1
0: ADDI64 r2, r2, 1d 0: ADDI64 r2, r2, 1d
ADDI64 r1, r1, 1d ADDI64 r1, r1, 1d
JMP :2 JMP :2
1: JALA r0, r31, 0a 1: JALA r0, r31, 0a
code size: 205 code size: 198
ret: 16 ret: 16
status: Ok(()) status: Ok(())

View file

@ -4,10 +4,10 @@ main:
ADDI64 r254, r254, -8d ADDI64 r254, r254, -8d
ST r31, r254, 0a, 8h ST r31, r254, 0a, 8h
JAL r31, r0, :foo JAL r31, r0, :foo
LI64 r1, 0d CP r1, r0
LD r31, r254, 0a, 8h LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d ADDI64 r254, r254, 8d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 95 code size: 88
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
main: main:
LRA r1, r0, :a LRA r3, r0, :a
LD r1, r1, 0a, 8h LD r1, r3, 0a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 47 code size: 47
ret: 50 ret: 50

View file

@ -1,6 +1,6 @@
main: main:
LRA r1, r0, :a LRA r3, r0, :a
LD r1, r1, 0a, 8h LD r1, r3, 0a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 47 code size: 47
ret: 50 ret: 50

View file

@ -1,11 +1,11 @@
cond: cond:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h ST r31, r254, 0a, 24h
JAL r31, r0, :cond JAL r31, r0, :cond
LI64 r32, 0d CP r32, r0
CP r33, r32 CP r33, r32
JNE r1, r33, :0 JNE r1, r33, :0
CP r32, r33 CP r32, r33
@ -15,6 +15,6 @@ main:
1: LD r31, r254, 0a, 24h 1: LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 134 code size: 120
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,29 +1,28 @@
main: main:
ADDI64 r254, r254, -12d ADDI64 r254, r254, -12d
LI64 r1, 0d LI8 r3, 255b
LI8 r2, 255b ST r3, r254, 0a, 1h
ST r2, r254, 0a, 1h ST r0, r254, 1a, 1h
LI8 r5, 0b ST r0, r254, 2a, 1h
ST r5, r254, 1a, 1h ST r3, r254, 3a, 1h
ST r5, r254, 2a, 1h ST r0, r254, 4a, 4h
ST r2, r254, 3a, 1h LD r4, r254, 4a, 4h
LI32 r10, 0w LI32 r11, 2w
ST r10, r254, 4a, 4h ST r11, r254, 8a, 4h
LD r8, r254, 4a, 4h LD r2, r254, 8a, 4h
LI32 r2, 2w LI64 r5, 2d
ST r2, r254, 8a, 4h ANDI r6, r2, 4294967295d
LD r5, r254, 8a, 4h JEQ r6, r5, :0
LI64 r9, 2d CP r1, r0
ANDI r10, r5, 4294967295d
JEQ r10, r9, :0
JMP :1 JMP :1
0: ANDI r2, r8, 4294967295d 0: CP r1, r0
JEQ r2, r1, :2 ANDI r10, r4, 4294967295d
JEQ r10, r1, :2
LI64 r1, 64d LI64 r1, 64d
JMP :1 JMP :1
2: LI64 r1, 512d 2: LI64 r1, 512d
1: ADDI64 r254, r254, 12d 1: ADDI64 r254, r254, 12d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 245 code size: 232
ret: 512 ret: 512
status: Ok(()) status: Ok(())

View file

@ -1,20 +1,20 @@
main: main:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
LI64 r1, 10d LI64 r3, 10d
ADDI64 r4, r254, 0d ADDI64 r4, r254, 0d
ST r1, r254, 0a, 8h ST r3, r254, 0a, 8h
LI64 r7, 20d LI64 r9, 20d
ST r7, r254, 8a, 8h ST r9, r254, 8a, 8h
LI64 r6, 6d LI64 r6, 6d
LI64 r5, 5d LI64 r5, 5d
LI64 r2, 1d LI64 r2, 1d
CP r3, r4 CP r3, r4
LD r3, r3, 0a, 16h LD r3, r3, 0a, 16h
ECA ECA
LI64 r1, 0d CP r1, r0
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
ev: Ecall ev: Ecall
code size: 155 code size: 148
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,16 +1,16 @@
continue_and_state_change: continue_and_state_change:
LI64 r7, 3d LI64 r9, 3d
LI64 r8, 4d LI64 r10, 4d
LI64 r9, 2d LI64 r11, 2d
LI64 r10, 10d LI64 r12, 10d
6: JLTU r2, r10, :0 6: JLTU r2, r12, :0
CP r1, r2 CP r1, r2
JMP :1 JMP :1
0: JNE r2, r9, :2 0: JNE r2, r11, :2
CP r2, r8 CP r2, r10
JMP :3 JMP :3
2: JNE r2, r7, :4 2: JNE r2, r9, :4
LI64 r1, 0d CP r1, r0
1: JMP :5 1: JMP :5
4: ADDI64 r2, r2, 1d 4: ADDI64 r2, r2, 1d
3: JMP :6 3: JMP :6
@ -19,7 +19,7 @@ infinite_loop:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h ST r31, r254, 0a, 24h
LI64 r32, 1d LI64 r32, 1d
LI64 r33, 0d CP r33, r0
CP r1, r33 CP r1, r33
1: JNE r1, r32, :0 1: JNE r1, r32, :0
JMP :0 JMP :0
@ -30,76 +30,74 @@ infinite_loop:
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -64d ADDI64 r254, r254, -48d
ST r31, r254, 0a, 64h ST r31, r254, 0a, 48h
LI64 r32, 0d CP r2, r0
CP r2, r32
JAL r31, r0, :multiple_breaks JAL r31, r0, :multiple_breaks
CP r33, r1 CP r32, r1
LI64 r1, 3d LI64 r1, 3d
JEQ r33, r1, :0 JEQ r32, r1, :0
LI64 r1, 1d LI64 r1, 1d
JMP :1 JMP :1
0: CP r34, r1 0: CP r33, r1
LI64 r35, 4d LI64 r34, 4d
CP r2, r35 CP r2, r34
JAL r31, r0, :multiple_breaks JAL r31, r0, :multiple_breaks
CP r36, r35 CP r35, r34
LI64 r37, 10d LI64 r36, 10d
JEQ r1, r37, :2 JEQ r1, r36, :2
LI64 r1, 2d LI64 r1, 2d
JMP :1 JMP :1
2: CP r2, r32 2: CP r2, r0
JAL r31, r0, :state_change_in_break JAL r31, r0, :state_change_in_break
JEQ r1, r32, :3 JEQ r1, r0, :3
CP r1, r34 CP r1, r33
JMP :1 JMP :1
3: CP r2, r36 3: CP r2, r35
JAL r31, r0, :state_change_in_break JAL r31, r0, :state_change_in_break
JEQ r1, r37, :4 JEQ r1, r36, :4
CP r1, r36 CP r1, r35
JMP :1 JMP :1
4: CP r2, r37 4: CP r2, r36
JAL r31, r0, :continue_and_state_change JAL r31, r0, :continue_and_state_change
JEQ r1, r37, :5 JEQ r1, r36, :5
LI64 r1, 5d LI64 r1, 5d
JMP :1 JMP :1
5: CP r2, r34 5: CP r2, r33
JAL r31, r0, :continue_and_state_change JAL r31, r0, :continue_and_state_change
JEQ r1, r32, :6 JEQ r1, r0, :6
LI64 r1, 6d LI64 r1, 6d
JMP :1 JMP :1
6: CP r38, r32 6: JAL r31, r0, :infinite_loop
JAL r31, r0, :infinite_loop CP r1, r0
CP r1, r38 1: LD r31, r254, 0a, 48h
1: LD r31, r254, 0a, 64h ADDI64 r254, r254, 48d
ADDI64 r254, r254, 64d
JALA r0, r31, 0a JALA r0, r31, 0a
multiple_breaks: multiple_breaks:
LI64 r6, 3d LI64 r8, 3d
LI64 r5, 10d LI64 r7, 10d
4: JLTU r2, r5, :0 4: JLTU r2, r7, :0
CP r1, r2 CP r1, r2
JMP :1 JMP :1
0: ADDI64 r1, r2, 1d 0: ADDI64 r1, r2, 1d
JNE r1, r6, :2 JNE r1, r8, :2
1: JMP :3 1: JMP :3
2: CP r2, r1 2: CP r2, r1
JMP :4 JMP :4
3: JALA r0, r31, 0a 3: JALA r0, r31, 0a
state_change_in_break: state_change_in_break:
LI64 r5, 3d LI64 r7, 3d
LI64 r6, 10d LI64 r8, 10d
4: JLTU r2, r6, :0 4: JLTU r2, r8, :0
CP r1, r2 CP r1, r2
JMP :1 JMP :1
0: JNE r2, r5, :2 0: JNE r2, r7, :2
LI64 r1, 0d CP r1, r0
1: JMP :3 1: JMP :3
2: ADDI64 r2, r2, 1d 2: ADDI64 r2, r2, 1d
JMP :4 JMP :4
3: JALA r0, r31, 0a 3: JALA r0, r31, 0a
timed out timed out
code size: 668 code size: 634
ret: 10 ret: 10
status: Ok(()) status: Ok(())

View file

@ -9,7 +9,7 @@ main:
ADDI64 r254, r254, -64d ADDI64 r254, r254, -64d
ST r31, r254, 0a, 64h ST r31, r254, 0a, 64h
JAL r31, r0, :check_platform JAL r31, r0, :check_platform
LI64 r32, 0d CP r32, r0
LI64 r33, 30d LI64 r33, 30d
LI64 r34, 100d LI64 r34, 100d
CP r35, r32 CP r35, r32
@ -42,12 +42,12 @@ main:
ADDI64 r254, r254, 64d ADDI64 r254, r254, 64d
JALA r0, r31, 0a JALA r0, r31, 0a
set_pixel: set_pixel:
MUL64 r7, r3, r4 MUL64 r9, r3, r4
ADD64 r1, r7, r2 ADD64 r1, r9, r2
JALA r0, r31, 0a JALA r0, r31, 0a
x86_fb_ptr: x86_fb_ptr:
LI64 r1, 100d LI64 r1, 100d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 330 code size: 323
ret: 3000 ret: 3000
status: Ok(()) status: Ok(())

View file

@ -8,28 +8,26 @@ main:
opaque: opaque:
JALA r0, r31, 0a JALA r0, r31, 0a
process: process:
ADDI64 r254, r254, -64d ADDI64 r254, r254, -48d
ST r31, r254, 16a, 48h ST r31, r254, 16a, 32h
LI64 r32, 0d LI64 r32, 1000d
LI64 r33, 1000d ADDI64 r33, r254, 0d
ADDI64 r34, r254, 0d ST r0, r254, 0a, 1h
LI8 r35, 0b 4: JGTU r32, r0, :0
ST r35, r254, 0a, 1h
4: JGTU r33, r32, :0
JMP :1 JMP :1
0: CP r2, r34 0: CP r2, r33
JAL r31, r0, :opaque JAL r31, r0, :opaque
LD r36, r254, 0a, 1h LD r34, r254, 0a, 1h
ANDI r36, r36, 255d ANDI r34, r34, 255d
ANDI r35, r35, 255d ANDI r0, r0, 255d
JEQ r36, r35, :2 JEQ r34, r0, :2
JMP :3 JMP :3
2: ADDI64 r33, r33, -1d 2: ADDI64 r32, r32, -1d
1: JMP :4 1: JMP :4
3: LD r31, r254, 16a, 48h 3: LD r31, r254, 16a, 32h
ADDI64 r254, r254, 64d ADDI64 r254, r254, 48d
JALA r0, r31, 0a JALA r0, r31, 0a
timed out timed out
code size: 272 code size: 259
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -14,12 +14,12 @@ deinit:
ADDI64 r254, r254, 32d ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
free: free:
CP r10, r2 CP r11, r2
LRA r7, r0, :FREE_SYS_CALL LRA r9, r0, :FREE_SYS_CALL
LD r2, r7, 0a, 8h LD r2, r9, 0a, 8h
CP r5, r4 CP r5, r4
CP r4, r3 CP r4, r3
CP r3, r10 CP r3, r11
ECA ECA
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
@ -40,86 +40,83 @@ main:
ADDI64 r254, r254, 56d ADDI64 r254, r254, 56d
JALA r0, r31, 0a JALA r0, r31, 0a
malloc: malloc:
CP r9, r2 CP r10, r2
LRA r5, r0, :MALLOC_SYS_CALL LRA r7, r0, :MALLOC_SYS_CALL
LD r2, r5, 0a, 8h LD r2, r7, 0a, 8h
CP r4, r3 CP r4, r3
CP r3, r9 CP r3, r10
ECA ECA
JALA r0, r31, 0a JALA r0, r31, 0a
new: new:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
LI64 r4, 0d
ADDI64 r5, r254, 0d ADDI64 r5, r254, 0d
ST r4, r254, 0a, 8h ST r0, r254, 0a, 8h
ST r4, r254, 8a, 8h ST r0, r254, 8a, 8h
ST r4, r254, 16a, 8h ST r0, r254, 16a, 8h
BMC r5, r1, 24h BMC r5, r1, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
push: push:
ADDI64 r254, r254, -176d ADDI64 r254, r254, -168d
ST r31, r254, 0a, 176h ST r31, r254, 0a, 168h
CP r32, r3 CP r32, r3
LI64 r33, 1d LI64 r33, 1d
LD r34, r2, 8a, 8h LD r34, r2, 8a, 8h
LD r35, r2, 16a, 8h LD r35, r2, 16a, 8h
CP r36, r2 CP r36, r2
JNE r35, r34, :0 JNE r35, r34, :0
LI64 r37, 0d JNE r35, r0, :1
JNE r35, r37, :1 CP r37, r33
CP r38, r33
JMP :2 JMP :2
1: MULI64 r38, r35, 2d 1: MULI64 r37, r35, 2d
2: LI64 r39, 8d 2: LI64 r38, 8d
MUL64 r2, r38, r39 MUL64 r2, r37, r38
CP r3, r39 CP r3, r38
JAL r31, r0, :malloc JAL r31, r0, :malloc
CP r40, r1 CP r39, r36
CP r41, r36 ST r37, r39, 16a, 8h
ST r38, r41, 16a, 8h JNE r1, r0, :3
LI64 r1, 0d CP r1, r0
CP r42, r40
JNE r42, r1, :3
JMP :4 JMP :4
3: CP r40, r42 3: CP r40, r1
MULI64 r43, r34, 8d CP r1, r0
LD r44, r41, 0a, 8h MULI64 r41, r34, 8d
ADD64 r45, r44, r43 LD r42, r39, 0a, 8h
CP r46, r40 ADD64 r43, r42, r41
9: LD r2, r41, 0a, 8h CP r44, r40
LD r47, r41, 8a, 8h 9: LD r2, r39, 0a, 8h
JNE r45, r44, :5 LD r45, r39, 8a, 8h
JEQ r47, r37, :6 JNE r43, r42, :5
CP r4, r39 JEQ r45, r1, :6
MUL64 r3, r47, r4 CP r4, r38
MUL64 r3, r45, r4
JAL r31, r0, :free JAL r31, r0, :free
CP r1, r40 CP r46, r40
JMP :7 JMP :7
6: CP r1, r40 6: CP r46, r40
7: ST r1, r41, 0a, 8h 7: ST r46, r39, 0a, 8h
JMP :8 JMP :8
5: CP r1, r40 5: CP r4, r38
CP r4, r39 CP r46, r40
ADDI64 r48, r46, 8d ADDI64 r47, r44, 8d
ADDI64 r42, r44, 8d ADDI64 r48, r42, 8d
LD r49, r44, 0a, 8h LD r49, r42, 0a, 8h
ST r49, r46, 0a, 8h ST r49, r44, 0a, 8h
CP r44, r42 CP r42, r48
CP r46, r48 CP r44, r47
JMP :9 JMP :9
0: CP r41, r36 0: CP r39, r36
8: LD r50, r41, 8a, 8h 8: LD r35, r39, 8a, 8h
MULI64 r51, r50, 8d MULI64 r50, r35, 8d
LD r52, r41, 0a, 8h LD r46, r39, 0a, 8h
ADD64 r1, r52, r51 ADD64 r1, r46, r50
CP r3, r32 CP r3, r32
ST r3, r1, 0a, 8h ST r3, r1, 0a, 8h
ADD64 r39, r50, r33 ADD64 r51, r35, r33
ST r39, r41, 8a, 8h ST r51, r39, 8a, 8h
4: LD r31, r254, 0a, 176h 4: LD r31, r254, 0a, 168h
ADDI64 r254, r254, 176d ADDI64 r254, r254, 168d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 929 code size: 899
ret: 69 ret: 69
status: Ok(()) status: Ok(())

View file

@ -1,7 +1,6 @@
clobber: clobber:
LRA r1, r0, :var LRA r3, r0, :var
LI64 r3, 0d ST r0, r3, 0a, 8h
ST r3, r1, 0a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
@ -14,6 +13,6 @@ main:
LD r31, r254, 0a, 24h LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 166 code size: 156
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,23 +1,22 @@
inb: inb:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -32d
ST r31, r254, 0a, 40h ST r31, r254, 0a, 32h
LRA r32, r0, :ports LRA r32, r0, :ports
LD r33, r32, 0a, 1h LD r33, r32, 0a, 1h
ANDI r33, r33, 255d ANDI r33, r33, 255d
JNE r33, r0, :0 JNE r33, r0, :0
JMP :1 JMP :1
0: JAL r31, r0, :inb 0: JAL r31, r0, :inb
LI64 r34, 0d CMPU r34, r1, r0
CMPU r35, r1, r34 CMPUI r34, r34, 0d
CMPUI r35, r35, 0d NOT r34, r34
NOT r35, r35 ST r34, r32, 0a, 1h
ST r35, r32, 0a, 1h 1: LD r31, r254, 0a, 32h
1: LD r31, r254, 0a, 40h ADDI64 r254, r254, 32d
ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 178 code size: 161
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,8 +1,8 @@
main: main:
LRA r2, r0, :complex_global_var LRA r3, r0, :complex_global_var
LD r3, r2, 0a, 8h LD r5, r3, 0a, 8h
ADDI64 r1, r3, 5d ADDI64 r1, r5, 5d
ST r1, r2, 0a, 8h ST r1, r3, 0a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 71 code size: 71
ret: 55 ret: 55

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,20 +1,20 @@
main: main:
ADDI64 r254, r254, -128d ADDI64 r254, r254, -128d
LI8 r6, 69b LI8 r8, 69b
LI64 r5, 128d LI64 r7, 128d
LI64 r7, 0d CP r9, r0
ADDI64 r4, r254, 0d ADDI64 r6, r254, 0d
2: LD r1, r254, 42a, 1h 2: LD r3, r254, 42a, 1h
JLTU r7, r5, :0 JLTU r9, r7, :0
ANDI r1, r1, 255d ANDI r1, r3, 255d
JMP :1 JMP :1
0: ADDI64 r8, r7, 1d 0: ADDI64 r10, r9, 1d
ADD64 r3, r4, r7 ADD64 r5, r6, r9
ST r6, r3, 0a, 1h ST r8, r5, 0a, 1h
CP r7, r8 CP r9, r10
JMP :2 JMP :2
1: ADDI64 r254, r254, 128d 1: ADDI64 r254, r254, 128d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 145 code size: 138
ret: 69 ret: 69
status: Ok(()) status: Ok(())

View file

@ -1,9 +1,9 @@
main: main:
LI64 r2, 0d CP r4, r0
0: ADDI64 r2, r2, 1d 0: ADDI64 r4, r4, 1d
JMP :0 JMP :0
JALA r0, r31, 0a JALA r0, r31, 0a
timed out timed out
code size: 45 code size: 38
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,20 +1,19 @@
main: main:
LI64 r2, 8d LI64 r2, 8d
ECA ECA
LI64 r10, 6d LI64 r11, 6d
LRA r6, r0, :gb LRA r8, r0, :gb
LI64 r9, 0d LD r10, r8, 0a, 8h
LD r11, r6, 0a, 8h CMPU r12, r10, r0
CMPU r12, r11, r9
CMPUI r12, r12, 0d CMPUI r12, r12, 0d
ORI r2, r12, 0d OR r2, r12, r0
ANDI r2, r2, 255d ANDI r2, r2, 255d
JNE r2, r0, :0 JNE r2, r0, :0
CP r7, r10 CP r7, r11
JMP :1 JMP :1
0: LI64 r7, 1d 0: LI64 r7, 1d
1: SUB64 r1, r7, r10 1: SUB64 r1, r7, r11
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 142 code size: 125
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,28 +1,24 @@
main: main:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -8d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 8h
JAL r31, r0, :scalar_values JAL r31, r0, :scalar_values
LI64 r32, 0d JEQ r1, r0, :0
CP r33, r32
JEQ r1, r33, :0
LI64 r1, 1d LI64 r1, 1d
JMP :1 JMP :1
0: JAL r31, r0, :structs 0: JAL r31, r0, :structs
CP r34, r33 JEQ r1, r0, :2
JEQ r1, r34, :2
JAL r31, r0, :structs JAL r31, r0, :structs
JMP :1 JMP :1
2: CP r1, r34 2: CP r1, r0
CP r33, r34 1: LD r31, r254, 0a, 8h
1: LD r31, r254, 0a, 32h ADDI64 r254, r254, 8d
ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
scalar_values: scalar_values:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
structs: structs:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 182 code size: 149
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,32 +1,30 @@
main: main:
ADDI64 r254, r254, -106d ADDI64 r254, r254, -90d
ST r31, r254, 58a, 48h ST r31, r254, 58a, 32h
ADDI64 r32, r254, 33d ADDI64 r32, r254, 33d
ADDI64 r2, r254, 34d ADDI64 r2, r254, 34d
ADDI64 r6, r254, 1d ADDI64 r6, r254, 1d
LI64 r33, 0d
ADDI64 r4, r254, 17d ADDI64 r4, r254, 17d
ST r32, r254, 34a, 8h ST r32, r254, 34a, 8h
LI64 r34, 100d LI64 r33, 100d
ADDI64 r7, r254, 0d ADDI64 r7, r254, 0d
LI8 r35, 1b LI8 r34, 1b
ST r33, r254, 1a, 8h ST r0, r254, 1a, 8h
ST r33, r254, 17a, 8h ST r0, r254, 17a, 8h
ST r34, r254, 42a, 8h ST r33, r254, 42a, 8h
LI8 r36, 0b ST r34, r254, 0a, 1h
ST r35, r254, 0a, 1h ST r0, r254, 9a, 8h
ST r33, r254, 9a, 8h ST r0, r254, 25a, 8h
ST r33, r254, 25a, 8h ST r33, r254, 50a, 8h
ST r34, r254, 50a, 8h ST r0, r254, 33a, 1h
ST r36, r254, 33a, 1h
CP r3, r4 CP r3, r4
CP r5, r6 CP r5, r6
LD r3, r3, 0a, 16h LD r3, r3, 0a, 16h
LD r5, r5, 0a, 16h LD r5, r5, 0a, 16h
LD r7, r7, 0a, 1h LD r7, r7, 0a, 1h
JAL r31, r0, :put_filled_rect JAL r31, r0, :put_filled_rect
LD r31, r254, 58a, 48h LD r31, r254, 58a, 32h
ADDI64 r254, r254, 106d ADDI64 r254, r254, 90d
JALA r0, r31, 0a JALA r0, r31, 0a
put_filled_rect: put_filled_rect:
ADDI64 r254, r254, -212d ADDI64 r254, r254, -212d
@ -38,72 +36,74 @@ put_filled_rect:
ST r7, r254, 75a, 1h ST r7, r254, 75a, 1h
ADDI64 r7, r254, 75d ADDI64 r7, r254, 75d
LI64 r8, 25d LI64 r8, 25d
LI64 r32, 2d LI64 r6, 2d
LI64 r6, 8d LI64 r9, 8d
ADDI64 r33, r254, 25d ADDI64 r32, r254, 25d
ADDI64 r34, r254, 50d ADDI64 r33, r254, 50d
LI8 r35, 5b LI8 r34, 5b
ST r35, r254, 25a, 1h ST r34, r254, 25a, 1h
LD r36, r5, 0a, 8h LD r35, r5, 0a, 8h
ST r36, r254, 26a, 4h ST r35, r254, 26a, 4h
LI64 r37, 1d LI64 r36, 1d
ST r37, r254, 30a, 4h ST r36, r254, 30a, 4h
ST r7, r254, 34a, 8h ST r7, r254, 34a, 8h
ST r35, r254, 50a, 1h ST r34, r254, 50a, 1h
ST r36, r254, 51a, 4h ST r35, r254, 51a, 4h
ST r37, r254, 55a, 4h ST r36, r254, 55a, 4h
ST r7, r254, 59a, 8h ST r7, r254, 59a, 8h
CP r38, r7 CP r37, r7
LD r7, r3, 8a, 8h LD r4, r3, 8a, 8h
LD r39, r5, 8a, 8h LD r38, r5, 8a, 8h
ADD64 r11, r39, r7 ADD64 r1, r38, r4
SUB64 r4, r11, r37 SUB64 r5, r1, r36
LD r40, r2, 8a, 8h LD r39, r2, 8a, 8h
MUL64 r5, r40, r4 MUL64 r7, r39, r5
LD r9, r2, 0a, 8h LD r10, r2, 0a, 8h
ADD64 r10, r9, r5 ADD64 r11, r10, r7
LD r2, r3, 0a, 8h LD r5, r3, 0a, 8h
ADD64 r41, r2, r10 ADD64 r40, r5, r11
MUL64 r3, r40, r7 MUL64 r4, r39, r4
ADD64 r4, r9, r3 ADD64 r7, r10, r4
ADD64 r42, r2, r4 ADD64 r41, r5, r7
3: JGTU r39, r37, :0 3: JGTU r38, r36, :0
JNE r39, r37, :1 JNE r38, r36, :1
ADDI64 r4, r254, 0d ADDI64 r4, r254, 0d
ST r35, r254, 0a, 1h ST r34, r254, 0a, 1h
ST r36, r254, 1a, 4h ST r35, r254, 1a, 4h
ST r37, r254, 5a, 4h ST r36, r254, 5a, 4h
ST r38, r254, 9a, 8h ST r37, r254, 9a, 8h
ST r42, r254, 17a, 8h ST r41, r254, 17a, 8h
CP r2, r6 CP r2, r9
CP r3, r32 CP r3, r6
CP r5, r8 CP r5, r8
ECA ECA
JMP :1 JMP :1
1: JMP :2 1: JMP :2
0: CP r3, r32 0: CP r3, r6
CP r43, r6 CP r42, r9
CP r44, r8 CP r43, r8
ST r42, r254, 67a, 8h ST r41, r254, 67a, 8h
CP r2, r43 CP r44, r3
CP r4, r34 CP r2, r42
CP r5, r44
ECA
ST r41, r254, 42a, 8h
CP r2, r43
CP r3, r32
CP r4, r33 CP r4, r33
CP r5, r44 CP r5, r43
ECA ECA
SUB64 r41, r41, r40 ST r40, r254, 42a, 8h
ADD64 r42, r40, r42 CP r2, r42
SUB64 r39, r39, r32 CP r3, r44
CP r6, r43 CP r4, r32
CP r8, r44 CP r5, r43
ECA
SUB64 r40, r40, r39
ADD64 r41, r39, r41
SUB64 r38, r38, r44
CP r6, r44
CP r8, r43
CP r9, r42
JMP :3 JMP :3
2: LD r32, r254, 108a, 104h 2: LD r32, r254, 108a, 104h
ADDI64 r254, r254, 212d ADDI64 r254, r254, 212d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 917 code size: 910
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,20 +1,19 @@
main: main:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -24d
ST r31, r254, 16a, 16h ST r31, r254, 16a, 8h
ADDI64 r3, r254, 0d ADDI64 r3, r254, 0d
ADDI64 r2, r254, 8d ADDI64 r2, r254, 8d
LI64 r32, 0d ST r0, r254, 0a, 8h
ST r32, r254, 0a, 8h ST r0, r254, 8a, 8h
ST r32, r254, 8a, 8h
LI64 r4, 1024d LI64 r4, 1024d
JAL r31, r0, :set JAL r31, r0, :set
ANDI r1, r1, 4294967295d ANDI r1, r1, 4294967295d
LD r31, r254, 16a, 16h LD r31, r254, 16a, 8h
ADDI64 r254, r254, 32d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
set: set:
CP r1, r4 CP r1, r4
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 167 code size: 157
ret: 1024 ret: 1024
status: Ok(()) status: Ok(())

View file

@ -8,10 +8,10 @@ integer_range:
ECA ECA
CP r2, r32 CP r2, r32
CP r3, r33 CP r3, r33
SUB64 r11, r3, r2 SUB64 r3, r3, r2
ADDI64 r3, r11, 1d ADDI64 r3, r3, 1d
DIRU64 r0, r3, r1, r3 DIRU64 r0, r5, r1, r3
ADD64 r1, r3, r2 ADD64 r1, r5, r2
LD r32, r254, 0a, 16h LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
@ -19,11 +19,11 @@ main:
ADDI64 r254, r254, -8d ADDI64 r254, r254, -8d
ST r31, r254, 0a, 8h ST r31, r254, 0a, 8h
LI64 r3, 1000d LI64 r3, 1000d
LI64 r2, 0d CP r2, r0
JAL r31, r0, :integer_range JAL r31, r0, :integer_range
LD r31, r254, 0a, 8h LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d ADDI64 r254, r254, 8d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 210 code size: 203
ret: 42 ret: 42
status: Ok(()) status: Ok(())

View file

@ -1,16 +1,15 @@
main: main:
ADDI64 r254, r254, -8d ADDI64 r254, r254, -8d
LI64 r3, 0d LI64 r3, 10d
LI64 r2, 10d ST r3, r254, 0a, 8h
ST r2, r254, 0a, 8h
2: LD r1, r254, 0a, 8h 2: LD r1, r254, 0a, 8h
JNE r1, r3, :0 JNE r1, r0, :0
JMP :1 JMP :1
0: ADDI64 r11, r1, -1d 0: ADDI64 r11, r1, -1d
ST r11, r254, 0a, 8h ST r11, r254, 0a, 8h
JMP :2 JMP :2
1: ADDI64 r254, r254, 8d 1: ADDI64 r254, r254, 8d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 126 code size: 116
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,15 +1,14 @@
fib: fib:
LI64 r4, 1d LI64 r6, 1d
LI64 r5, 0d CP r7, r0
CP r1, r5 CP r1, r7
CP r10, r4 CP r12, r6
2: JNE r2, r5, :0 2: JNE r2, r7, :0
JMP :1 JMP :1
0: ADD64 r1, r10, r1 0: ADD64 r3, r12, r1
SUB64 r2, r2, r4 SUB64 r2, r2, r6
CP r3, r1 CP r1, r12
CP r1, r10 CP r12, r3
CP r10, r3
JMP :2 JMP :2
1: JALA r0, r31, 0a 1: JALA r0, r31, 0a
main: main:
@ -20,6 +19,6 @@ main:
LD r31, r254, 0a, 8h LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d ADDI64 r254, r254, 8d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 153 code size: 143
ret: 55 ret: 55
status: Ok(()) status: Ok(())

View file

@ -1,18 +1,17 @@
decide: decide:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
ADDI64 r5, r254, 0d ADDI64 r7, r254, 0d
ST r2, r254, 0a, 8h ST r2, r254, 0a, 8h
LI64 r8, 0d ST r0, r254, 8a, 8h
ST r8, r254, 8a, 8h ST r0, r254, 16a, 8h
ST r8, r254, 16a, 8h BMC r7, r1, 24h
BMC r5, r1, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -112d ADDI64 r254, r254, -112d
ST r31, r254, 72a, 40h ST r31, r254, 72a, 40h
ADDI64 r32, r254, 48d ADDI64 r32, r254, 48d
LI64 r2, 0d CP r2, r0
CP r1, r32 CP r1, r32
JAL r31, r0, :decide JAL r31, r0, :decide
ADDI64 r1, r254, 24d ADDI64 r1, r254, 24d
@ -27,6 +26,6 @@ main:
LD r31, r254, 72a, 40h LD r31, r254, 72a, 40h
ADDI64 r254, r254, 112d ADDI64 r254, r254, 112d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 275 code size: 258
ret: 1 ret: 1
status: Ok(()) status: Ok(())

View file

@ -1,27 +1,26 @@
main: main:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -24d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 24h
JAL r31, r0, :opaque JAL r31, r0, :opaque
CP r32, r1 CP r32, r1
JAL r31, r0, :opaque JAL r31, r0, :opaque
LI64 r33, 0d
CP r1, r32 CP r1, r32
JNE r1, r33, :0 JNE r1, r0, :0
CP r32, r1 CP r32, r1
LI64 r1, 0d CP r1, r0
CP r34, r32 CP r33, r32
JMP :1 JMP :1
0: CP r34, r1 0: CP r33, r1
LD r1, r34, 0a, 8h LD r1, r33, 0a, 8h
1: JEQ r34, r33, :2 1: JEQ r33, r0, :2
LD r1, r34, 0a, 8h LD r1, r33, 0a, 8h
JMP :2 JMP :2
2: LD r31, r254, 0a, 32h 2: LD r31, r254, 0a, 24h
ADDI64 r254, r254, 32d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
opaque: opaque:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 183 code size: 159
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,34 +1,32 @@
main: main:
ADDI64 r254, r254, -38d ADDI64 r254, r254, -30d
ST r31, r254, 6a, 32h ST r31, r254, 6a, 24h
LI8 r32, 0b ADDI64 r32, r254, 0d
ADDI64 r33, r254, 0d
2: JAL r31, r0, :return_fn 2: JAL r31, r0, :return_fn
ST r1, r254, 0a, 6h ST r1, r254, 0a, 6h
LD r34, r254, 0a, 1h LD r33, r254, 0a, 1h
ANDI r34, r34, 255d ANDI r33, r33, 255d
ANDI r32, r32, 255d ANDI r0, r0, 255d
JEQ r34, r32, :0 JEQ r33, r0, :0
LI64 r1, 1d LI64 r1, 1d
JMP :1 JMP :1
0: JMP :2 0: JMP :2
1: LD r31, r254, 6a, 32h 1: LD r31, r254, 6a, 24h
ADDI64 r254, r254, 38d ADDI64 r254, r254, 30d
JALA r0, r31, 0a JALA r0, r31, 0a
return_fn: return_fn:
ADDI64 r254, r254, -6d ADDI64 r254, r254, -6d
LI8 r4, 1b LI8 r5, 1b
ADDI64 r3, r254, 0d ADDI64 r4, r254, 0d
ST r4, r254, 0a, 1h ST r5, r254, 0a, 1h
LI8 r4, 0b ST r0, r254, 1a, 1h
ST r4, r254, 1a, 1h ST r0, r254, 2a, 1h
ST r4, r254, 2a, 1h ST r0, r254, 3a, 1h
ST r4, r254, 3a, 1h ST r0, r254, 4a, 1h
ST r4, r254, 4a, 1h ST r0, r254, 5a, 1h
ST r4, r254, 5a, 1h LD r1, r4, 0a, 6h
LD r1, r3, 0a, 6h
ADDI64 r254, r254, 6d ADDI64 r254, r254, 6d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 302 code size: 296
ret: 1 ret: 1
status: Ok(()) status: Ok(())

View file

@ -1,80 +1,76 @@
foo: foo:
ADDI64 r254, r254, -200d ADDI64 r254, r254, -184d
ST r31, r254, 80a, 120h ST r31, r254, 80a, 104h
ADDI64 r32, r254, 64d ADDI64 r32, r254, 64d
LRA r3, r0, :some_file LRA r3, r0, :some_file
JAL r31, r0, :get JAL r31, r0, :get
ST r1, r254, 64a, 16h ST r1, r254, 64a, 16h
LI8 r33, 0b LD r33, r254, 64a, 1h
LD r34, r254, 64a, 1h
ANDI r34, r34, 255d
ANDI r33, r33, 255d ANDI r33, r33, 255d
JNE r34, r33, :0 ANDI r0, r0, 255d
ADDI64 r35, r254, 48d JNE r33, r0, :0
ST r33, r254, 48a, 1h ADDI64 r34, r254, 48d
LD r1, r35, 0a, 16h ST r0, r254, 48a, 1h
LD r1, r34, 0a, 16h
JMP :1 JMP :1
0: LI8 r36, 1b 0: LI8 r35, 1b
LI64 r37, 4d LI64 r36, 4d
LD r38, r254, 72a, 8h LD r37, r254, 72a, 8h
JNE r38, r37, :2 JNE r37, r36, :2
ADDI64 r39, r254, 32d ADDI64 r38, r254, 32d
ST r36, r254, 32a, 1h ST r35, r254, 32a, 1h
LI64 r40, 2d LI64 r39, 2d
ST r40, r254, 40a, 8h ST r39, r254, 40a, 8h
LD r1, r39, 0a, 16h LD r1, r38, 0a, 16h
JMP :1 JMP :1
2: LRA r41, r0, :MAGIC 2: LRA r40, r0, :MAGIC
LD r42, r41, 0a, 8h LD r41, r40, 0a, 8h
JNE r42, r38, :3 JNE r41, r37, :3
ADDI64 r43, r254, 16d ADDI64 r42, r254, 16d
ST r36, r254, 16a, 1h ST r35, r254, 16a, 1h
LI64 r44, 0d ST r0, r254, 24a, 8h
ST r44, r254, 24a, 8h LD r1, r42, 0a, 16h
JMP :1
3: ADDI64 r43, r254, 0d
ST r0, r254, 0a, 1h
LD r1, r43, 0a, 16h LD r1, r43, 0a, 16h
JMP :1 1: LD r31, r254, 80a, 104h
3: ADDI64 r45, r254, 0d ADDI64 r254, r254, 184d
ST r33, r254, 0a, 1h
LD r1, r45, 0a, 16h
1: LD r31, r254, 80a, 120h
ADDI64 r254, r254, 200d
JALA r0, r31, 0a JALA r0, r31, 0a
get: get:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -32d
LD r3, r3, 0a, 1h LD r5, r3, 0a, 1h
LRA r5, r0, :MAGIC LRA r7, r0, :MAGIC
ANDI r9, r3, 255d ANDI r11, r5, 255d
LD r8, r5, 0a, 8h LD r10, r7, 0a, 8h
JNE r8, r9, :0 JNE r10, r11, :0
LI8 r2, 1b LI8 r4, 1b
ADDI64 r1, r254, 16d ADDI64 r3, r254, 16d
ST r2, r254, 16a, 1h ST r4, r254, 16a, 1h
ST r8, r254, 24a, 8h ST r10, r254, 24a, 8h
LD r1, r1, 0a, 16h LD r1, r3, 0a, 16h
JMP :1 JMP :1
0: ADDI64 r7, r254, 0d 0: ADDI64 r9, r254, 0d
LI8 r9, 0b ST r0, r254, 0a, 1h
ST r9, r254, 0a, 1h LD r1, r9, 0a, 16h
LD r1, r7, 0a, 16h
1: ADDI64 r254, r254, 32d 1: ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -48d ADDI64 r254, r254, -40d
ST r31, r254, 16a, 32h ST r31, r254, 16a, 24h
ADDI64 r32, r254, 0d ADDI64 r32, r254, 0d
JAL r31, r0, :foo JAL r31, r0, :foo
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
LI8 r33, 0b LD r33, r254, 0a, 1h
LD r34, r254, 0a, 1h
ANDI r34, r34, 255d
ANDI r33, r33, 255d ANDI r33, r33, 255d
JNE r34, r33, :0 ANDI r0, r0, 255d
JNE r33, r0, :0
LI64 r1, 100d LI64 r1, 100d
JMP :1 JMP :1
0: LD r1, r254, 8a, 8h 0: LD r1, r254, 8a, 8h
1: LD r31, r254, 16a, 32h 1: LD r31, r254, 16a, 24h
ADDI64 r254, r254, 48d ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 768 code size: 749
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,24 +1,23 @@
get_ptr: get_ptr:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -32d
ST r31, r254, 0a, 40h ST r31, r254, 0a, 32h
JAL r31, r0, :get_ptr JAL r31, r0, :get_ptr
LI64 r32, 0d JNE r1, r0, :0
JNE r1, r32, :0 CP r1, r0
LI64 r1, 0d
JMP :1 JMP :1
0: LI64 r33, 10d 0: LI64 r32, 10d
CP r34, r1 CP r33, r1
2: LD r1, r34, 0a, 8h 2: LD r1, r33, 0a, 8h
JEQ r1, r33, :1 JEQ r1, r32, :1
ADDI64 r35, r1, 1d ADDI64 r34, r1, 1d
ST r35, r34, 0a, 8h ST r34, r33, 0a, 8h
JMP :2 JMP :2
1: LD r31, r254, 0a, 40h 1: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 40d ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 185 code size: 161
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
main: main:
ADDI64 r254, r254, -122d ADDI64 r254, r254, -98d
ST r31, r254, 26a, 96h ST r31, r254, 26a, 72h
JAL r31, r0, :returner_fn JAL r31, r0, :returner_fn
CP r32, r1 CP r32, r1
ADDI64 r1, r254, 2d ADDI64 r1, r254, 2d
@ -8,52 +8,48 @@ main:
ADDI64 r33, r254, 0d ADDI64 r33, r254, 0d
JAL r31, r0, :returner_cn JAL r31, r0, :returner_cn
ST r1, r254, 0a, 2h ST r1, r254, 0a, 2h
LI8 r34, 0b LD r34, r254, 2a, 1h
LI8 r35, 0b
LD r36, r254, 2a, 1h
CP r1, r32 CP r1, r32
CMPU r37, r1, r34 CMPU r35, r1, r0
CMPUI r37, r37, 0d CMPUI r35, r35, 0d
CMPU r38, r36, r35 CMPU r32, r34, r0
CMPUI r32, r32, 0d
LD r36, r254, 0a, 1h
AND r37, r32, r35
CMPU r38, r36, r0
CMPUI r38, r38, 0d CMPUI r38, r38, 0d
LD r39, r254, 0a, 1h AND r39, r38, r37
AND r40, r38, r37 ANDI r39, r39, 255d
CMPU r41, r39, r35 JNE r39, r0, :0
CMPUI r41, r41, 0d CP r1, r0
AND r42, r41, r40
ANDI r42, r42, 255d
JNE r42, r0, :0
LI64 r1, 0d
JMP :1 JMP :1
0: LI64 r1, 1d 0: LI64 r1, 1d
1: LD r31, r254, 26a, 96h 1: LD r31, r254, 26a, 72h
ADDI64 r254, r254, 122d ADDI64 r254, r254, 98d
JALA r0, r31, 0a JALA r0, r31, 0a
returner_bn: returner_bn:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
LI8 r6, 1b LI8 r7, 1b
ADDI64 r5, r254, 0d ADDI64 r6, r254, 0d
ST r6, r254, 0a, 1h ST r7, r254, 0a, 1h
LI64 r6, 0d ST r0, r254, 8a, 8h
ST r6, r254, 8a, 8h ST r0, r254, 16a, 8h
ST r6, r254, 16a, 8h BMC r6, r1, 24h
BMC r5, r1, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
returner_cn: returner_cn:
ADDI64 r254, r254, -2d ADDI64 r254, r254, -2d
LI8 r4, 1b LI8 r5, 1b
ADDI64 r3, r254, 0d ADDI64 r4, r254, 0d
ST r4, r254, 0a, 1h ST r5, r254, 0a, 1h
LI8 r4, 0b ST r0, r254, 1a, 1h
ST r4, r254, 1a, 1h LD r1, r4, 0a, 2h
LD r1, r3, 0a, 2h
ADDI64 r254, r254, 2d ADDI64 r254, r254, 2d
JALA r0, r31, 0a JALA r0, r31, 0a
returner_fn: returner_fn:
LD r1, r254, 0a, 0h LD r3, r254, 0a, 0h
ORI r1, r1, 128d ORI r1, r3, 128d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 480 code size: 454
ret: 1 ret: 1
status: Ok(()) status: Ok(())

View file

@ -2,10 +2,10 @@ decide:
LI8 r1, 1b LI8 r1, 1b
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -232d ADDI64 r254, r254, -224d
ST r31, r254, 80a, 152h ST r31, r254, 80a, 144h
JAL r31, r0, :decide JAL r31, r0, :decide
LI64 r32, 0d CP r32, r0
ADDI64 r2, r254, 72d ADDI64 r2, r254, 72d
CP r33, r2 CP r33, r2
ANDI r1, r1, 255d ANDI r1, r1, 255d
@ -19,23 +19,22 @@ main:
LI64 r1, 9001d LI64 r1, 9001d
JMP :3 JMP :3
2: JAL r31, r0, :decide 2: JAL r31, r0, :decide
LI8 r36, 0b
ANDI r1, r1, 255d ANDI r1, r1, 255d
JNE r1, r0, :4 JNE r1, r0, :4
LI8 r37, 1b LI8 r36, 1b
ST r37, r254, 56a, 1h ST r36, r254, 56a, 1h
LD r37, r34, 0a, 8h LD r37, r34, 0a, 8h
ST r37, r254, 64a, 8h ST r37, r254, 64a, 8h
JMP :5 JMP :5
4: ST r36, r254, 56a, 1h 4: ST r0, r254, 56a, 1h
5: LD r38, r254, 56a, 1h 5: LD r38, r254, 56a, 1h
ANDI r38, r38, 255d ANDI r38, r38, 255d
ANDI r36, r36, 255d ANDI r0, r0, 255d
JEQ r38, r36, :6 JEQ r38, r0, :6
LI64 r1, 42d LI64 r1, 42d
JMP :3 JMP :3
6: JAL r31, r0, :decide 6: JAL r31, r0, :decide
LI32 r39, 0w CP r39, r0
ANDI r1, r1, 255d ANDI r1, r1, 255d
JNE r1, r0, :7 JNE r1, r0, :7
CP r40, r39 CP r40, r39
@ -50,9 +49,8 @@ main:
CP r41, r3 CP r41, r3
JAL r31, r0, :new_foo JAL r31, r0, :new_foo
ST r1, r254, 40a, 16h ST r1, r254, 40a, 16h
LI64 r42, 0d LD r42, r254, 40a, 8h
LD r43, r254, 40a, 8h JNE r42, r0, :10
JNE r43, r42, :10
LI64 r1, 999d LI64 r1, 999d
JMP :3 JMP :3
10: LRA r4, r0, :"foo\0" 10: LRA r4, r0, :"foo\0"
@ -60,7 +58,7 @@ main:
CP r2, r3 CP r2, r3
LD r2, r2, 0a, 16h LD r2, r2, 0a, 16h
JAL r31, r0, :use_foo JAL r31, r0, :use_foo
ADDI64 r44, r254, 0d ADDI64 r43, r254, 0d
JAL r31, r0, :no_foo JAL r31, r0, :no_foo
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
JAL r31, r0, :decide JAL r31, r0, :decide
@ -71,8 +69,8 @@ main:
11: CP r2, r33 11: CP r2, r33
ST r2, r254, 0a, 8h ST r2, r254, 0a, 8h
ST r35, r254, 8a, 8h ST r35, r254, 8a, 8h
12: LD r45, r254, 0a, 8h 12: LD r44, r254, 0a, 8h
JNE r45, r42, :13 JNE r44, r0, :13
LI64 r1, 34d LI64 r1, 34d
JMP :3 JMP :3
13: ADDI64 r1, r254, 16d 13: ADDI64 r1, r254, 16d
@ -81,47 +79,45 @@ main:
ANDI r1, r1, 255d ANDI r1, r1, 255d
JNE r1, r0, :14 JNE r1, r0, :14
JMP :15 JMP :15
14: ST r36, r254, 16a, 1h 14: ST r0, r254, 16a, 1h
15: LD r46, r254, 16a, 1h 15: LD r45, r254, 16a, 1h
ANDI r46, r46, 255d ANDI r45, r45, 255d
ANDI r36, r36, 255d ANDI r0, r0, 255d
JEQ r46, r36, :16 JEQ r45, r0, :16
LI64 r1, 420d LI64 r1, 420d
JMP :3 JMP :3
16: LD r47, r254, 0a, 8h 16: LD r46, r254, 0a, 8h
LD r48, r47, 0a, 8h LD r47, r46, 0a, 8h
ANDI r49, r40, 65535d ANDI r48, r40, 65535d
SUB64 r1, r49, r48 SUB64 r1, r48, r47
3: LD r31, r254, 80a, 152h 3: LD r31, r254, 80a, 144h
ADDI64 r254, r254, 232d ADDI64 r254, r254, 224d
JALA r0, r31, 0a JALA r0, r31, 0a
new_bar: new_bar:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
LI8 r8, 1b LI8 r10, 1b
ADDI64 r7, r254, 0d ADDI64 r9, r254, 0d
ST r8, r254, 0a, 1h ST r10, r254, 0a, 1h
ST r2, r254, 8a, 8h ST r2, r254, 8a, 8h
LI64 r9, 1d LI64 r11, 1d
ST r9, r254, 16a, 8h ST r11, r254, 16a, 8h
BMC r7, r1, 24h BMC r9, r1, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
new_foo: new_foo:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -24d
ADDI64 r3, r254, 0d ADDI64 r5, r254, 0d
ADDI64 r2, r254, 8d ADDI64 r4, r254, 8d
ST r3, r254, 8a, 8h ST r5, r254, 8a, 8h
LI64 r5, 0d ST r0, r254, 16a, 8h
ST r5, r254, 16a, 8h LD r1, r4, 0a, 16h
LD r1, r2, 0a, 16h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
no_foo: no_foo:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
ADDI64 r1, r254, 0d ADDI64 r3, r254, 0d
LI64 r3, 0d ST r0, r254, 0a, 8h
ST r3, r254, 0a, 8h LD r1, r3, 0a, 16h
LD r1, r1, 0a, 16h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
use_foo: use_foo:
@ -130,6 +126,6 @@ use_foo:
ADDI64 r2, r254, 0d ADDI64 r2, r254, 0d
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 1143 code size: 1100
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -2,29 +2,28 @@ inb:
CP r1, r2 CP r1, r2
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -24d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 24h
LI64 r32, 0d LI64 r32, 100d
LI64 r33, 100d 4: CP r2, r32
4: CP r2, r33
JAL r31, r0, :inb JAL r31, r0, :inb
ANDI r34, r1, 2d ANDI r33, r1, 2d
JNE r34, r32, :0 JNE r33, r0, :0
LI64 r2, 96d LI64 r2, 96d
CP r3, r32 CP r3, r0
JAL r31, r0, :outb JAL r31, r0, :outb
3: CP r2, r33 3: CP r2, r32
JAL r31, r0, :inb JAL r31, r0, :inb
JEQ r1, r32, :1 JEQ r1, r0, :1
LI64 r1, 1d LI64 r1, 1d
JMP :2 JMP :2
1: JMP :3 1: JMP :3
0: JMP :4 0: JMP :4
2: LD r31, r254, 0a, 32h 2: LD r31, r254, 0a, 24h
ADDI64 r254, r254, 32d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
outb: outb:
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 198 code size: 188
ret: 1 ret: 1
status: Ok(()) status: Ok(())

View file

@ -1,22 +1,21 @@
main: main:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
ADDI64 r3, r254, 0d ADDI64 r4, r254, 0d
LI64 r6, 0d CP r3, r0
CP r3, r6 CP r4, r0
CP r4, r6 CP r5, r0
CP r5, r6 CP r6, r0
ECA ECA
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
LI8 r8, 0b LD r7, r254, 0a, 1h
LD r9, r254, 0a, 1h ANDI r7, r7, 255d
ANDI r9, r9, 255d ANDI r0, r0, 255d
ANDI r8, r8, 255d JNE r7, r0, :0
JNE r9, r8, :0
UN UN
0: LD r1, r254, 8a, 8h 0: LD r1, r254, 8a, 8h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
unknown ecall: 0 unknown ecall: 0
code size: 142 code size: 132
ret: 0 ret: 0
status: Err(Unreachable) status: Err(Unreachable)

View file

@ -19,12 +19,12 @@ main:
JALA r0, r31, 0a JALA r0, r31, 0a
opaque: opaque:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
LI64 r3, 3d LI64 r5, 3d
ADDI64 r2, r254, 0d ADDI64 r4, r254, 0d
ST r3, r254, 0a, 8h ST r5, r254, 0a, 8h
LI64 r6, 2d LI64 r8, 2d
ST r6, r254, 8a, 8h ST r8, r254, 8a, 8h
LD r1, r2, 0a, 16h LD r1, r4, 0a, 16h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 307 code size: 307

View file

@ -1,6 +1,6 @@
clobber: clobber:
LI64 r3, 4d LI64 r5, 4d
ST r3, r2, 0a, 8h ST r5, r2, 0a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -40d

View file

@ -15,8 +15,8 @@ main:
ADDI64 r254, r254, 32d ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
modify: modify:
LI64 r3, 2d LI64 r5, 2d
ST r3, r2, 0a, 8h ST r5, r2, 0a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 187 code size: 187
ret: 0 ret: 0

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
create_back_buffer: create_back_buffer:
ADDI64 r254, r254, -56d ADDI64 r254, r254, -48d
ST r31, r254, 0a, 56h ST r31, r254, 0a, 48h
LI64 r32, 255d LI64 r32, 255d
JGTS r2, r32, :0 JGTS r2, r32, :0
JAL r31, r0, :request_page JAL r31, r0, :request_page
@ -9,23 +9,22 @@ create_back_buffer:
LI8 r34, 255b LI8 r34, 255b
CP r2, r34 CP r2, r34
JAL r31, r0, :request_page JAL r31, r0, :request_page
LI64 r35, 0d
CP r2, r33 CP r2, r33
SUB64 r36, r2, r32 SUB64 r35, r2, r32
5: JGTS r36, r35, :2 5: JGTS r35, r0, :2
JMP :1 JMP :1
2: CP r37, r1 2: CP r36, r1
JLTS r36, r32, :3 JLTS r35, r32, :3
CP r2, r34 CP r2, r34
JAL r31, r0, :request_page JAL r31, r0, :request_page
JMP :4 JMP :4
3: CP r2, r36 3: CP r2, r35
JAL r31, r0, :request_page JAL r31, r0, :request_page
4: SUB64 r36, r36, r32 4: SUB64 r35, r35, r32
CP r1, r37 CP r1, r36
JMP :5 JMP :5
1: LD r31, r254, 0a, 56h 1: LD r31, r254, 0a, 48h
ADDI64 r254, r254, 56d ADDI64 r254, r254, 48d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -8d ADDI64 r254, r254, -8d
@ -43,6 +42,6 @@ request_page:
LI64 r2, 3d LI64 r2, 3d
ECA ECA
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 331 code size: 321
ret: 42 ret: 42
status: Ok(()) status: Ok(())

View file

@ -19,8 +19,8 @@ main:
ADDI64 r254, r254, 100d ADDI64 r254, r254, 100d
JALA r0, r31, 0a JALA r0, r31, 0a
random_color: random_color:
LRA r1, r0, :white LRA r3, r0, :white
LD r1, r1, 0a, 4h LD r1, r3, 0a, 4h
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 241 code size: 241
ret: 1020 ret: 1020

View file

@ -1,31 +1,30 @@
get_format: get_format:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
LI8 r5, 1b LI8 r7, 1b
ADDI64 r4, r254, 0d ADDI64 r6, r254, 0d
LRA r3, r0, :BMP LRA r5, r0, :BMP
ST r5, r254, 0a, 1h ST r7, r254, 0a, 1h
LD r6, r3, 0a, 8h LD r8, r5, 0a, 8h
ST r6, r254, 8a, 8h ST r8, r254, 8a, 8h
LD r1, r4, 0a, 16h LD r1, r6, 0a, 16h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -48d ADDI64 r254, r254, -40d
ST r31, r254, 16a, 32h ST r31, r254, 16a, 24h
ADDI64 r32, r254, 0d ADDI64 r32, r254, 0d
JAL r31, r0, :get_format JAL r31, r0, :get_format
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
LI8 r33, 0b LD r33, r254, 0a, 1h
LD r34, r254, 0a, 1h
ANDI r34, r34, 255d
ANDI r33, r33, 255d ANDI r33, r33, 255d
JNE r34, r33, :0 ANDI r0, r0, 255d
JNE r33, r0, :0
LI64 r1, 1d LI64 r1, 1d
JMP :1 JMP :1
0: LD r1, r254, 8a, 8h 0: LD r1, r254, 8a, 8h
1: LD r31, r254, 16a, 32h 1: LD r31, r254, 16a, 24h
ADDI64 r254, r254, 48d ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 283 code size: 280
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -14,18 +14,18 @@ main:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -32d
ST r31, r254, 16a, 16h ST r31, r254, 16a, 16h
ADDI64 r32, r254, 0d ADDI64 r32, r254, 0d
LI64 r3, 0d CP r3, r0
JAL r31, r0, :constructor JAL r31, r0, :constructor
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
LD r31, r254, 16a, 16h LD r31, r254, 16a, 16h
ADDI64 r254, r254, 32d ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
opaque: opaque:
LRA r3, r0, :file LRA r5, r0, :file
ADD64 r5, r3, r2 ADD64 r7, r5, r2
LD r7, r5, 0a, 1h LD r9, r7, 0a, 1h
ANDI r1, r7, 255d ANDI r1, r9, 255d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 274 code size: 267
ret: 255 ret: 255
status: Ok(()) status: Ok(())

View file

@ -1,10 +1,10 @@
main: main:
ADDI64 r254, r254, -4d ADDI64 r254, r254, -4d
LRA r2, r0, :white LRA r4, r0, :white
ADDI64 r3, r254, 0d ADDI64 r5, r254, 0d
BMC r2, r3, 4h BMC r4, r5, 4h
LD r6, r254, 3a, 1h LD r8, r254, 3a, 1h
ANDI r1, r6, 255d ANDI r1, r8, 255d
ADDI64 r254, r254, 4d ADDI64 r254, r254, 4d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 92 code size: 92

View file

@ -7,23 +7,23 @@ main:
ADDI64 r254, r254, 8d ADDI64 r254, r254, 8d
JALA r0, r31, 0a JALA r0, r31, 0a
sqrt: sqrt:
LI64 r7, 15d LI64 r9, 15d
LI64 r8, 32768d LI64 r10, 32768d
LI64 r5, 0d CP r7, r0
CP r1, r5 CP r1, r7
3: JNE r8, r5, :0 3: JNE r10, r7, :0
JMP :1 JMP :1
0: SLUI64 r4, r1, 1b 0: SLUI64 r6, r1, 1b
ADDI64 r7, r7, -1d ADDI64 r9, r9, -1d
ADD64 r9, r4, r8 ADD64 r11, r6, r10
SLU64 r9, r9, r7 SLU64 r11, r11, r9
JLTU r2, r9, :2 JLTU r2, r11, :2
ADD64 r1, r8, r1 ADD64 r1, r10, r1
SUB64 r2, r2, r9 SUB64 r2, r2, r11
JMP :2 JMP :2
2: SRUI64 r8, r8, 1b 2: SRUI64 r10, r10, 1b
JMP :3 JMP :3
1: JALA r0, r31, 0a 1: JALA r0, r31, 0a
code size: 188 code size: 181
ret: 14 ret: 14
status: Ok(()) status: Ok(())

View file

@ -4,66 +4,63 @@ do_stuff:
just_read: just_read:
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -120d ADDI64 r254, r254, -104d
ST r31, r254, 48a, 72h ST r31, r254, 48a, 56h
ADDI64 r32, r254, 16d ADDI64 r32, r254, 16d
CP r1, r32 CP r1, r32
JAL r31, r0, :optionala JAL r31, r0, :optionala
CP r2, r32 CP r2, r32
LI64 r33, 0d LD r33, r254, 16a, 8h
LD r34, r254, 16a, 8h JNE r33, r0, :0
JNE r34, r33, :0
LI64 r1, 10d LI64 r1, 10d
JMP :1 JMP :1
0: ST r33, r254, 24a, 8h 0: ST r0, r254, 24a, 8h
JAL r31, r0, :just_read JAL r31, r0, :just_read
LD r2, r254, 24a, 8h LD r2, r254, 24a, 8h
JAL r31, r0, :do_stuff JAL r31, r0, :do_stuff
CP r35, r1 CP r34, r1
ADDI64 r36, r254, 0d ADDI64 r35, r254, 0d
JAL r31, r0, :optional JAL r31, r0, :optional
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
LI8 r37, 0b LD r36, r254, 0a, 1h
LD r38, r254, 0a, 1h ANDI r36, r36, 255d
ANDI r38, r38, 255d ANDI r0, r0, 255d
ANDI r37, r37, 255d JNE r36, r0, :2
JNE r38, r37, :2
LI64 r1, 20d LI64 r1, 20d
JMP :1 JMP :1
2: LI64 r39, 100d 2: LI64 r37, 100d
ST r39, r254, 8a, 8h ST r37, r254, 8a, 8h
LD r2, r254, 8a, 8h LD r2, r254, 8a, 8h
JAL r31, r0, :do_stuff JAL r31, r0, :do_stuff
ADD64 r1, r1, r35 ADD64 r1, r1, r34
1: LD r31, r254, 48a, 72h 1: LD r31, r254, 48a, 56h
ADDI64 r254, r254, 120d ADDI64 r254, r254, 104d
JALA r0, r31, 0a JALA r0, r31, 0a
optional: optional:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
LI8 r4, 1b LI8 r6, 1b
ADDI64 r3, r254, 0d ADDI64 r5, r254, 0d
ST r4, r254, 0a, 1h ST r6, r254, 0a, 1h
LI64 r4, 10d LI64 r6, 10d
ST r4, r254, 8a, 8h ST r6, r254, 8a, 8h
LD r1, r3, 0a, 16h LD r1, r5, 0a, 16h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
optionala: optionala:
ADDI64 r254, r254, -48d ADDI64 r254, r254, -48d
ADDI64 r5, r254, 8d ADDI64 r7, r254, 8d
ADDI64 r4, r254, 16d ADDI64 r6, r254, 16d
ST r5, r254, 16a, 8h ST r7, r254, 16a, 8h
LI64 r9, 1d LI64 r10, 1d
ST r9, r254, 24a, 8h ST r10, r254, 24a, 8h
ADDI64 r12, r254, 0d ADDI64 r2, r254, 0d
ST r12, r254, 32a, 8h ST r2, r254, 32a, 8h
LI64 r11, 0d ST r0, r254, 0a, 8h
ST r11, r254, 0a, 8h ST r0, r254, 8a, 8h
ST r11, r254, 8a, 8h ST r0, r254, 40a, 8h
ST r11, r254, 40a, 8h BMC r6, r1, 32h
BMC r4, r1, 32h
ADDI64 r254, r254, 48d ADDI64 r254, r254, 48d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 603 code size: 580
ret: 100 ret: 100
status: Ok(()) status: Ok(())

View file

@ -1,44 +1,44 @@
main: main:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -40d
LI64 r7, 1d LI64 r9, 1d
LI64 r6, 4d LI64 r8, 4d
LI64 r4, 0d CP r6, r0
ADDI64 r5, r254, 0d ADDI64 r7, r254, 0d
CP r8, r4 CP r10, r6
6: JNE r8, r6, :0 6: JNE r10, r8, :0
LI64 r6, 2d LI64 r8, 2d
ADDI64 r3, r254, 32d ADDI64 r5, r254, 32d
CP r8, r4 CP r10, r6
4: LD r1, r254, 16a, 8h 4: LD r1, r254, 16a, 8h
JNE r8, r7, :1 JNE r10, r9, :1
JMP :2 JMP :2
1: MUL64 r12, r8, r6 1: MUL64 r2, r10, r8
ADD64 r8, r8, r7 ADD64 r10, r10, r9
SUB64 r9, r6, r8 SUB64 r11, r8, r10
MUL64 r9, r9, r6 MUL64 r11, r11, r8
CP r11, r4 CP r1, r6
5: JNE r11, r6, :3 5: JNE r1, r8, :3
JMP :4 JMP :4
3: ADD64 r10, r11, r7 3: ADD64 r12, r1, r9
ADD64 r1, r12, r11 ADD64 r3, r2, r1
ADD64 r2, r9, r11 ADD64 r4, r11, r1
MULI64 r1, r1, 8d MULI64 r3, r3, 8d
MULI64 r11, r2, 8d MULI64 r1, r4, 8d
ADD64 r1, r5, r1 ADD64 r3, r7, r3
ADD64 r11, r5, r11 ADD64 r1, r7, r1
BMC r3, r5, 8h
BMC r1, r3, 8h BMC r1, r3, 8h
BMC r11, r1, 8h BMC r5, r1, 8h
BMC r3, r11, 8h CP r1, r12
CP r11, r10
JMP :5 JMP :5
0: ADD64 r2, r8, r7 0: ADD64 r4, r10, r9
MULI64 r12, r8, 8d MULI64 r2, r10, 8d
ADD64 r3, r5, r12 ADD64 r5, r7, r2
ST r8, r3, 0a, 8h ST r10, r5, 0a, 8h
CP r8, r2 CP r10, r4
JMP :6 JMP :6
2: ADDI64 r254, r254, 40d 2: ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 271 code size: 264
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,10 +1,10 @@
main: main:
ADDI64 r254, r254, -4d ADDI64 r254, r254, -4d
LRA r1, r0, :MAGENTA LRA r3, r0, :MAGENTA
ADDI64 r3, r254, 0d ADDI64 r5, r254, 0d
BMC r1, r3, 4h BMC r3, r5, 4h
LD r6, r254, 2a, 1h LD r8, r254, 2a, 1h
ANDI r1, r6, 255d ANDI r1, r8, 255d
ADDI64 r254, r254, 4d ADDI64 r254, r254, 4d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 92 code size: 92

View file

@ -18,17 +18,16 @@ fib:
ADDI64 r254, r254, 32d ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
fib_iter: fib_iter:
LI64 r4, 1d LI64 r6, 1d
LI64 r5, 0d CP r7, r0
CP r1, r5 CP r1, r7
CP r10, r4 CP r12, r6
2: JNE r2, r5, :0 2: JNE r2, r7, :0
JMP :1 JMP :1
0: ADD64 r1, r10, r1 0: ADD64 r3, r12, r1
SUB64 r2, r2, r4 SUB64 r2, r2, r6
CP r3, r1 CP r1, r12
CP r1, r10 CP r12, r3
CP r10, r3
JMP :2 JMP :2
1: JALA r0, r31, 0a 1: JALA r0, r31, 0a
main: main:
@ -44,6 +43,6 @@ main:
LD r31, r254, 0a, 24h LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 300 code size: 290
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,12 +1,12 @@
foo: foo:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
LI64 r3, 3d LI64 r5, 3d
ADDI64 r2, r254, 0d ADDI64 r4, r254, 0d
ST r3, r254, 0a, 8h ST r5, r254, 0a, 8h
LI32 r6, 2w LI32 r8, 2w
ST r6, r254, 8a, 4h ST r8, r254, 8a, 4h
ST r6, r254, 12a, 4h ST r8, r254, 12a, 4h
LD r1, r2, 0a, 16h LD r1, r4, 0a, 16h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:

View file

@ -16,7 +16,7 @@ main:
CP r2, r34 CP r2, r34
JAL r31, r0, :pass JAL r31, r0, :pass
JMP :1 JMP :1
0: LI64 r1, 0d 0: CP r1, r0
1: LD r31, r254, 32a, 40h 1: LD r31, r254, 32a, 40h
ADDI64 r254, r254, 72d ADDI64 r254, r254, 72d
JALA r0, r31, 0a JALA r0, r31, 0a
@ -30,6 +30,6 @@ odher_pass:
pass: pass:
LD r1, r2, 0a, 8h LD r1, r2, 0a, 8h
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 308 code size: 301
ret: 4 ret: 4
status: Ok(()) status: Ok(())

View file

@ -1,30 +1,30 @@
main: main:
ADDI64 r254, r254, -10240d ADDI64 r254, r254, -10240d
LI64 r7, 1d LI64 r9, 1d
LI8 r8, 64b LI8 r10, 64b
LI64 r6, 1024d LI64 r8, 1024d
LI64 r9, 0d CP r11, r0
ADDI64 r5, r254, 0d ADDI64 r7, r254, 0d
4: JLTU r9, r6, :0 4: JLTU r11, r8, :0
LI64 r6, 10d LI64 r8, 10d
CP r8, r7 CP r10, r9
3: LD r11, r254, 2048a, 1h 3: LD r1, r254, 2048a, 1h
JLTU r8, r6, :1 JLTU r10, r8, :1
ANDI r1, r11, 255d ANDI r1, r1, 255d
JMP :2 JMP :2
1: ADD64 r2, r8, r7 1: ADD64 r4, r10, r9
MULI64 r1, r8, 1024d MULI64 r3, r10, 1024d
ADD64 r3, r5, r1 ADD64 r5, r7, r3
BMC r5, r3, 1024h BMC r7, r5, 1024h
CP r8, r2 CP r10, r4
JMP :3 JMP :3
0: ADD64 r2, r9, r7 0: ADD64 r4, r11, r9
ADD64 r12, r5, r9 ADD64 r2, r7, r11
ST r8, r12, 0a, 1h ST r10, r2, 0a, 1h
CP r9, r2 CP r11, r4
JMP :4 JMP :4
2: ADDI64 r254, r254, 10240d 2: ADDI64 r254, r254, 10240d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 198 code size: 191
ret: 64 ret: 64
status: Ok(()) status: Ok(())

View file

@ -1,10 +1,10 @@
main: main:
ADDI64 r254, r254, -72d ADDI64 r254, r254, -72d
ST r31, r254, 0a, 72h ST r31, r254, 0a, 72h
LI8 r32, 0b CP r32, r0
LI64 r33, 65536d LI64 r33, 65536d
LI8 r34, 1b LI8 r34, 1b
LI64 r35, 0d CP r35, r0
CP r36, r35 CP r36, r35
7: JAL r31, r0, :opaque 7: JAL r31, r0, :opaque
JLTU r36, r1, :0 JLTU r36, r1, :0
@ -30,6 +30,6 @@ opaque:
LI64 r1, 2147483648d LI64 r1, 2147483648d
JALA r0, r31, 0a JALA r0, r31, 0a
timed out timed out
code size: 218 code size: 211
ret: 2147483648 ret: 2147483648
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
main: main:
LI64 r1, 0d CP r1, r0
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 29 code size: 22
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -2,7 +2,7 @@ main:
ADDI64 r254, r254, -56d ADDI64 r254, r254, -56d
ST r31, r254, 16a, 40h ST r31, r254, 16a, 40h
ADDI64 r32, r254, 0d ADDI64 r32, r254, 0d
LI64 r4, 0d CP r4, r0
CP r3, r4 CP r3, r4
JAL r31, r0, :maina JAL r31, r0, :maina
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
@ -14,44 +14,42 @@ main:
ADDI64 r254, r254, 56d ADDI64 r254, r254, 56d
JALA r0, r31, 0a JALA r0, r31, 0a
maina: maina:
ADDI64 r254, r254, -68d ADDI64 r254, r254, -60d
ST r31, r254, 20a, 48h ST r31, r254, 20a, 40h
ADDI64 r32, r254, 16d ADDI64 r32, r254, 16d
JAL r31, r0, :small_struct JAL r31, r0, :small_struct
ST r1, r254, 16a, 4h ST r1, r254, 16a, 4h
LI8 r33, 0b ADDI64 r33, r254, 0d
ADDI64 r34, r254, 0d ST r0, r254, 0a, 1h
ST r33, r254, 0a, 1h ST r0, r254, 1a, 1h
ST r33, r254, 1a, 1h ST r0, r254, 2a, 1h
ST r33, r254, 2a, 1h LI8 r34, 3b
LI8 r35, 3b ST r34, r254, 3a, 1h
ST r35, r254, 3a, 1h LI8 r35, 1b
LI8 r36, 1b ST r35, r254, 4a, 1h
ST r36, r254, 4a, 1h ST r0, r254, 5a, 1h
ST r33, r254, 5a, 1h ST r0, r254, 6a, 1h
ST r33, r254, 6a, 1h ST r0, r254, 7a, 1h
ST r33, r254, 7a, 1h ST r0, r254, 8a, 1h
ST r33, r254, 8a, 1h ST r0, r254, 9a, 1h
ST r33, r254, 9a, 1h ST r0, r254, 10a, 1h
ST r33, r254, 10a, 1h ST r34, r254, 11a, 1h
ST r35, r254, 11a, 1h ST r35, r254, 12a, 1h
ST r36, r254, 12a, 1h ST r0, r254, 13a, 1h
ST r33, r254, 13a, 1h ST r0, r254, 14a, 1h
ST r33, r254, 14a, 1h ST r0, r254, 15a, 1h
ST r33, r254, 15a, 1h LD r1, r33, 0a, 16h
LD r1, r34, 0a, 16h LD r31, r254, 20a, 40h
LD r31, r254, 20a, 48h ADDI64 r254, r254, 60d
ADDI64 r254, r254, 68d
JALA r0, r31, 0a JALA r0, r31, 0a
small_struct: small_struct:
ADDI64 r254, r254, -4d ADDI64 r254, r254, -4d
LI16 r2, 0h
ADDI64 r3, r254, 0d ADDI64 r3, r254, 0d
ST r2, r254, 0a, 2h ST r0, r254, 0a, 2h
ST r2, r254, 2a, 2h ST r0, r254, 2a, 2h
LD r1, r3, 0a, 4h LD r1, r3, 0a, 4h
ADDI64 r254, r254, 4d ADDI64 r254, r254, 4d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 570 code size: 556
ret: 2 ret: 2
status: Ok(()) status: Ok(())

View file

@ -1,29 +1,27 @@
main: main:
ADDI64 r254, r254, -1d ADDI64 r254, r254, -1d
LI64 r7, 0d
LI64 r6, 255d LI64 r6, 255d
LI8 r2, 1b LI8 r1, 1b
LI8 r4, 0b ST r0, r254, 0a, 1h
ST r4, r254, 0a, 1h 2: LD r8, r254, 0a, 1h
2: LD r9, r254, 0a, 1h ANDI r10, r8, 255d
ANDI r11, r9, 255d CMPU r2, r10, r6
CMPU r3, r11, r6 CMPUI r2, r2, 0d
NOT r2, r2
CMPU r3, r10, r0
CMPUI r3, r3, 0d CMPUI r3, r3, 0d
NOT r3, r3 NOT r3, r3
CMPU r5, r11, r7 OR r5, r3, r2
CMPUI r5, r5, 0d ANDI r5, r5, 255d
NOT r5, r5 JNE r5, r0, :0
OR r8, r5, r3
ANDI r8, r8, 255d
JNE r8, r0, :0
JMP :1 JMP :1
0: SUB8 r2, r0, r2 0: SUB8 r1, r0, r1
1: ADD8 r4, r9, r2 1: ADD8 r2, r8, r1
ST r4, r254, 0a, 1h ST r2, r254, 0a, 1h
JMP :2 JMP :2
ADDI64 r254, r254, 1d ADDI64 r254, r254, 1d
JALA r0, r31, 0a JALA r0, r31, 0a
timed out timed out
code size: 191 code size: 178
ret: 0 ret: 1
status: Ok(()) status: Ok(())