mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 05:31:51 +00:00
Minor optimization: when doing eq/ne comparions and RHS is a constant - swap operands, this will allow us to fold imm into comparison.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89574 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ef4e604603
commit
1722f061a3
@ -594,9 +594,17 @@ static SDValue EmitCMP(SDValue &LHS, SDValue &RHS, SDValue &TargetCC,
|
||||
default: llvm_unreachable("Invalid integer condition!");
|
||||
case ISD::SETEQ:
|
||||
TCC = MSP430CC::COND_E; // aka COND_Z
|
||||
// Minor optimization: if RHS is a constant, swap operands, then the
|
||||
// constant can be folded into comparison.
|
||||
if (RHS.getOpcode() == ISD::Constant)
|
||||
std::swap(LHS, RHS);
|
||||
break;
|
||||
case ISD::SETNE:
|
||||
TCC = MSP430CC::COND_NE; // aka COND_NZ
|
||||
// Minor optimization: if RHS is a constant, swap operands, then the
|
||||
// constant can be folded into comparison.
|
||||
if (RHS.getOpcode() == ISD::Constant)
|
||||
std::swap(LHS, RHS);
|
||||
break;
|
||||
case ISD::SETULE:
|
||||
std::swap(LHS, RHS); // FALLTHROUGH
|
||||
|
Loading…
x
Reference in New Issue
Block a user