summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley Smith <bradley.smith@arm.com>2014-04-09 14:42:07 +0000
committerBradley Smith <bradley.smith@arm.com>2014-04-09 14:42:07 +0000
commit527bf86e56a82bcd781fa015ac09796e5f1f5bcd (patch)
tree1f8dc2b4e998c0608d26f98eee32c530c760b483
parent6d7af17a3f477705c02d0c40ac71a3563db354c7 (diff)
downloadbcm5719-llvm-527bf86e56a82bcd781fa015ac09796e5f1f5bcd.tar.gz
bcm5719-llvm-527bf86e56a82bcd781fa015ac09796e5f1f5bcd.zip
[ARM64] Add support for NV condition code (exists only for valid assembly/disassembly, equivilant to AL)
llvm-svn: 205864
-rw-r--r--llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp27
-rw-r--r--llvm/lib/Target/ARM64/MCTargetDesc/ARM64BaseInfo.h11
-rw-r--r--llvm/test/MC/ARM64/nv-cond.s11
3 files changed, 22 insertions, 27 deletions
diff --git a/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp b/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
index 46440a9bee8..524dd12e280 100644
--- a/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
+++ b/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
@@ -2188,7 +2188,7 @@ ARM64AsmParser::tryParseFPImm(OperandVector &Operands) {
/// parseCondCodeString - Parse a Condition Code string.
unsigned ARM64AsmParser::parseCondCodeString(StringRef Cond) {
- unsigned CC = StringSwitch<unsigned>(Cond)
+ unsigned CC = StringSwitch<unsigned>(Cond.lower())
.Case("eq", ARM64CC::EQ)
.Case("ne", ARM64CC::NE)
.Case("cs", ARM64CC::CS)
@@ -2206,25 +2206,8 @@ unsigned ARM64AsmParser::parseCondCodeString(StringRef Cond) {
.Case("gt", ARM64CC::GT)
.Case("le", ARM64CC::LE)
.Case("al", ARM64CC::AL)
- // Upper case works too. Not mixed case, though.
- .Case("EQ", ARM64CC::EQ)
- .Case("NE", ARM64CC::NE)
- .Case("CS", ARM64CC::CS)
- .Case("HS", ARM64CC::CS)
- .Case("CC", ARM64CC::CC)
- .Case("LO", ARM64CC::CC)
- .Case("MI", ARM64CC::MI)
- .Case("PL", ARM64CC::PL)
- .Case("VS", ARM64CC::VS)
- .Case("VC", ARM64CC::VC)
- .Case("HI", ARM64CC::HI)
- .Case("LS", ARM64CC::LS)
- .Case("GE", ARM64CC::GE)
- .Case("LT", ARM64CC::LT)
- .Case("GT", ARM64CC::GT)
- .Case("LE", ARM64CC::LE)
- .Case("AL", ARM64CC::AL)
- .Default(~0U);
+ .Case("nv", ARM64CC::NV)
+ .Default(ARM64CC::Invalid);
return CC;
}
@@ -2237,7 +2220,7 @@ bool ARM64AsmParser::parseCondCode(OperandVector &Operands,
StringRef Cond = Tok.getString();
unsigned CC = parseCondCodeString(Cond);
- if (CC == ~0U)
+ if (CC == ARM64CC::Invalid)
return TokError("invalid condition code");
Parser.Lex(); // Eat identifier token.
@@ -3566,7 +3549,7 @@ bool ARM64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
SMLoc SuffixLoc = SMLoc::getFromPointer(NameLoc.getPointer() +
(Head.data() - Name.data()));
unsigned CC = parseCondCodeString(Head);
- if (CC == ~0U)
+ if (CC == ARM64CC::Invalid)
return Error(SuffixLoc, "invalid condition code");
const MCExpr *CCExpr = MCConstantExpr::Create(CC, getContext());
Operands.push_back(
diff --git a/llvm/lib/Target/ARM64/MCTargetDesc/ARM64BaseInfo.h b/llvm/lib/Target/ARM64/MCTargetDesc/ARM64BaseInfo.h
index d3c2cf7230f..192082bf25d 100644
--- a/llvm/lib/Target/ARM64/MCTargetDesc/ARM64BaseInfo.h
+++ b/llvm/lib/Target/ARM64/MCTargetDesc/ARM64BaseInfo.h
@@ -200,14 +200,15 @@ enum CondCode { // Meaning (integer) Meaning (floating-point)
LT = 0xb, // Less than Less than, or unordered
GT = 0xc, // Greater than Greater than
LE = 0xd, // Less than or equal <, ==, or unordered
- AL = 0xe // Always (unconditional) Always (unconditional)
+ AL = 0xe, // Always (unconditional) Always (unconditional)
+ NV = 0xf, // Always (unconditional) Always (unconditional)
+ // Note the NV exists purely to disassemble 0b1111. Execution is "always".
+ Invalid
};
inline static const char *getCondCodeName(CondCode Code) {
- // cond<0> is ignored when cond<3:1> = 111, where 1110 is 0xe (aka AL).
- if ((Code & AL) == AL)
- Code = AL;
switch (Code) {
+ default: llvm_unreachable("Unknown condition code");
case EQ: return "eq";
case NE: return "ne";
case CS: return "cs";
@@ -223,8 +224,8 @@ inline static const char *getCondCodeName(CondCode Code) {
case GT: return "gt";
case LE: return "le";
case AL: return "al";
+ case NV: return "nv";
}
- llvm_unreachable("Unknown condition code");
}
inline static CondCode getInvertedCondCode(CondCode Code) {
diff --git a/llvm/test/MC/ARM64/nv-cond.s b/llvm/test/MC/ARM64/nv-cond.s
new file mode 100644
index 00000000000..ded5ec6ad98
--- /dev/null
+++ b/llvm/test/MC/ARM64/nv-cond.s
@@ -0,0 +1,11 @@
+// RUN: llvm-mc < %s -triple arm64 -show-encoding | FileCheck %s
+
+fcsel d28,d31,d31,nv
+csel x0,x0,x0,nv
+ccmp x0,x0,#0,nv
+b.nv #0
+
+// CHECK: fcsel d28, d31, d31, nv // encoding: [0xfc,0xff,0x7f,0x1e]
+// CHECK: csel x0, x0, x0, nv // encoding: [0x00,0xf0,0x80,0x9a]
+// CHECK: ccmp x0, x0, #0, nv // encoding: [0x00,0xf0,0x40,0xfa]
+// CHECK: b.nv #0 // encoding: [0x0f,0x00,0x00,0x54]
OpenPOWER on IntegriCloud