Restore getInvertedCondCode() from the phased-out backend, fixing disassembly for NV
authorArtyom Skrobov <Artyom.Skrobov@arm.com>
Thu, 29 May 2014 11:34:50 +0000 (11:34 +0000)
committerArtyom Skrobov <Artyom.Skrobov@arm.com>
Thu, 29 May 2014 11:34:50 +0000 (11:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209803 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/Utils/AArch64BaseInfo.h
test/MC/Disassembler/AArch64/basic-a64-instructions.txt

index 9e4c389cc2e959dd4a9899d304293a61167fd152..9d2ce21c9626be7f9deba63cafee0b4a50899adb 100644 (file)
@@ -233,23 +233,9 @@ inline static const char *getCondCodeName(CondCode Code) {
 }
 
 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.
index 397a39eb6cf02f0522077aa1a94729bae76fadfb..70c45c8513303d109ca8aa17880bedda9b5063c3 100644 (file)
 
 # 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