1 // REQUIRES: x86-64-registered-target 2 // RUN: %clang_cc1 -x c++ %s -triple i386-apple-darwin10 -O0 -fasm-blocks -emit-llvm -o - | FileCheck %s 3 4 struct Foo { 5 static int *ptr; 6 static int a, b; 7 int arr[4]; 8 struct Bar { 9 static int *ptr; 10 char arr[2]; 11 }; 12 }; 13 14 void t1() { 15 Foo::ptr = (int *)0xDEADBEEF; 16 Foo::Bar::ptr = (int *)0xDEADBEEF; 17 __asm mov eax, Foo::ptr 18 __asm mov eax, Foo::Bar::ptr 19 __asm mov eax, [Foo::ptr] 20 __asm mov eax, dword ptr [Foo::ptr] 21 __asm mov eax, dword ptr [Foo::ptr] 22 // CHECK: @_Z2t1v 23 // CHECK: call void asm sideeffect inteldialect "mov eax, Foo::ptr", "~{eax},~{dirflag},~{fpsr},~{flags}"() 24 // CHECK: call void asm sideeffect inteldialect "mov eax, Foo::Bar::ptr", "~{eax},~{dirflag},~{fpsr},~{flags}"() 25 // CHECK: call void asm sideeffect inteldialect "mov eax, Foo::ptr", "~{eax},~{dirflag},~{fpsr},~{flags}"() 26 // CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr Foo::ptr", "~{eax},~{dirflag},~{fpsr},~{flags}"() 27 // CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr Foo::ptr", "~{eax},~{dirflag},~{fpsr},~{flags}"() 28 } 29 30 int gvar = 10; 31 void t2() { 32 int lvar = 10; 33 __asm mov eax, offset Foo::ptr 34 __asm mov eax, offset Foo::Bar::ptr 35 // CHECK: t2 36 // CHECK: call void asm sideeffect inteldialect "mov eax, Foo::ptr", "~{eax},~{dirflag},~{fpsr},~{flags}"() 37 // CHECK: call void asm sideeffect inteldialect "mov eax, Foo::Bar::ptr", "~{eax},~{dirflag},~{fpsr},~{flags}"() 38 } 39 40 void t3() { 41 __asm mov eax, LENGTH Foo::ptr 42 __asm mov eax, LENGTH Foo::Bar::ptr 43 __asm mov eax, LENGTH Foo::arr 44 __asm mov eax, LENGTH Foo::Bar::arr 45 46 __asm mov eax, TYPE Foo::ptr 47 __asm mov eax, TYPE Foo::Bar::ptr 48 __asm mov eax, TYPE Foo::arr 49 __asm mov eax, TYPE Foo::Bar::arr 50 51 __asm mov eax, SIZE Foo::ptr 52 __asm mov eax, SIZE Foo::Bar::ptr 53 __asm mov eax, SIZE Foo::arr 54 __asm mov eax, SIZE Foo::Bar::arr 55 // CHECK: t3 56 // FIXME: These tests just make sure we can parse things properly. 57 // Additional work needs to be done in Sema to perform the lookup. 58 } 59