[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / ms-inline-asm-enums.cpp
blob4e9225ab47590eaa6fef65cf34753f7a9c54e859
1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 %s -fasm-blocks -triple i386-apple-darwin10 -emit-llvm -o - | FileCheck %s
4 namespace x {
5 enum { A = 12 };
6 struct y_t {
7 enum { A = 17 };
8 int r;
9 } y;
12 // CHECK-LABEL: t1
13 void t1() {
14 enum { A = 1 };
15 // CHECK: call void asm
16 // CHECK-SAME: mov eax, $$12
17 __asm mov eax, x::A
18 // CHECK-SAME: mov eax, $$17
19 __asm mov eax, x::y_t::A
20 // CHECK-NEXT: call void asm
21 // CHECK-SAME: mov eax, $$1
22 __asm {mov eax, A}
25 // CHECK-LABEL: t2
26 void t2() {
27 enum { A = 1, B };
28 // CHECK: call void asm
29 // CHECK-SAME: mov eax, $$21
30 __asm mov eax, (A + 9) * 2 + A
31 // CHECK-SAME: mov eax, $$4
32 __asm mov eax, A << 2
33 // CHECK-SAME: mov eax, $$2
34 __asm mov eax, B & 3
35 // CHECK-SAME: mov eax, $$5
36 __asm mov eax, 3 + (B & 3)
37 // CHECK-SAME: mov eax, $$8
38 __asm mov eax, 2 << A * B
41 // CHECK-LABEL: t3
42 void t3() {
43 int arr[4];
44 enum { A = 4, B };
45 // CHECK: call void asm
46 // CHECK-SAME: mov eax, [eax + $$47]
47 __asm { mov eax, [(x::A + 9) + A * B + 3 + 3 + eax] }
48 // CHECK-NEXT: call void asm
49 // CHECK-SAME: mov eax, dword ptr $0[$$4]
50 __asm { mov eax, dword ptr [arr + A] }
51 // CHECK-NEXT: call void asm
52 // CHECK-SAME: mov eax, dword ptr $0[$$8]
53 __asm { mov eax, dword ptr A[arr + A] }