diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-04-05 16:28:55 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-04-05 16:28:55 +0000 |
commit | e112453fc39b97147ea3f23bf0b1973cd9f739b1 (patch) | |
tree | ccfecfa94d21a0e1ccbce64492c4f7328b2c4fb9 /test/MC/X86 | |
parent | 9463c0f3da8e325fea96e36540da18cadaa3f303 (diff) | |
download | external_llvm-e112453fc39b97147ea3f23bf0b1973cd9f739b1.zip external_llvm-e112453fc39b97147ea3f23bf0b1973cd9f739b1.tar.gz external_llvm-e112453fc39b97147ea3f23bf0b1973cd9f739b1.tar.bz2 |
[ms-inline asm] Add support for numeric displacement expressions in bracketed
memory operands.
Essentially, this layers an infix calculator on top of the parsing state
machine. The scale on the index register is still expected to be an immediate
__asm mov eax, [eax + ebx*4]
and will not work with more complex expressions. For example,
__asm mov eax, [eax + ebx*(2*2)]
The plus and minus binary operators assume the numeric value of a register is
zero so as to not change the displacement. Register operands should never
be an operand for a multiply or divide operation; the scale*indexreg
expression is always replaced with a zero on the operand stack to prevent
such a case.
rdar://13521380
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/X86')
-rw-r--r-- | test/MC/X86/intel-syntax.s | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/test/MC/X86/intel-syntax.s b/test/MC/X86/intel-syntax.s index 8bfa58a..226757b 100644 --- a/test/MC/X86/intel-syntax.s +++ b/test/MC/X86/intel-syntax.s @@ -247,4 +247,41 @@ _main: mov [16][eax][ebx*4], ecx // CHECK: movl %ecx, -16(%eax,%ebx,4) mov [eax][ebx*4 - 16], ecx - ret + +// CHECK: prefetchnta 12800(%esi) + prefetchnta [esi + (200*64)] +// CHECK: prefetchnta 32(%esi) + prefetchnta [esi + (64/2)] +// CHECK: prefetchnta 128(%esi) + prefetchnta [esi + (64/2*4)] +// CHECK: prefetchnta 8(%esi) + prefetchnta [esi + (64/(2*4))] +// CHECK: prefetchnta 48(%esi) + prefetchnta [esi + (64/(2*4)+40)] + +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax][ebx*4 - 2*8], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax][4*ebx - 2*8], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax + 4*ebx - 2*8], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [12 + eax + (4*ebx) - 2*14], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax][ebx*4 - 2*2*2*2], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax][ebx*4 - (2*8)], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax][ebx*4 - 2 * 8 + 4 - 4], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax + ebx*4 - 2 * 8 + 4 - 4], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax + ebx*4 - 2 * ((8 + 4) - 4)], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [-2 * ((8 + 4) - 4) + eax + ebx*4], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [((-2) * ((8 + 4) - 4)) + eax + ebx*4], ecx +// CHECK: movl %ecx, -16(%eax,%ebx,4) + mov [eax + ((-2) * ((8 + 4) - 4)) + ebx*4], ecx + + ret |