[llvm-commits] [llvm] r148486 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/X86/intel-syntax-encoding.s

Devang Patel dpatel at apple.com
Thu Jan 19 10:15:51 PST 2012


Author: dpatel
Date: Thu Jan 19 12:15:51 2012
New Revision: 148486

URL: http://llvm.org/viewvc/llvm-project?rev=148486&view=rev
Log:
Intel syntax: There is no need to create unary expr for simple negative displacement.

Modified:
    llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
    llvm/trunk/test/MC/X86/intel-syntax-encoding.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=148486&r1=148485&r2=148486&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Thu Jan 19 12:15:51 2012
@@ -651,7 +651,7 @@
         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)) {

Modified: llvm/trunk/test/MC/X86/intel-syntax-encoding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/intel-syntax-encoding.s?rev=148486&r1=148485&r2=148486&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/intel-syntax-encoding.s (original)
+++ llvm/trunk/test/MC/X86/intel-syntax-encoding.s Thu Jan 19 12:15:51 2012
@@ -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
+





More information about the llvm-commits mailing list