Skip to content

Commit b7ef9db

Browse files
authored
[ARM] getOppositeCondition should match AArch64
1 parent 0aa5502 commit b7ef9db

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

llvm/lib/Target/ARM/Utils/ARMBaseInfo.h

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,9 @@ enum CondCodes { // Meaning (integer) Meaning (floating-point)
4646
};
4747

4848
inline static CondCodes getOppositeCondition(CondCodes CC) {
49-
switch (CC) {
50-
default: llvm_unreachable("Unknown condition code");
51-
case EQ: return NE;
52-
case NE: return EQ;
53-
case HS: return LO;
54-
case LO: return HS;
55-
case MI: return PL;
56-
case PL: return MI;
57-
case VS: return VC;
58-
case VC: return VS;
59-
case HI: return LS;
60-
case LS: return HI;
61-
case GE: return LT;
62-
case LT: return GE;
63-
case GT: return LE;
64-
case LE: return GT;
65-
}
49+
// To reverse a condition it's necessary to only invert the low bit:
50+
51+
return static_cast<CondCodes>(static_cast<unsigned>(CC) ^ 0x1);
6652
}
6753

6854
/// getSwappedCondition - assume the flags are set by MI(a,b), return

0 commit comments

Comments
 (0)