git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209803
91177308-0d34-0410-b5e6-
96231b3b80d8
}
inline static CondCode getInvertedCondCode(CondCode Code) {
- switch (Code) {
- 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<CondCode>(static_cast<unsigned>(Code) ^ 0x1);
}
/// Given a condition code, return NZCV flags that would satisfy that condition.
# CHECK: cinv w3, w5, gt
# CHECK: cinv wzr, w4, le
-# CHECK: csetm w9, lt
+# CHECK: csetm w9, lt
# CHECK: cinv x3, x5, gt
# CHECK: cinv xzr, x4, le
-# CHECK: csetm x9, lt
+# CHECK: csetm x9, lt
+# CHECK: cinv x0, x0, nv
0xa3 0xd0 0x85 0x5a
0x9f 0xc0 0x84 0x5a
0xe9 0xa3 0x9f 0x5a
0xa3 0xd0 0x85 0xda
0x9f 0xc0 0x84 0xda
0xe9 0xa3 0x9f 0xda
+0x00 0xe0 0x80 0xda
# CHECK: cneg w3, w5, gt
# CHECK: cneg wzr, w4, le