WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit db6a93a3 authored by qinsoon's avatar qinsoon
Browse files

add_u128 works

parent 8a86c453
......@@ -2439,6 +2439,17 @@ impl CodeGenerator for ASMCodeGen {
self.internal_binop_def_r_mem("add", dest, src)
}
// adc
fn emit_adc_r_r (&mut self, dest: Reg, src: Reg) {
self.internal_binop_def_r_r("adc", dest, src)
}
fn emit_adc_r_mem(&mut self, dest: Reg, src: Mem) {
self.internal_binop_def_r_mem("adc", dest, src)
}
fn emit_adc_r_imm(&mut self, dest: Reg, src: i32) {
self.internal_binop_def_r_imm("adc", dest, src)
}
// sub
fn emit_sub_r_imm(&mut self, dest: Reg, src: i32) {
self.internal_binop_def_r_imm("sub", dest, src)
......
......@@ -131,6 +131,11 @@ pub trait CodeGenerator {
fn emit_add_r_r (&mut self, dest: Reg, src: Reg);
fn emit_add_r_mem(&mut self, dest: Reg, src: Mem);
fn emit_add_r_imm(&mut self, dest: Reg, src: i32);
// add with carry
fn emit_adc_r_r (&mut self, dest: Reg, src: Reg);
fn emit_adc_r_mem(&mut self, dest: Reg, src: Mem);
fn emit_adc_r_imm(&mut self, dest: Reg, src: i32);
// sub
fn emit_sub_r_r (&mut self, dest: Reg, src: Reg);
......
......@@ -1384,8 +1384,23 @@ impl <'a> InstructionSelection {
self.backend.emit_mov_r_r(&res_tmp, &reg_op1);
// add op2 res
self.backend.emit_add_r_r(&res_tmp, &reg_op2);
} else {
unimplemented!()
} else if self.match_ireg_ex(&ops[op1]) && self.match_ireg_ex(&ops[op2]){
trace!("emit add-iregex-iregex");
let (op1_l, op1_h) = self.emit_ireg_ex(&ops[op1], f_content, f_context, vm);
let (op2_l, op2_h) = self.emit_ireg_ex(&ops[op2], f_content, f_context, vm);
// make result split
// mov op1 to res
let (res_l, res_h) = self.split_int128(&res_tmp, f_context, vm);
self.backend.emit_mov_r_r(&res_l, &op1_l);
self.backend.emit_mov_r_r(&res_h, &op1_h);
// add res_l op2_l -> res_l
self.backend.emit_add_r_r(&res_l, &op2_l);
// adc res_h op2_h -> res_h
self.backend.emit_adc_r_r(&res_h, &op2_h);
}
},
op::BinOp::Sub => {
......@@ -3082,7 +3097,7 @@ impl <'a> InstructionSelection {
if gpr_ret_count + 1 < x86_64::RETURN_GPRs.len() {
let ret_gpr1 = x86_64::RETURN_GPRs[gpr_ret_count].clone();
let ret_gpr2 = x86_64::RETURN_GPRs[gpr_ret_count].clone();
let ret_gpr2 = x86_64::RETURN_GPRs[gpr_ret_count + 1].clone();
self.backend.emit_mov_r_r(&ret_gpr1, &ret_val1);
self.backend.emit_mov_r_r(&ret_gpr2, &ret_val2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment