From 897fd5f0edd15ddfc569d3f4ff2a4bcbbb644af2 Mon Sep 17 00:00:00 2001 From: Artyom Skrobov Date: Thu, 29 May 2014 11:34:50 +0000 Subject: [PATCH] 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 --- lib/Target/AArch64/Utils/AArch64BaseInfo.h | 20 +++---------------- .../AArch64/basic-a64-instructions.txt | 6 ++++-- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/Target/AArch64/Utils/AArch64BaseInfo.h b/lib/Target/AArch64/Utils/AArch64BaseInfo.h index 9e4c389cc2e..9d2ce21c962 100644 --- a/lib/Target/AArch64/Utils/AArch64BaseInfo.h +++ b/lib/Target/AArch64/Utils/AArch64BaseInfo.h @@ -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(static_cast(Code) ^ 0x1); } /// Given a condition code, return NZCV flags that would satisfy that condition. diff --git a/test/MC/Disassembler/AArch64/basic-a64-instructions.txt b/test/MC/Disassembler/AArch64/basic-a64-instructions.txt index 397a39eb6cf..70c45c85133 100644 --- a/test/MC/Disassembler/AArch64/basic-a64-instructions.txt +++ b/test/MC/Disassembler/AArch64/basic-a64-instructions.txt @@ -965,16 +965,18 @@ # 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 -- 2.34.1