aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-10-30 18:07:17 +0000
committerChris Lattner <sabre@nondot.org>2010-10-30 18:07:17 +0000
commit8b260a76445762f109cc8cf6577435c4cc59e3aa (patch)
tree04635ea8ecfe0e1284773753432cc7d46a4782d2
parent8cb441c9e0acb8b2c68229a783785fc9c3942ec8 (diff)
downloadexternal_llvm-8b260a76445762f109cc8cf6577435c4cc59e3aa.zip
external_llvm-8b260a76445762f109cc8cf6577435c4cc59e3aa.tar.gz
external_llvm-8b260a76445762f109cc8cf6577435c4cc59e3aa.tar.bz2
move a bunch more aliases from .cpp -> .td file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117819 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp29
-rw-r--r--lib/Target/X86/X86InstrInfo.td20
2 files changed, 27 insertions, 22 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index a131539..8a7cdc7 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -636,24 +636,10 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
.Case("pop", Is64Bit ? "popq" : "popl")
.Case("pushf", Is64Bit ? "pushfq" : "pushfl")
.Case("popf", Is64Bit ? "popfq" : "popfl")
- .Case("pushfd", "pushfl")
- .Case("popfd", "popfl")
.Case("retl", Is64Bit ? "retl" : "ret")
.Case("retq", Is64Bit ? "ret" : "retq")
- // Floating point stack cmov aliases.
- .Case("fcmovz", "fcmove")
- .Case("fcmova", "fcmovnbe")
- .Case("fcmovnae", "fcmovb")
- .Case("fcmovna", "fcmovbe")
- .Case("fcmovae", "fcmovnb")
- .Case("fwait", "wait")
.Case("movzx", "movzb") // FIXME: Not correct.
- .Case("fildq", "fildll")
.Case("fcompi", "fcomip")
- .Case("fnstcww", "fnstcw")
- .Case("fstcww", "fstcw")
- .Case("fnstsww", "fnstsw")
- .Case("fstsww", "fstsw")
.Default(Name);
// FIXME: Hack to recognize cmp<comparison code>{ss,sd,ps,pd}.
@@ -964,7 +950,7 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
}
// The assembler accepts various amounts of brokenness for fnstsw.
- if (Name == "fnstsw") {
+ if (Name == "fnstsw" || Name == "fnstsww") {
if (Operands.size() == 2 &&
static_cast<X86Operand*>(Operands[1])->isReg()) {
// "fnstsw al" and "fnstsw eax" -> "fnstw"
@@ -1105,6 +1091,7 @@ MatchAndEmitInstruction(SMLoc IDLoc,
// First, handle aliases that expand to multiple instructions.
// FIXME: This should be replaced with a real .td file alias mechanism.
if (Op->getToken() == "fstsw" || Op->getToken() == "fstcw" ||
+ Op->getToken() == "fstsww" || Op->getToken() == "fstcww" ||
Op->getToken() == "finit" || Op->getToken() == "fsave" ||
Op->getToken() == "fstenv" || Op->getToken() == "fclex") {
MCInst Inst;
@@ -1113,12 +1100,14 @@ MatchAndEmitInstruction(SMLoc IDLoc,
const char *Repl =
StringSwitch<const char*>(Op->getToken())
- .Case("finit", "fninit")
- .Case("fsave", "fnsave")
- .Case("fstcw", "fnstcw")
+ .Case("finit", "fninit")
+ .Case("fsave", "fnsave")
+ .Case("fstcw", "fnstcw")
+ .Case("fstcww", "fnstcw")
.Case("fstenv", "fnstenv")
- .Case("fstsw", "fnstsw")
- .Case("fclex", "fnclex")
+ .Case("fstsw", "fnstsw")
+ .Case("fstsww", "fnstsw")
+ .Case("fclex", "fnclex")
.Default(0);
assert(Repl && "Unknown wait-prefixed instruction");
delete Operands[0];
diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td
index b5168f8..6f99086 100644
--- a/lib/Target/X86/X86InstrInfo.td
+++ b/lib/Target/X86/X86InstrInfo.td
@@ -1265,17 +1265,33 @@ def : MnemonicAlias<"cwd", "cwtd">;
def : MnemonicAlias<"cdq", "cltd">;
def : MnemonicAlias<"cwde", "cwtl">;
def : MnemonicAlias<"cdqe", "cltq">;
+
+def : MnemonicAlias<"pushfd", "pushfl">;
+def : MnemonicAlias<"popfd", "popfl">;
+
def : MnemonicAlias<"smovb", "movsb">;
def : MnemonicAlias<"smovw", "movsw">;
def : MnemonicAlias<"smovl", "movsl">;
def : MnemonicAlias<"smovq", "movsq">;
-def : MnemonicAlias<"fldcww", "fldcw">;
-def : MnemonicAlias<"fucompi", "fucomip">;
def : MnemonicAlias<"ud2a", "ud2">;
def : MnemonicAlias<"verrw", "verr">;
+// Floating point stack aliases.
+def : MnemonicAlias<"fcmovz", "fcmove">;
+def : MnemonicAlias<"fcmova", "fcmovnbe">;
+def : MnemonicAlias<"fcmovnae", "fcmovb">;
+def : MnemonicAlias<"fcmovna", "fcmovbe">;
+def : MnemonicAlias<"fcmovae", "fcmovnb">;
+def : MnemonicAlias<"fildq", "fildll">;
+def : MnemonicAlias<"fldcww", "fldcw">;
+def : MnemonicAlias<"fnstcww", "fnstcw">;
+def : MnemonicAlias<"fnstsww", "fnstsw">;
+def : MnemonicAlias<"fucompi", "fucomip">;
+def : MnemonicAlias<"fwait", "wait">;
+
+
class CondCodeAlias<string Prefix,string Suffix, string OldCond, string NewCond>
: MnemonicAlias<!strconcat(Prefix, OldCond, Suffix),
!strconcat(Prefix, NewCond, Suffix)>;