aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp89
-rw-r--r--llvm/test/MC/AArch64/brbe.s13
2 files changed, 48 insertions, 54 deletions
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
index 3006c757901a..159b1a161ea5 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -944,34 +944,29 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
}
// BRB aliases.
case 2: {
- switch (Op1Val) {
- default:
- return false;
- case 1:
+ if (Op1Val == 1) {
if (!(STI.hasFeature(AArch64::FeatureAll) ||
STI.hasFeature(AArch64::FeatureBRBE)))
return false;
NeedsReg = false;
- switch (Op2Val) {
- default:
- return false;
- case 4:
+ if (Op2Val == 4) {
Ins = "brb\t";
Name = "iall";
- break;
- case 5:
+ } else if (Op2Val == 5) {
Ins = "brb\t";
Name = "inj";
- break;
+ } else {
+ return false;
}
- break;
- case 3:
+ } else if (Op1Val == 3) {
if (Op2Val != 7 || !(STI.hasFeature(AArch64::FeatureAll) ||
STI.hasFeature(AArch64::FeatureITE)))
return false;
return false;
+ } else {
+ return false;
}
} break;
// Prediction Restriction aliases
@@ -1031,22 +1026,6 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
Name = std::string(AT->Name);
}
break;
- // Overlaps with AT and DC
- case 15: {
- const AArch64AT::AT *AT = AArch64AT::lookupATByEncoding(Encoding);
- const AArch64DC::DC *DC = AArch64DC::lookupDCByEncoding(Encoding);
- if (AT && AT->haveFeatures(STI.getFeatureBits())) {
- NeedsReg = true;
- Ins = "at\t";
- Name = std::string(AT->Name);
- } else if (DC && DC->haveFeatures(STI.getFeatureBits())) {
- NeedsReg = true;
- Ins = "dc\t";
- Name = std::string(DC->Name);
- } else {
- return false;
- }
- } break;
// GCS aliases.
case 7: {
if (!(STI.hasFeature(AArch64::FeatureAll) ||
@@ -1055,38 +1034,44 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
RegSep = "\t";
Name = "";
- switch (Op1Val) {
- default:
- return false;
- case 0:
+ if (Op1Val == 0) {
NeedsReg = false;
- switch (Op2Val) {
- default:
- return false;
- case 4:
+ if (Op2Val == 4) {
Ins = "gcspushx";
- break;
- case 5:
+ } else if (Op2Val == 5) {
Ins = "gcspopcx";
- break;
- case 6:
+ } else if (Op2Val == 6) {
Ins = "gcspopx";
- break;
+ } else {
+ return false;
}
- break;
- case 3:
+ } else if (Op1Val == 3) {
NeedsReg = true;
- switch (Op2Val) {
- default:
- return false;
- case 0:
+ if (Op2Val == 0) {
Ins = "gcspushm";
- break;
- case 2:
+ } else if (Op2Val == 2) {
Ins = "gcsss1";
- break;
+ } else {
+ return false;
}
- break;
+ } else {
+ return false;
+ }
+ } break;
+ // Overlaps with AT and DC
+ case 15: {
+ const AArch64AT::AT *AT = AArch64AT::lookupATByEncoding(Encoding);
+ const AArch64DC::DC *DC = AArch64DC::lookupDCByEncoding(Encoding);
+ if (AT && AT->haveFeatures(STI.getFeatureBits())) {
+ NeedsReg = true;
+ Ins = "at\t";
+ Name = std::string(AT->Name);
+ } else if (DC && DC->haveFeatures(STI.getFeatureBits())) {
+ NeedsReg = true;
+ Ins = "dc\t";
+ Name = std::string(DC->Name);
+ } else {
+ return false;
}
} break;
}
diff --git a/llvm/test/MC/AArch64/brbe.s b/llvm/test/MC/AArch64/brbe.s
index f02017dae8e5..f34b01f60d46 100644
--- a/llvm/test/MC/AArch64/brbe.s
+++ b/llvm/test/MC/AArch64/brbe.s
@@ -2,6 +2,9 @@
// RUN: FileCheck --check-prefix=ERROR %s < %t
// RUN: not llvm-mc -triple aarch64 -show-encoding %s 2>%t
// RUN: FileCheck --check-prefix=ERROR-NO-BRBE %s < %t
+// RUN: split-file %s %t.dir
+// RUN: llvm-mc -triple aarch64 -mattr +brbe -filetype=obj %t.dir/brb-no-brbe.s \
+// RUN: | llvm-objdump -d --mattr=-brbe --no-print-imm-hex - | FileCheck %s --check-prefix=CHECK-UNKNOWN
msr BRBCR_EL1, x0
mrs x1, BRBCR_EL1
@@ -138,8 +141,10 @@ brb iall
brb inj
// CHECK: brb iall // encoding: [0x9f,0x72,0x09,0xd5]
// CHECK: brb inj // encoding: [0xbf,0x72,0x09,0xd5]
-// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe
-// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe
+// CHECK-UNKNOWN: d509729f sys #1, c7, c2, #4
+// CHECK-UNKNOWN: d50972bf sys #1, c7, c2, #5
+// ERROR-NO-BRBE: [[@LINE-6]]:1: error: instruction requires: brbe
+// ERROR-NO-BRBE: [[@LINE-6]]:1: error: instruction requires: brbe
brb IALL
brb INJ
@@ -147,3 +152,7 @@ brb INJ
// CHECK: brb inj // encoding: [0xbf,0x72,0x09,0xd5]
// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe
// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe
+
+//--- brb-no-brbe.s
+brb iall
+brb inj