Home | History | Annotate | Download | only in CodeGenCXX
      1 // REQUIRES: x86-registered-target
      2 // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
      3 
      4 struct A {
      5   int a1;
      6   int a2;
      7   struct B {
      8     int b1;
      9     int b2;
     10   } a3;
     11 };
     12 
     13 namespace asdf {
     14 A a_global;
     15 }
     16 
     17 extern "C" int test_param_field(A p) {
     18 // CHECK: define i32 @test_param_field(%struct.A* byval align 4 %p)
     19 // CHECK: getelementptr inbounds %struct.A, %struct.A* %p, i32 0, i32 0
     20 // CHECK: call i32 asm sideeffect inteldialect "mov eax, dword ptr $1"
     21 // CHECK: ret i32
     22   __asm mov eax, p.a1
     23 }
     24 
     25 extern "C" int test_namespace_global() {
     26 // CHECK: define i32 @test_namespace_global()
     27 // CHECK: call i32 asm sideeffect inteldialect "mov eax, dword ptr $1", "{{.*}}"(i32* getelementptr inbounds (%struct.A, %struct.A* @_ZN4asdf8a_globalE, i32 0, i32 2, i32 1))
     28 // CHECK: ret i32
     29   __asm mov eax, asdf::a_global.a3.b2
     30 }
     31 
     32