summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/ms-inline-asm.c
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-03-04 17:57:56 +0000
committerReid Kleckner <reid@kleckner.net>2014-03-04 17:57:56 +0000
commit51082b1a8636bcb34f52a39757847674c63ba68a (patch)
tree55176038633fc5db21eaea8a25be40d5dea2e93f /clang/test/Sema/ms-inline-asm.c
parent4e3bd518f2b60ea500113115c906815b754315ed (diff)
downloadbcm5719-llvm-51082b1a8636bcb34f52a39757847674c63ba68a.tar.gz
bcm5719-llvm-51082b1a8636bcb34f52a39757847674c63ba68a.zip
Tests for LLVM MS inline asm change r202865
llvm-svn: 202866
Diffstat (limited to 'clang/test/Sema/ms-inline-asm.c')
-rw-r--r--clang/test/Sema/ms-inline-asm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Sema/ms-inline-asm.c b/clang/test/Sema/ms-inline-asm.c
index be41c81c9bb..84346888181 100644
--- a/clang/test/Sema/ms-inline-asm.c
+++ b/clang/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;
+}
OpenPOWER on IntegriCloud