Intel syntax: There is no need to create unary expr for simple negative displacement.

llvm-svn: 148486
This commit is contained in:
Devang Patel 2012-01-19 18:15:51 +00:00
parent 4a62ff9bcb
commit 2529dd9e00
2 changed files with 5 additions and 1 deletions

View File

@ -651,7 +651,7 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned Size) {
Scale = Val;
} else if (getLexer().is(AsmToken::RBrac)) {
const MCExpr *ValExpr = MCConstantExpr::Create(Val, getContext());
Disp = isPlus ? ValExpr : MCUnaryExpr::CreateMinus(ValExpr, getContext());
Disp = isPlus ? ValExpr : MCConstantExpr::Create(0-Val, getContext());
} else
return ErrorOperand(PlusLoc, "unexpected token after +");
} else if (getLexer().is(AsmToken::Identifier)) {

View File

@ -20,3 +20,7 @@
cmp eax, 12
// CHECK: encoding: [0x48,0x83,0xf8,0x0c]
cmp rax, 12
// CHECK: encoding: [0x48,0x89,0x44,0x24,0xf0]
mov QWORD PTR [RSP - 16], RAX