From: Devang Patel Date: Thu, 19 Jan 2012 18:15:51 +0000 (+0000) Subject: Intel syntax: There is no need to create unary expr for simple negative displacement. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e60540f380cc9466f3b2f7d17adfd37db137689c;p=oota-llvm.git Intel syntax: There is no need to create unary expr for simple negative displacement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148486 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 5fc38d39d91..1763419408d 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -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)) { diff --git a/test/MC/X86/intel-syntax-encoding.s b/test/MC/X86/intel-syntax-encoding.s index 0d1b2fa9932..23eff016910 100644 --- a/test/MC/X86/intel-syntax-encoding.s +++ b/test/MC/X86/intel-syntax-encoding.s @@ -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 +