[PATCH] D38117: [X86] [MC] fixed non optimal encoding of instruction memory operand (PR24038)
Konstantin Belochapka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 05:07:01 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL314044: [X86] [MC] fixed non optimal encoding of instruction memory operand (PR24038). (authored by kbelochapka).
Changed prior to commit:
https://reviews.llvm.org/D38117?vs=116134&id=116528#toc
Repository:
rL LLVM
https://reviews.llvm.org/D38117
Files:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/X86/x86_64-encoding.s
Index: llvm/trunk/test/MC/X86/x86_64-encoding.s
===================================================================
--- llvm/trunk/test/MC/X86/x86_64-encoding.s
+++ llvm/trunk/test/MC/X86/x86_64-encoding.s
@@ -251,3 +251,15 @@
// CHECK: pinsrw $3, %ecx, %xmm5
// CHECK: encoding: [0x66,0x0f,0xc4,0xe9,0x03]
pinsrw $3, %rcx, %xmm5
+
+//CHECK movq 12(%rdi), %rsi
+//CHECK encoding: [0x48,0x8b,0x77,0x0c]
+ movq 16+0-4(%rdi),%rsi
+
+//CHECK movq 12(%rdi), %rsi
+//CHECK encoding: [0x48,0x8b,0x77,0x0c]
+ movq (16+(0-4))(%rdi),%rsi
+
+//CHECK movq 12(%rdi), %rsi
+//CHECK encoding: [0x48,0x8b,0x77,0x0c]
+ movq (16+0)-1+1-2+2-3+3-4+4-5+5-6+6-(4)(%rdi),%rsi
Index: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1985,9 +1985,12 @@
// memory operand consumed.
} else {
SMLoc ExprEnd;
+ getLexer().UnLex(AsmToken(AsmToken::LParen, "("));
- // It must be an parenthesized expression, parse it now.
- if (getParser().parseParenExpression(Disp, ExprEnd))
+ // It must be either an parenthesized expression, or an expression that
+ // begins from a parenthesized expression, parse it now. Example: (1+2) or
+ // (1+2)+3
+ if (getParser().parseExpression(Disp, ExprEnd))
return nullptr;
// After parsing the base expression we could either have a parenthesized
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38117.116528.patch
Type: text/x-patch
Size: 1552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170925/ad3cf551/attachment.bin>
More information about the llvm-commits
mailing list