implement support for 'clr' alias. This is part of rdar://8416805,

but balrog was wanting it on irc.

llvm-svn: 114809
This commit is contained in:
Chris Lattner 2010-09-27 04:23:03 +00:00
parent d342ada445
commit 75edc6b6e0
2 changed files with 25 additions and 0 deletions

View File

@ -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;
}

View File

@ -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