Restore getInvertedCondCode() from the phased-out backend, fixing disassembly for NV

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209803 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Artyom Skrobov 2014-05-29 11:34:50 +00:00
parent 684122e84e
commit 897fd5f0ed
2 changed files with 7 additions and 19 deletions

View File

@ -233,23 +233,9 @@ inline static const char *getCondCodeName(CondCode Code) {
} }
inline static CondCode getInvertedCondCode(CondCode Code) { inline static CondCode getInvertedCondCode(CondCode Code) {
switch (Code) { // To reverse a condition it's necessary to only invert the low bit:
default: llvm_unreachable("Unknown condition code");
case EQ: return NE; return static_cast<CondCode>(static_cast<unsigned>(Code) ^ 0x1);
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;
}
} }
/// Given a condition code, return NZCV flags that would satisfy that condition. /// Given a condition code, return NZCV flags that would satisfy that condition.

View File

@ -965,16 +965,18 @@
# CHECK: cinv w3, w5, gt # CHECK: cinv w3, w5, gt
# CHECK: cinv wzr, w4, le # CHECK: cinv wzr, w4, le
# CHECK: csetm w9, lt # CHECK: csetm w9, lt
# CHECK: cinv x3, x5, gt # CHECK: cinv x3, x5, gt
# CHECK: cinv xzr, x4, le # CHECK: cinv xzr, x4, le
# CHECK: csetm x9, lt # CHECK: csetm x9, lt
# CHECK: cinv x0, x0, nv
0xa3 0xd0 0x85 0x5a 0xa3 0xd0 0x85 0x5a
0x9f 0xc0 0x84 0x5a 0x9f 0xc0 0x84 0x5a
0xe9 0xa3 0x9f 0x5a 0xe9 0xa3 0x9f 0x5a
0xa3 0xd0 0x85 0xda 0xa3 0xd0 0x85 0xda
0x9f 0xc0 0x84 0xda 0x9f 0xc0 0x84 0xda
0xe9 0xa3 0x9f 0xda 0xe9 0xa3 0x9f 0xda
0x00 0xe0 0x80 0xda
# CHECK: cneg w3, w5, gt # CHECK: cneg w3, w5, gt
# CHECK: cneg wzr, w4, le # CHECK: cneg wzr, w4, le