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

add a few patterns for cmp regarding mem

parent 60a375d1
......@@ -2523,6 +2523,10 @@ impl CodeGenerator for ASMCodeGen {
self.internal_binop_no_def_mem_r("cmp", op1, op2)
fn emit_cmp_r_mem(&mut self, op1: &P<Value>, op2: &P<Value>) {
self.internal_binop_no_def_r_mem("cmp", op1, op2)
fn emit_test_r_r(&mut self, op1: &P<Value>, op2: &P<Value>) {
self.internal_binop_no_def_r_r("test", op1, op2)
......@@ -61,7 +61,8 @@ pub trait CodeGenerator {
// comparison
fn emit_cmp_r_r(&mut self, op1: Reg, op2: Reg);
fn emit_cmp_imm_r(&mut self, op1: i32, op2: Reg);
fn emit_cmp_mem_r(&mut self, op1: Reg, op2: Reg);
fn emit_cmp_mem_r(&mut self, op1: Mem, op2: Reg);
fn emit_cmp_r_mem(&mut self, op1: Reg, op2: Mem);
fn emit_test_r_r(&mut self, op1: Reg, op2: Reg);
fn emit_test_imm_r(&mut self, op1: i32, op2: Reg);
......@@ -5105,6 +5105,20 @@ impl<'a> InstructionSelection {
self.backend.emit_cmp_imm_r(iimm_op2, &reg_op1);
return op;
} else if self.match_ireg(op1) && self.match_mem(op2) {
let reg_op1 = self.emit_ireg(op1, f_content, f_context, vm);
let mem_op2 = self.emit_mem(op2, f_context, vm);
self.backend.emit_cmp_mem_r(&mem_op2, &reg_op1);
return op;
} else if self.match_mem(op1) && self.match_ireg(op2) {
let mem_op1 = self.emit_mem(op1, f_context, vm);
let reg_op2 = self.emit_ireg(op2, f_content, f_context, vm);
self.backend.emit_cmp_r_mem(&mem_op1, &reg_op2);
return op;
} else if self.match_ireg(op1) && self.match_ireg(op2) {
// comparing two iregs (general case)
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