Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions llvm/lib/Target/ARM/Utils/ARMBaseInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,9 @@ enum CondCodes { // Meaning (integer) Meaning (floating-point)
};

inline static CondCodes getOppositeCondition(CondCodes CC) {
switch (CC) {
default: llvm_unreachable("Unknown condition code");
case EQ: return NE;
case NE: return EQ;
case HS: return LO;
case LO: return HS;
case MI: return PL;
case PL: return MI;
case VS: return VC;
case VC: return VS;
case HI: return LS;
case LS: return HI;
case GE: return LT;
case LT: return GE;
case GT: return LE;
case LE: return GT;
}
// To reverse a condition it's necessary to only invert the low bit:

return static_cast<CondCodes>(static_cast<unsigned>(CC) ^ 0x1);
}

/// getSwappedCondition - assume the flags are set by MI(a,b), return
Expand Down
45 changes: 0 additions & 45 deletions llvm/lib/Target/X86/X86InstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3297,51 +3297,6 @@ unsigned X86::getNonNDVariant(unsigned Opc) {
return getNewOpcFromTable(X86ND2NonNDTable, Opc);
}

/// Return the inverse of the specified condition,
/// e.g. turning COND_E to COND_NE.
X86::CondCode X86::GetOppositeBranchCondition(X86::CondCode CC) {
switch (CC) {
default:
llvm_unreachable("Illegal condition code!");
case X86::COND_E:
return X86::COND_NE;
case X86::COND_NE:
return X86::COND_E;
case X86::COND_L:
return X86::COND_GE;
case X86::COND_LE:
return X86::COND_G;
case X86::COND_G:
return X86::COND_LE;
case X86::COND_GE:
return X86::COND_L;
case X86::COND_B:
return X86::COND_AE;
case X86::COND_BE:
return X86::COND_A;
case X86::COND_A:
return X86::COND_BE;
case X86::COND_AE:
return X86::COND_B;
case X86::COND_S:
return X86::COND_NS;
case X86::COND_NS:
return X86::COND_S;
case X86::COND_P:
return X86::COND_NP;
case X86::COND_NP:
return X86::COND_P;
case X86::COND_O:
return X86::COND_NO;
case X86::COND_NO:
return X86::COND_O;
case X86::COND_NE_OR_P:
return X86::COND_E_AND_NP;
case X86::COND_E_AND_NP:
return X86::COND_NE_OR_P;
}
}

/// Assuming the flags are set by MI(a,b), return the condition code if we
/// modify the instructions such that flags are set by MI(b,a).
static X86::CondCode getSwappedCondition(X86::CondCode CC) {
Expand Down
6 changes: 5 additions & 1 deletion llvm/lib/Target/X86/X86InstrInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ unsigned getNonNDVariant(unsigned Opc);

/// GetOppositeBranchCondition - Return the inverse of the specified cond,
/// e.g. turning COND_E to COND_NE.
CondCode GetOppositeBranchCondition(CondCode CC);
CondCode GetOppositeBranchCondition(CondCode CC) {
// To reverse a condition it's necessary to only invert the low bit:

return static_cast<CondCode>(static_cast<unsigned>(CC) ^ 0x1);
}

/// Get the VPCMP immediate for the given condition.
unsigned getVPCMPImmForCond(ISD::CondCode CC);
Expand Down
Loading