| 1 |
// REQUIRES: x86-registered-target |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -triple x86_64-pc-win32 -fasm-blocks -emit-llvm %s -o - | FileCheck %s |
| 4 |
class t1 { |
| 5 |
public: |
| 6 |
double a; |
| 7 |
void runc(); |
| 8 |
}; |
| 9 |
|
| 10 |
class t2 { |
| 11 |
public: |
| 12 |
double a; |
| 13 |
void runc(); |
| 14 |
}; |
| 15 |
|
| 16 |
// CHECK: define dso_local void @"?runc@t2@@ |
| 17 |
void t2::runc() { |
| 18 |
double num = 0; |
| 19 |
__asm { |
| 20 |
mov rax,[this] |
| 21 |
// CHECK: [[THIS_ADDR_T2:%.+]] = alloca ptr |
| 22 |
// CHECK: [[THIS1_T2:%.+]] = load ptr, ptr [[THIS_ADDR_T2]], |
| 23 |
// CHECK: call void asm sideeffect inteldialect "mov rax,$1\0A\09mov rbx,[rax]\0A\09mov $0, rbx", "=*m,m,~{rax},~{rbx},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(double) %num, ptr [[THIS1_T2]]) |
| 24 |
mov rbx,[rax] |
| 25 |
mov num, rbx |
| 26 |
}; |
| 27 |
} |
| 28 |
|
| 29 |
// CHECK: define dso_local void @"?runc@t1@@ |
| 30 |
void t1::runc() { |
| 31 |
double num = 0; |
| 32 |
__asm { |
| 33 |
mov rax,[this] |
| 34 |
// CHECK: [[THIS_ADDR_T1:%.+]] = alloca ptr |
| 35 |
// CHECK: [[THIS1_T1:%.+]] = load ptr, ptr [[THIS_ADDR_T1]], |
| 36 |
// CHECK: call void asm sideeffect inteldialect "mov rax,$1{{.*}}ptr [[THIS1_T1]] |
| 37 |
mov rbx,[rax] |
| 38 |
mov num, rbx |
| 39 |
}; |
| 40 |
} |
| 41 |
|
| 42 |
struct s { |
| 43 |
int a; |
| 44 |
// CHECK: define linkonce_odr dso_local void @"?func@s@@ |
| 45 |
void func() { |
| 46 |
__asm mov rax, [this] |
| 47 |
// CHECK: [[THIS_ADDR_S:%.+]] = alloca ptr |
| 48 |
// CHECK: [[THIS1_S:%.+]] = load ptr, ptr [[THIS_ADDR_S]], |
| 49 |
// CHECK: call void asm sideeffect inteldialect "mov rax, $0{{.*}}ptr [[THIS1_S]] |
| 50 |
} |
| 51 |
} f3; |
| 52 |
|
| 53 |
int main() { |
| 54 |
f3.func(); |
| 55 |
f3.a=1; |
| 56 |
return 0; |
| 57 |
} |