forked from NUDT-compiler/nudt-compiler-cpp
parent
ee3b42ac40
commit
1993380d4a
File diff suppressed because it is too large
Load Diff
@ -1,26 +0,0 @@
|
||||
--- src/mir/Lowering.cpp
|
||||
+++ src/mir/Lowering.cpp
|
||||
@@ -339,10 +339,19 @@
|
||||
{
|
||||
if (IsIntegerCompareOpcode(bin->GetOpcode()))
|
||||
{
|
||||
int lhs = EmitIntValue(bin->GetLhs(), function, value_vregs,
|
||||
scalar_slots, array_slots, block);
|
||||
- int rhs = EmitIntValue(bin->GetRhs(), function, value_vregs,
|
||||
- scalar_slots, array_slots, block);
|
||||
- block.Append(Opcode::CmpRR,
|
||||
- {Operand::VReg(lhs, VRegClass::Int), Operand::VReg(rhs, VRegClass::Int)});
|
||||
+ int rhs_imm;
|
||||
+ if (TryGetConstantInt(bin->GetRhs(), rhs_imm))
|
||||
+ {
|
||||
+ block.Append(Opcode::CmpImm,
|
||||
+ {Operand::VReg(lhs, VRegClass::Int), Operand::Imm(rhs_imm)});
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ int rhs = EmitIntValue(bin->GetRhs(), function, value_vregs,
|
||||
+ scalar_slots, array_slots, block);
|
||||
+ block.Append(Opcode::CmpRR,
|
||||
+ {Operand::VReg(lhs, VRegClass::Int), Operand::VReg(rhs, VRegClass::Int)});
|
||||
+ }
|
||||
|
||||
Loading…
Reference in new issue