diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-27 04:23:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-27 04:23:03 +0000 |
commit | fd8fddd830ad8322d04161f2f6bad6269a451ab2 (patch) | |
tree | 997491c9171a57086b19ec28d966d05345ebb35c | |
parent | cec2945f3092c4d087716eb96062d7c7ef6fe60c (diff) | |
download | external_llvm-fd8fddd830ad8322d04161f2f6bad6269a451ab2.zip external_llvm-fd8fddd830ad8322d04161f2f6bad6269a451ab2.tar.gz external_llvm-fd8fddd830ad8322d04161f2f6bad6269a451ab2.tar.bz2 |
implement support for 'clr' alias. This is part of rdar://8416805,
but balrog was wanting it on irc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114809 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/AsmParser/X86AsmParser.cpp | 11 | ||||
-rw-r--r-- | test/MC/AsmParser/X86/x86_instructions.s | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 01ccc50..18fb173 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1052,6 +1052,17 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, Operands[0] = X86Operand::CreateToken("fstps", NameLoc); } + + // "clr <reg>" -> "xor <reg>, <reg>". + if ((Name == "clrb" || Name == "clrw" || Name == "clrl" || Name == "clrq" || + Name == "clr") && Operands.size() == 2 && + static_cast<X86Operand*>(Operands[1])->isReg()) { + unsigned RegNo = static_cast<X86Operand*>(Operands[1])->getReg(); + Operands.push_back(X86Operand::CreateReg(RegNo, NameLoc, NameLoc)); + delete Operands[0]; + Operands[0] = X86Operand::CreateToken("xor", NameLoc); + } + return false; } diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s index b72374d..9725e9d 100644 --- a/test/MC/AsmParser/X86/x86_instructions.s +++ b/test/MC/AsmParser/X86/x86_instructions.s @@ -360,4 +360,18 @@ mov %rdx, %cr15 faddp %st, %st(1) fmulp %st, %st(2) +// rdar://8416805 +// CHECK: xorb %al, %al +// CHECK: encoding: [0x30,0xc0] +// CHECK: xorw %di, %di +// CHECK: encoding: [0x66,0x31,0xff] +// CHECK: xorl %esi, %esi +// CHECK: encoding: [0x31,0xf6] +// CHECK: xorq %rsi, %rsi +// CHECK: encoding: [0x48,0x31,0xf6] +clrb %al +clr %di +clr %esi +clr %rsi + |