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 a3a362ab authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

Fixed bug in emit_madd_u64

parent d27813e2
......@@ -38,6 +38,11 @@ use std::ops;
use std::collections::HashSet;
use std::sync::RwLock;
macro_rules! trace_emit {
($arg1:tt $($arg:tt)*) => {
trace!(concat!("emit: ", $arg1) $($arg)*)
}
}
struct ASMCode {
name: MuName,
code: Vec<ASMInst>,
......@@ -945,13 +950,8 @@ impl ASMCodeGen {
self.cur().code.len()
}
fn add_asm_block_label(&mut self, code: String, block_name: MuName) {
trace!("emit: [{}]{}", block_name, code);
self.cur_mut().code.push(ASMInst::symbolic(code));
}
fn add_asm_symbolic(&mut self, code: String) {
trace!("emit: {}", code);
trace_emit!("{}", demangle_text(code.clone()));
self.cur_mut().code.push(ASMInst::symbolic(code));
}
......@@ -1180,7 +1180,7 @@ impl ASMCodeGen {
fn internal_simple(&mut self, inst: &str) {
let inst = inst.to_string();
trace!("emit: \t{}", inst);
trace_emit!("\t{}", inst);
let asm = inst;
......@@ -1194,7 +1194,7 @@ impl ASMCodeGen {
fn internal_simple_imm(&mut self, inst: &str, val: u64) {
let inst = inst.to_string();
trace!("emit: \t{} {}", inst, val);
trace_emit!("\t{} {}", inst, val);
let asm = format!("{} #{}", inst, val);
......@@ -1209,7 +1209,7 @@ impl ASMCodeGen {
fn internal_simple_str(&mut self, inst: &str, option: &str) {
let inst = inst.to_string();
let option = option.to_string();
trace!("emit: \t{} {}", inst, option);
trace_emit!("\t{} {}", inst, option);
let asm = format!("{} {}", inst, option);
......@@ -1225,7 +1225,7 @@ impl ASMCodeGen {
fn internal_system(&mut self, inst: &str, option: &str, src: &P<Value>) {
let inst = inst.to_string();
let option = option.to_string();
trace!("emit: \t{} {} {}", inst, option, src);
trace_emit!("\t{} {} {}", inst, option, src);
let (reg1, id1, loc1) = self.prepare_reg(src, inst.len() + 1 + option.len() + 1);
......@@ -1240,7 +1240,7 @@ impl ASMCodeGen {
}
fn internal_branch_op(&mut self, inst: &str, src: &P<Value>, dest_name: MuName) {
trace!("emit: \t{} {}, {}", inst, src, dest_name);
trace_emit!("\t{} {}, {}", inst, src, dest_name);
let (reg1, id1, loc1) = self.prepare_reg(src, inst.len() + 1);
// symbolic label, we dont need to patch it
......@@ -1249,7 +1249,7 @@ impl ASMCodeGen {
}
fn internal_branch_op_imm(&mut self, inst: &str, src1: &P<Value>, src2: u8, dest_name: MuName) {
trace!("emit: \t{} {},{},{}", inst, src1, src2, dest_name);
trace_emit!("\t{} {},{},{}", inst, src1, src2, dest_name);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
// symbolic label, we dont need to patch it
......@@ -1270,7 +1270,7 @@ impl ASMCodeGen {
};
let ext = ext_s.to_string() + "XT" + ext_p;
trace!("emit: \t{} {}, {} {} {} -> {}", inst, src1, src2, ext, shift, dest);
trace_emit!("\t{} {}, {} {} {} -> {}", inst, src1, src2, ext, shift, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
......@@ -1291,7 +1291,7 @@ impl ASMCodeGen {
fn internal_binop_imm(&mut self, inst: &str, dest: &P<Value>, src1: &P<Value>, src2: u64, shift: u8) {
let inst = inst.to_string();
trace!("emit: \t{} {}, {} LSL {} -> {}", inst, src1, src2, shift, dest);
trace_emit!("\t{} {}, {} LSL {} -> {}", inst, src1, src2, shift, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, inst.len() + 1 + reg1.len() + 1);
......@@ -1313,7 +1313,7 @@ impl ASMCodeGen {
// dest <= inst(src1, src2)
fn internal_unop_shift(&mut self, inst: &str, dest: &P<Value>, src: &P<Value>, shift: &str, amount: u8) {
let inst = inst.to_string();
trace!("emit: \t{} {}, {} {} -> {}", inst, src, shift, amount, dest);
trace_emit!("\t{} {}, {} {} -> {}", inst, src, shift, amount, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src, inst.len() + 1 + reg1.len() + 1);
......@@ -1331,7 +1331,7 @@ impl ASMCodeGen {
// dest <= inst(src)
fn internal_unop(&mut self, inst: &str, dest: &P<Value>, src: &P<Value>) {
let inst = inst.to_string();
trace!("emit: \t{} {} -> {}", inst, src, dest);
trace_emit!("\t{} {} -> {}", inst, src, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src, inst.len() + 1 + reg1.len() + 1);
......@@ -1350,7 +1350,7 @@ impl ASMCodeGen {
fn internal_unop_imm(&mut self, inst: &str, dest: &P<Value>, src: u64, shift: u8) {
debug_assert!(shift == 0 || shift == 16 || shift == 32 || shift == 48);
let inst = inst.to_string();
trace!("emit: \t{} {} LSL {} -> {}", inst, src, shift, dest);
trace_emit!("\t{} {} LSL {} -> {}", inst, src, shift, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let asm = if shift == 0 {
......@@ -1371,7 +1371,7 @@ impl ASMCodeGen {
// dest <= inst(src1, src2)
fn internal_binop(&mut self, inst: &str, dest: &P<Value>, src1: &P<Value>, src2: &P<Value>) {
let inst = inst.to_string();
trace!("emit: \t{} {}, {} -> {}", inst, src1, src2, dest);
trace_emit!("\t{} {}, {} -> {}", inst, src1, src2, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, inst.len() + 1 + reg1.len() + 1);
......@@ -1390,7 +1390,7 @@ impl ASMCodeGen {
// dest <= inst(src1, src2)
fn internal_binop_shift(&mut self, inst: &str, dest: &P<Value>, src1: &P<Value>, src2: &P<Value>, shift: &str, amount: u8) {
let inst = inst.to_string();
trace!("emit: \t{} {}, {}, {} {} -> {}", inst, src1, src2, shift, amount, dest);
trace_emit!("\t{} {}, {}, {} {} -> {}", inst, src1, src2, shift, amount, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, inst.len() + 1 + reg1.len() + 1);
......@@ -1409,7 +1409,7 @@ impl ASMCodeGen {
// dest <= inst(src1, src2, src3)
fn internal_ternop(&mut self, inst: &str, dest: &P<Value>, src1: &P<Value>, src2: &P<Value>, src3: &P<Value>) {
let inst = inst.to_string();
trace!("emit: \t{} {}, {}, {} -> {}", inst, src3, src1, src2, dest);
trace_emit!("\t{} {}, {}, {} -> {}", inst, src3, src1, src2, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, inst.len() + 1 + reg1.len() + 1);
......@@ -1428,7 +1428,7 @@ impl ASMCodeGen {
fn internal_ternop_imm(&mut self, inst: &str, dest: &P<Value>, src1: &P<Value>, src2: u64, src3: u64) {
let inst = inst.to_string();
trace!("emit: \t{} {}, {}, {} -> {}", inst, src1, src2, src3, dest);
trace_emit!("\t{} {}, {}, {} -> {}", inst, src1, src2, src3, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, inst.len() + 1 + reg1.len() + 1);
......@@ -1447,7 +1447,7 @@ impl ASMCodeGen {
fn internal_cmpop(&mut self, inst: &str, src1: &P<Value>, src2: &P<Value>)
{
let inst = inst.to_string();
trace!("emit: \t{} {}, {}", inst, src1, src2);
trace_emit!("\t{} {}, {}", inst, src1, src2);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src2, inst.len() + 1 + reg1.len() + 1);
......@@ -1465,7 +1465,7 @@ impl ASMCodeGen {
// dest <= inst(src1, src2)
fn internal_cmpop_shift(&mut self, inst: &str, src1: &P<Value>, src2: &P<Value>, shift: &str, amount: u8) {
let inst = inst.to_string();
trace!("emit: \t{} {},{}, {} {}", inst, src1, src2, shift, amount);
trace_emit!("\t{} {},{}, {} {}", inst, src1, src2, shift, amount);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src2, inst.len() + 1 + reg1.len() + 1);
......@@ -1493,7 +1493,7 @@ impl ASMCodeGen {
};
let ext = ext_s.to_string() + "XT" + ext_p;
trace!("emit: \t{} {}, {} {} {}", inst, src1, src2, ext, shift);
trace_emit!("\t{} {}, {} {} {}", inst, src1, src2, ext, shift);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
......@@ -1512,7 +1512,7 @@ impl ASMCodeGen {
fn internal_cmpop_imm(&mut self, inst: &str, src1: &P<Value>, src2: u64, shift: u8)
{
let inst = inst.to_string();
trace!("emit: \t{} {}, {} LSL {}", inst, src1, src2, shift);
trace_emit!("\t{} {}, {} LSL {}", inst, src1, src2, shift);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
......@@ -1534,7 +1534,7 @@ impl ASMCodeGen {
fn internal_cmpop_f0(&mut self, inst: &str, src1: &P<Value>)
{
let inst = inst.to_string();
trace!("emit: \t{} {}, 0.0", inst, src1);
trace_emit!("\t{} {}, 0.0", inst, src1);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
......@@ -1552,7 +1552,7 @@ impl ASMCodeGen {
fn internal_cond_op(&mut self, inst: &str, dest: &P<Value>, cond: &str) {
let inst = inst.to_string();
let cond = cond.to_string();
trace!("emit: \t{} {} -> {}", inst, cond, dest);
trace_emit!("\t{} {} -> {}", inst, cond, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
......@@ -1570,7 +1570,7 @@ impl ASMCodeGen {
fn internal_cond_unop(&mut self, inst: &str, dest: &P<Value>, src: &P<Value>, cond: &str) {
let inst = inst.to_string();
let cond = cond.to_string();
trace!("emit: \t{} {} {} -> {}", inst, cond, src, dest);
trace_emit!("\t{} {} {} -> {}", inst, cond, src, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src, inst.len() + 1 + reg1.len() + 1);
......@@ -1589,7 +1589,7 @@ impl ASMCodeGen {
fn internal_cond_binop(&mut self, inst: &str, dest: &P<Value>, src1: &P<Value>, src2: &P<Value>, cond: &str) {
let inst = inst.to_string();
let cond = cond.to_string();
trace!("emit: \t{} {}, {}, {} -> {}", inst, cond, src1, src2, dest);
trace_emit!("\t{} {}, {}, {} -> {}", inst, cond, src1, src2, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, inst.len() + 1 + reg1.len() + 1);
......@@ -1610,7 +1610,7 @@ impl ASMCodeGen {
{
let inst = inst.to_string();
let cond = cond.to_string();
trace!("emit: \t{} {}, {}, {}, {}", inst, src1, src2, flags, cond);
trace_emit!("\t{} {}, {}, {}, {}", inst, src1, src2, flags, cond);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src2, inst.len() + 1 + reg1.len() + 1);
......@@ -1630,7 +1630,7 @@ impl ASMCodeGen {
{
let inst = inst.to_string();
let cond = cond.to_string();
trace!("emit: \t{} {}, {}, {}, {}", inst, src1, src2, flags, cond);
trace_emit!("\t{} {}, {}, {}, {}", inst, src1, src2, flags, cond);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
......@@ -1665,7 +1665,7 @@ impl ASMCodeGen {
}
};
trace!("emit: \t{} {} -> {}", inst, src, dest);
trace_emit!("\t{} {} -> {}", inst, src, dest);
let (reg, id, loc) = self.prepare_reg(dest, inst.len() + 1);
let (mem, uses) = self.prepare_mem(src, inst.len() + 1 + reg.len() + 1);
......@@ -1697,10 +1697,9 @@ impl ASMCodeGen {
}
}
// TODO: What to do when src1/src2/stack are the same???
fn internal_load_pair(&mut self, inst: &str, dest1: &P<Value>, dest2: &P<Value>, src: &P<Value>) {
let inst = inst.to_string();
trace!("emit: \t{} {} -> {}, {}", inst, src, dest1, dest2);
trace_emit!("\t{} {} -> {}, {}", inst, src, dest1, dest2);
let (reg1, id1, loc1) = self.prepare_reg(dest1, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(dest2, inst.len() + 1 + reg1.len() + 1);
......@@ -1727,7 +1726,7 @@ impl ASMCodeGen {
_ => panic!("unexpected op size: {}", op_len)
};
trace!("emit: \t{} {} -> {}", inst, src, dest);
trace_emit!("\t{} {} -> {}", inst, src, dest);
let (reg, id1, loc1) = self.prepare_reg(src, inst.len() + 1);
let (mem, mut uses) = self.prepare_mem(dest, inst.len() + 1 + reg.len() + 1);
......@@ -1783,7 +1782,7 @@ impl ASMCodeGen {
_ => panic!("unexpected op size: {}", op_len)
}.to_string();
trace!("emit: \t{}-{} {} -> {},{}", inst, suffix, src, dest, status);
trace_emit!("\t{}-{} {} -> {},{}", inst, suffix, src, dest, status);
let (reg1, id1, loc1) = self.prepare_reg(status, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src, inst.len() + 1 + reg1.len() + 1);
......@@ -1812,7 +1811,7 @@ impl ASMCodeGen {
fn internal_store_pair(&mut self, inst: &str, dest: &P<Value>, src1: &P<Value>, src2: &P<Value>) {
let inst = inst.to_string();
trace!("emit: \t{} {},{} -> {}", inst, src1, src2, dest);
trace_emit!("\t{} {},{} -> {}", inst, src1, src2, dest);
let (reg1, id1, loc1) = self.prepare_reg(src1, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src2, inst.len() + 1 + reg1.len() + 1);
......@@ -1848,7 +1847,7 @@ impl ASMCodeGen {
fn internal_store_pair_exclusive(&mut self, inst: &str, dest: &P<Value>, status: &P<Value>, src1: &P<Value>, src2: &P<Value>) {
let inst = inst.to_string();
trace!("emit: \t{} {},{} -> {},{}", inst, src1, src2, dest, status);
trace_emit!("\t{} {},{} -> {},{}", inst, src1, src2, dest, status);
let (reg1, id1, loc1) = self.prepare_reg(status, inst.len() + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, inst.len() + 1 + reg1.len() + 1);
......@@ -1964,8 +1963,9 @@ impl CodeGenerator for ASMCodeGen {
}
fn start_block(&mut self, block_name: MuName) {
trace_emit!("{}:", block_name.clone());
let label = format!("{}:", mangle_name(block_name.clone()));
self.add_asm_block_label(label, block_name.clone());
self.cur_mut().code.push(ASMInst::symbolic(label));
self.cur_mut().blocks.insert(block_name.clone(), ASMBlock::new());
let start = self.line();
......@@ -2019,7 +2019,7 @@ impl CodeGenerator for ASMCodeGen {
}
fn emit_frame_grow(&mut self) {
trace!("emit: \tframe grow");
trace_emit!("\tSUB SP, SP, #FRAME_SIZE_PLACEHOLDER");
let asm = format!("SUB SP,SP,#{}", FRAME_SIZE_PLACEHOLDER.clone());
let line = self.line();
......@@ -2035,7 +2035,7 @@ impl CodeGenerator for ASMCodeGen {
// Pushes a pair of registers on the givne stack (uses the STP instruction)
fn emit_push_pair(&mut self, src1: &P<Value>, src2: &P<Value>, stack: &P<Value>) {
trace!("emit: \tpush_pair {},{} -> {}[-8,-16]", src1, src2, stack);
trace_emit!("\tpush_pair {}, {} -> {}[-8,-16]", src1, src2, stack);
let (reg1, id1, loc1) = self.prepare_reg(src2, 3 + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, 3 + 1 + reg1.len() + 1);
......@@ -2054,7 +2054,7 @@ impl CodeGenerator for ASMCodeGen {
// TODO: What to do when src1/src2/stack are the same???
fn emit_pop_pair(&mut self, dest1: &P<Value>, dest2: &P<Value>, stack: &P<Value>) {
trace!("emit: \tpop_pair {}[+0,+8] -> {},{}", stack, dest1, dest2);
trace_emit!("\tpop_pair {} [+0,+8] -> {}, {}", stack, dest1, dest2);
let (reg1, id1, loc1) = self.prepare_reg(dest1, 3 + 1);
let (reg2, id2, loc2) = self.prepare_reg(dest2, 3 + 1 + reg1.len() + 1);
......@@ -2071,7 +2071,7 @@ impl CodeGenerator for ASMCodeGen {
}
fn emit_ret(&mut self, src: Reg) {
trace!("emit: \tRET {}", src);
trace_emit!("\tRET {}", src);
let (reg1, id1, loc1) = self.prepare_reg(src, 3 + 1);
let asm = format!("RET {}", reg1);
......@@ -2080,9 +2080,9 @@ impl CodeGenerator for ASMCodeGen {
fn emit_bl(&mut self, callsite: String, func: MuName, pe: Option<MuName>, is_native: bool) -> ValueLocation {
if is_native {
trace!("emit: \tBL /*C*/ {}", func);
trace_emit!("\tBL /*C*/ {}", func);
} else {
trace!("emit: \tBL {}", func);
trace_emit!("\tBL {}", func);
}
let func = if is_native {
......@@ -2102,7 +2102,7 @@ impl CodeGenerator for ASMCodeGen {
}
fn emit_blr(&mut self, callsite: String, func: Reg, pe: Option<MuName>) -> ValueLocation {
trace!("emit: \tBLR {}", func);
trace_emit!("\tBLR {}", func);
let (reg1, id1, loc1) = self.prepare_reg(func, 3 + 1);
let asm = format!("BLR {}", reg1);
......@@ -2118,7 +2118,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_b(&mut self, dest_name: MuName)
{
trace!("emit: \tB {}", dest_name);
trace_emit!("\tB {}", dest_name);
// symbolic label, we dont need to patch it
let asm = format!("B {}", mangle_name(dest_name.clone()));
......@@ -2126,14 +2126,14 @@ impl CodeGenerator for ASMCodeGen {
}
fn emit_b_func(&mut self, func_name: MuName)
{
trace!("emit: \tB {}", func_name);
trace_emit!("\tB {}", func_name);
let asm = format!("B {}", mangle_name(func_name.clone()));
self.add_asm_inst_internal(asm, linked_hashmap!{}, linked_hashmap!{}, false, ASMBranchTarget::Return, None);
}
fn emit_b_cond(&mut self, cond: &str, dest_name: MuName)
{
trace!("emit: \tB.{} {}", cond, dest_name);
trace_emit!("\tB.{} {}", cond, dest_name);
// symbolic label, we dont need to patch it
let asm = format!("B.{} {}", cond, mangle_name(dest_name.clone()));
......@@ -2141,7 +2141,7 @@ impl CodeGenerator for ASMCodeGen {
}
fn emit_br(&mut self, dest_address: Reg)
{
trace!("emit: \tBR {}", dest_address);
trace_emit!("\tBR {}", dest_address);
let (reg1, id1, loc1) = self.prepare_reg(dest_address, 2 + 1);
let asm = format!("BR {}", reg1);
......@@ -2149,7 +2149,7 @@ impl CodeGenerator for ASMCodeGen {
}
fn emit_br_func(&mut self, func_address: Reg)
{
trace!("emit: \tBR {}", func_address);
trace_emit!("\tBR {}", func_address);
let (reg1, id1, loc1) = self.prepare_reg(func_address, 2 + 1);
let asm = format!("BR {}", reg1);
......@@ -2162,7 +2162,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_msr(&mut self, dest: &str, src: Reg) {
let dest = dest.to_string();
trace!("emit: \tMSR {} -> {}", src, dest);
trace_emit!("\tMSR {} -> {}", src, dest);
let (reg1, id1, loc1) = self.prepare_reg(src, 3 + 1 + 4 + 1);
......@@ -2177,7 +2177,7 @@ impl CodeGenerator for ASMCodeGen {
}
fn emit_mrs(&mut self, dest: Reg, src: &str){
let src = src.to_string();
trace!("emit: \tMRS {} -> {}", src, dest);
trace_emit!("\tMRS {} -> {}", src, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, 3 + 1);
......@@ -2255,7 +2255,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_movi(&mut self, dest: &P<Value>, src: u64) { self.internal_unop_imm("MOVI", dest, src as u64, 0) }
fn emit_fmov_imm(&mut self, dest: &P<Value>, src: f32) {
trace!("emit: \tFMOV {} -> {}", src, dest);
trace_emit!("\tFMOV {} -> {}", src, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, 4 + 1);
// GCC complains if the immediate argument has no decimal part (it will treat it as an integer)
......@@ -2428,7 +2428,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_bfc(&mut self, dest: Reg, src1: u8, src2: u8)
{
trace!("emit: \tBFC {}, {} -> {}", src1, src2, dest);
trace_emit!("\tBFC {}, {} -> {}", src1, src2, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, 3 + 1);
......@@ -2444,7 +2444,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_extr(&mut self, dest: Reg, src1: Reg, src2: Reg, src3: u8)
{
trace!("emit: \tEXTR {}, {}, {} -> {}", src1, src2, src3, dest);
trace_emit!("\tEXTR {}, {}, {} -> {}", src1, src2, src3, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, 4 + 1);
let (reg2, id2, loc2) = self.prepare_reg(src1, 4 + 1 + reg1.len() + 1);
......@@ -2520,7 +2520,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_sys(&mut self, imm1: u8, cn: u8, cm: u8, imm2: u8, src: Reg)
{
trace!("emit: \tSYS {}, C{}, C{}, {}, {}", imm1, cn, cm, imm2, src);
trace_emit!("\tSYS {}, C{}, C{}, {}, {}", imm1, cn, cm, imm2, src);
let start = format!("SYS #{},C{},C{},#{},", imm1, cn, cm, imm2);
let (reg1, id1, loc1) = self.prepare_reg(src, start.len());
......@@ -2537,7 +2537,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_sysl(&mut self, dest: Reg, imm1: u8, cn: u8, cm: u8, imm2: u8)
{
trace!("emit: \tSYSL {}, C{}, C{}, {} -> {}", imm1, cn, cm, imm2, dest);
trace_emit!("\tSYSL {}, C{}, C{}, {} -> {}", imm1, cn, cm, imm2, dest);
let (reg1, id1, loc1) = self.prepare_reg(dest, 4 + 1);
......
......@@ -1748,7 +1748,7 @@ fn emit_madd_u64(backend: &mut CodeGenerator, dest: &P<Value>, src1: &P<Value>,
let shift = log2(val as u64) as u8;
// dest = src1 << log2(val) + src2
if shift <= 4 {
backend.emit_add_ext(&dest, &dest, &src2, false, shift);
backend.emit_add_ext(&dest, &src2, &src1, false, shift);
} else {
backend.emit_lsl_imm(&dest, &src1, shift);
backend.emit_add(&dest, &dest, &src2);
......@@ -2005,10 +2005,8 @@ fn emit_fpreg_value(backend: &mut CodeGenerator, pv: &P<Value>, f_context: &mut
}
fn split_int128(int128: &P<Value>, f_context: &mut FunctionContext, vm: &VM) -> (P<Value>, P<Value>) {
trace!("ISAAC split_int128({})...", int128);
if f_context.get_value(int128.id()).unwrap().has_split() {
let vec = f_context.get_value(int128.id()).unwrap().get_split().as_ref().unwrap();
trace!("ISAAC <- get value ({}, {})", &vec[0], &vec[1]);
(vec[0].clone(), vec[1].clone())
} else {
let arg_l = make_temporary(f_context, UINT64_TYPE.clone(), vm);
......@@ -2022,7 +2020,6 @@ fn split_int128(int128: &P<Value>, f_context: &mut FunctionContext, vm: &VM) ->
}
pub fn emit_ireg_ex_value(backend: &mut CodeGenerator, pv: &P<Value>, f_context: &mut FunctionContext, vm: &VM) -> (P<Value>, P<Value>) {
trace!("ISAAC emit_ireg_ex_value({})", pv);
match pv.v {
Value_::SSAVar(_) => {
split_int128(pv, f_context, vm)
......
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