r203147 - Add tests for MS inline asm change r203146

Reid Kleckner reid at kleckner.net
Thu Mar 6 11:19:36 PST 2014


Author: rnk
Date: Thu Mar  6 13:19:36 2014
New Revision: 203147

URL: http://llvm.org/viewvc/llvm-project?rev=203147&view=rev
Log:
Add tests for MS inline asm change r203146

Modified:
    cfe/trunk/test/CodeGen/ms-inline-asm.c
    cfe/trunk/test/Sema/ms-inline-asm.c

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=203147&r1=203146&r2=203147&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Thu Mar  6 13:19:36 2014
@@ -445,3 +445,18 @@ void cpuid() {
 // CHECK-LABEL: define void @cpuid
 // CHECK: call void asm sideeffect inteldialect "cpuid", "~{eax},~{ebx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"()
 }
+
+typedef struct {
+  int a;
+  int b;
+} A;
+
+void t39() {
+  __asm mov eax, [eax].A.b
+  __asm mov eax, [eax] A.b
+  __asm mov eax, fs:[0] A.b
+  // CHECK-LABEL: define void @t39
+  // CHECK: call void asm sideeffect inteldialect "mov eax, [eax].4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
+  // CHECK: call void asm sideeffect inteldialect "mov eax, [eax] .4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
+  // CHECK: call void asm sideeffect inteldialect "mov eax, fs:[$$0] .4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
+}

Modified: cfe/trunk/test/Sema/ms-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ms-inline-asm.c?rev=203147&r1=203146&r2=203147&view=diff
==============================================================================
--- cfe/trunk/test/Sema/ms-inline-asm.c (original)
+++ cfe/trunk/test/Sema/ms-inline-asm.c Thu Mar  6 13:19:36 2014
@@ -75,3 +75,29 @@ int t2(int *arr, int i) {
   //__asm mov eax, [arr + i];
   return 0;
 }
+
+typedef struct {
+  int a;
+  int b;
+} A;
+
+void t3() {
+  __asm mov eax, [eax] UndeclaredId // expected-error {{unknown token in expression}}
+
+  // FIXME: Only emit one diagnostic here.
+  // expected-error at +2 {{unexpected type name 'A': expected expression}}
+  // expected-error at +1 {{unknown token in expression}}
+  __asm mov eax, [eax] A
+}
+
+void t4() {
+  // The dot in the "intel dot operator" is optional in MSVC.  MSVC also does
+  // global field lookup, but we don't.
+  __asm mov eax, [0] A.a
+  __asm mov eax, [0].A.a
+  __asm mov eax, [0].a    // expected-error {{Unable to lookup field reference!}}
+  __asm mov eax, fs:[0] A.a
+  __asm mov eax, fs:[0].A.a
+  __asm mov eax, fs:[0].a // expected-error {{Unable to lookup field reference!}}
+  __asm mov eax, fs:[0]. A.a  // expected-error {{Unexpected token type!}}
+}





More information about the cfe-commits mailing list