From 2226a47aaab7e200d57dc9cf8820d90a1f95ad94 Mon Sep 17 00:00:00 2001 From: mlokr Date: Mon, 13 May 2024 09:55:09 +0200 Subject: [PATCH] fixing struct regurns --- hblang/src/codegen.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hblang/src/codegen.rs b/hblang/src/codegen.rs index 026ae26..1183ffc 100644 --- a/hblang/src/codegen.rs +++ b/hblang/src/codegen.rs @@ -965,14 +965,14 @@ impl<'a> Codegen<'a> { 16..=u64::MAX => { let (rhs, roff) = self.loc_to_ptr(right.loc); let (lhs, loff) = self.loc_to_ptr(left.loc); - let cp = self.gpa.allocate(); - for offset in (0..size).step_by(8) { - self.code.encode(instrs::ld(cp.0, lhs.0, offset + loff, 8)); - self.code.encode(instrs::st(cp.0, rhs.0, offset + roff, 8)); - } + + self.code.encode(instrs::addi64(rhs.0, rhs.0, roff)); + self.code.encode(instrs::addi64(lhs.0, lhs.0, loff)); + self.code + .encode(instrs::bmc(lhs.0, rhs.0, size.try_into().unwrap())); + self.gpa.free(rhs); self.gpa.free(lhs); - self.gpa.free(cp); } s => unimplemented!("size: {}", s), }