From: Reid Kleckner Date: Tue, 4 Mar 2014 17:57:56 +0000 (+0000) Subject: Tests for LLVM MS inline asm change r202865 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5dc62e379ad48d158407054c47990ae8af396278;p=clang Tests for LLVM MS inline asm change r202865 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202866 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Sema/ms-inline-asm.c b/test/Sema/ms-inline-asm.c index be41c81c9b..8434688818 100644 --- a/test/Sema/ms-inline-asm.c +++ b/test/Sema/ms-inline-asm.c @@ -50,3 +50,28 @@ void rdar15318432(void) { and ecx, ~15 } } + +static int global; + +int t2(int *arr, int i) { + __asm { + mov eax, arr; + mov eax, arr[0]; + mov eax, arr[1 + 2]; + mov eax, arr[1 + (2 * 5) - 3 + 1<<1]; + } + + // expected-error@+1 {{cannot use base register with variable reference}} + __asm mov eax, arr[ebp + 1 + (2 * 5) - 3 + 1<<1] + // expected-error@+1 {{cannot use index register with variable reference}} + __asm mov eax, arr[esi * 4] + // expected-error@+1 {{cannot use more than one symbol in memory operand}} + __asm mov eax, arr[i] + // expected-error@+1 {{cannot use more than one symbol in memory operand}} + __asm mov eax, global[i] + + // FIXME: Why don't we diagnose this? + // expected-Xerror@+1 {{cannot reference multiple local variables in assembly operand}} + //__asm mov eax, [arr + i]; + return 0; +}