Add Sub64 opcode

This commit is contained in:
Tillmann Karras 2016-08-06 06:09:47 +01:00
parent b9f4f1ed0f
commit 846d07d7b5
4 changed files with 16 additions and 0 deletions

View file

@ -845,6 +845,16 @@ void EmitX64::EmitSubWithCarry(IR::Block& block, IR::Inst* inst) {
}
}
void EmitX64::EmitSub64(IR::Block& block, IR::Inst* inst) {
IR::Value a = inst->GetArg(0);
IR::Value b = inst->GetArg(1);
X64Reg result = reg_alloc.UseDefRegister(a, inst, any_gpr);
OpArg op_arg = reg_alloc.UseOpArg(b, any_gpr);
code->SUB(64, R(result), op_arg);
}
void EmitX64::EmitMul(IR::Block&, IR::Inst* inst) {
IR::Value a = inst->GetArg(0);
IR::Value b = inst->GetArg(1);

View file

@ -210,6 +210,10 @@ IR::Value IREmitter::Sub(const IR::Value& a, const IR::Value& b) {
return Inst(IR::Opcode::SubWithCarry, {a, b, Imm1(1)});
}
IR::Value IREmitter::Sub64(const IR::Value& a, const IR::Value& b) {
return Inst(IR::Opcode::Sub64, {a, b});
}
IR::Value IREmitter::Mul(const IR::Value& a, const IR::Value& b) {
return Inst(IR::Opcode::Mul, {a, b});
}

View file

@ -75,6 +75,7 @@ public:
IR::Value Add64(const IR::Value& a, const IR::Value& b);
ResultAndCarryAndOverflow SubWithCarry(const IR::Value& a, const IR::Value& b, const IR::Value& carry_in);
IR::Value Sub(const IR::Value& a, const IR::Value& b);
IR::Value Sub64(const IR::Value& a, const IR::Value& b);
IR::Value Mul(const IR::Value& a, const IR::Value& b);
IR::Value Mul64(const IR::Value& a, const IR::Value& b);
IR::Value And(const IR::Value& a, const IR::Value& b);

View file

@ -42,6 +42,7 @@ OPCODE(RotateRightExtended, T::U32, T::U32, T::U1
OPCODE(AddWithCarry, T::U32, T::U32, T::U32, T::U1 )
OPCODE(SubWithCarry, T::U32, T::U32, T::U32, T::U1 )
OPCODE(Add64, T::U64, T::U64, T::U64 )
OPCODE(Sub64, T::U64, T::U64, T::U64 )
OPCODE(Mul, T::U32, T::U32, T::U32 )
OPCODE(Mul64, T::U64, T::U64, T::U64 )
OPCODE(And, T::U32, T::U32, T::U32 )