[llvm-commits] [llvm] r114809 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s
Chris Lattner
sabre at nondot.org
Sun Sep 26 21:23:03 PDT 2010
Author: lattner
Date: Sun Sep 26 23:23:03 2010
New Revision: 114809
URL: http://llvm.org/viewvc/llvm-project?rev=114809&view=rev
Log:
implement support for 'clr' alias. This is part of rdar://8416805,
but balrog was wanting it on irc.
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=114809&r1=114808&r2=114809&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Sun Sep 26 23:23:03 2010
@@ -1052,6 +1052,17 @@
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;
}
Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=114809&r1=114808&r2=114809&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original)
+++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Sun Sep 26 23:23:03 2010
@@ -360,4 +360,18 @@
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
+
More information about the llvm-commits
mailing list