annotate clang/test/CodeGen/ms-inline-asm-enums.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // REQUIRES: x86-registered-target
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 %s -fasm-blocks -triple i386-apple-darwin10 -emit-llvm -o - | FileCheck %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 namespace x {
anatofuz
parents:
diff changeset
5 enum { A = 12 };
anatofuz
parents:
diff changeset
6 struct y_t {
anatofuz
parents:
diff changeset
7 enum { A = 17 };
anatofuz
parents:
diff changeset
8 int r;
anatofuz
parents:
diff changeset
9 } y;
anatofuz
parents:
diff changeset
10 }
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 // CHECK-LABEL: t1
anatofuz
parents:
diff changeset
13 void t1() {
anatofuz
parents:
diff changeset
14 enum { A = 1 };
anatofuz
parents:
diff changeset
15 // CHECK: call void asm
anatofuz
parents:
diff changeset
16 // CHECK-SAME: mov eax, $$12
anatofuz
parents:
diff changeset
17 __asm mov eax, x::A
anatofuz
parents:
diff changeset
18 // CHECK-SAME: mov eax, $$17
anatofuz
parents:
diff changeset
19 __asm mov eax, x::y_t::A
anatofuz
parents:
diff changeset
20 // CHECK-NEXT: call void asm
anatofuz
parents:
diff changeset
21 // CHECK-SAME: mov eax, $$1
anatofuz
parents:
diff changeset
22 __asm {mov eax, A}
anatofuz
parents:
diff changeset
23 }
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 // CHECK-LABEL: t2
anatofuz
parents:
diff changeset
26 void t2() {
anatofuz
parents:
diff changeset
27 enum { A = 1, B };
anatofuz
parents:
diff changeset
28 // CHECK: call void asm
anatofuz
parents:
diff changeset
29 // CHECK-SAME: mov eax, $$21
anatofuz
parents:
diff changeset
30 __asm mov eax, (A + 9) * 2 + A
anatofuz
parents:
diff changeset
31 // CHECK-SAME: mov eax, $$4
anatofuz
parents:
diff changeset
32 __asm mov eax, A << 2
anatofuz
parents:
diff changeset
33 // CHECK-SAME: mov eax, $$2
anatofuz
parents:
diff changeset
34 __asm mov eax, B & 3
anatofuz
parents:
diff changeset
35 // CHECK-SAME: mov eax, $$5
anatofuz
parents:
diff changeset
36 __asm mov eax, 3 + (B & 3)
anatofuz
parents:
diff changeset
37 // CHECK-SAME: mov eax, $$8
anatofuz
parents:
diff changeset
38 __asm mov eax, 2 << A * B
anatofuz
parents:
diff changeset
39 }
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 // CHECK-LABEL: t3
anatofuz
parents:
diff changeset
42 void t3() {
anatofuz
parents:
diff changeset
43 int arr[4];
anatofuz
parents:
diff changeset
44 enum { A = 4, B };
anatofuz
parents:
diff changeset
45 // CHECK: call void asm
anatofuz
parents:
diff changeset
46 // CHECK-SAME: mov eax, [eax + $$47]
anatofuz
parents:
diff changeset
47 __asm { mov eax, [(x::A + 9) + A * B + 3 + 3 + eax] }
anatofuz
parents:
diff changeset
48 // CHECK-NEXT: call void asm
anatofuz
parents:
diff changeset
49 // CHECK-SAME: mov eax, dword ptr $0[$$4]
anatofuz
parents:
diff changeset
50 __asm { mov eax, dword ptr [arr + A] }
anatofuz
parents:
diff changeset
51 // CHECK-NEXT: call void asm
anatofuz
parents:
diff changeset
52 // CHECK-SAME: mov eax, dword ptr $0[$$8]
anatofuz
parents:
diff changeset
53 __asm { mov eax, dword ptr A[arr + A] }
anatofuz
parents:
diff changeset
54 }
anatofuz
parents:
diff changeset
55