summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/ms_this.cpp
blob: 10cd52ffc6475eda0758c4c9873bf0e40e52967e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// RUN: %clang_cc1 -fasm-blocks -emit-llvm %s -o - | FileCheck %s
class t1 {
public:
  double a;
  void runc();
};

class t2 {
public:
  double a;
  void runc();
};

void t2::runc() {
  double num = 0;
  __asm {
      mov rax,[this]
      //CHECK: %this.addr = alloca %class.t2*
      //CHECK: call void asm sideeffect inteldialect "mov rax,qword ptr $1{{.*}}%class.t2* %this1
      mov rbx,[rax]
      mov num, rbx
	   };
}

void t1::runc() {
  double num = 0;
  __asm {
       mov rax,[this]
      //CHECK: %this.addr = alloca %class.t1*
      //CHECK: call void asm sideeffect inteldialect "mov rax,qword ptr $1{{.*}}%class.t1* %this1
        mov rbx,[rax]
        mov num, rbx
	   };
}

struct s {
  int a;
  void func() {
    __asm mov rax, [this]
    //CHECK: %this.addr = alloca %struct.s*
    //CHECK: call void asm sideeffect inteldialect "mov rax, qword ptr $0{{.*}}%struct.s* %this1
  }
} f3;

int main() {
  f3.func();
  f3.a=1;
  return 0;
}
OpenPOWER on IntegriCloud