Simple preopt: Fold (imm OP x) into (OP_IMM x imm) whenever possible;
This commit is contained in:
@@ -556,6 +556,11 @@ fn simplify(pos: &mut FuncCursor, inst: Inst) {
|
|||||||
simplify(pos, inst);
|
simplify(pos, inst);
|
||||||
} else if let Some(imm) = resolve_imm64_value(&pos.func.dfg, args[0]) {
|
} else if let Some(imm) = resolve_imm64_value(&pos.func.dfg, args[0]) {
|
||||||
let new_opcode = match opcode {
|
let new_opcode = match opcode {
|
||||||
|
Opcode::Iadd => Opcode::IaddImm,
|
||||||
|
Opcode::Imul => Opcode::ImulImm,
|
||||||
|
Opcode::Band => Opcode::BandImm,
|
||||||
|
Opcode::Bor => Opcode::BorImm,
|
||||||
|
Opcode::Bxor => Opcode::BxorImm,
|
||||||
Opcode::Isub => Opcode::IrsubImm,
|
Opcode::Isub => Opcode::IrsubImm,
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user