brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 7292a5a Raw
57 lines · cpp
1// REQUIRES: x86-registered-target2// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s3 4struct A {5  int a1;6  int a2;7  struct B {8    int b1;9    int b2;10  } a3;11};12 13namespace asdf {14A a_global;15}16 17extern "C" int test_param_field(A p) {18// CHECK: define{{.*}} i32 @test_param_field(ptr noundef byval(%struct.A) align 4 %p)19// CHECK: getelementptr inbounds nuw %struct.A, ptr %p, i32 0, i32 020// CHECK: call i32 asm sideeffect inteldialect "mov eax, $1"21// CHECK: ret i3222  __asm mov eax, p.a123}24 25extern "C" int test_namespace_global() {26// CHECK: define{{.*}} i32 @test_namespace_global()27// CHECK: call i32 asm sideeffect inteldialect "mov eax, $1", "{{.*}}"(ptr elementtype(i32) getelementptr inbounds nuw (%"struct.A::B", ptr getelementptr inbounds nuw (%struct.A, ptr @_ZN4asdf8a_globalE, i32 0, i32 2), i32 0, i32 1))28// CHECK: ret i3229  __asm mov eax, asdf::a_global.a3.b230}31 32template <bool Signed>33struct make_storage_type {34  struct type {35    struct B {36      int a;37      int x;38    } b;39  };40};41 42template <bool Signed>43struct msvc_dcas_x86 {44  typedef typename make_storage_type<Signed>::type storage_type;45  void store() __asm("PR26001") {46    storage_type p;47    __asm mov edx, p.b.x;48  }49};50 51template void msvc_dcas_x86<false>::store();52// CHECK: define weak_odr void @"\01PR26001"(53// CHECK: %[[P:.*]] = alloca %"struct.make_storage_type<false>::type", align 454// CHECK: %[[B:.*]] = getelementptr inbounds nuw %"struct.make_storage_type<false>::type", ptr %[[P]], i32 0, i32 055// CHECK: %[[X:.*]] = getelementptr inbounds nuw %"struct.make_storage_type<false>::type::B", ptr %[[B]], i32 0, i32 156// CHECK: call void asm sideeffect inteldialect "mov edx, $0", "*m,~{edx},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %[[X]])57