Add tests for MS inline asm change r203146

llvm-svn: 203147
This commit is contained in:
Reid Kleckner 2014-03-06 19:19:36 +00:00
parent 94a1c4d3f1
commit 8d4a16ec3a
2 changed files with 41 additions and 0 deletions

View File

@ -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}"()
}

View File

@ -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@+2 {{unexpected type name 'A': expected expression}}
// expected-error@+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!}}
}