[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / asm-goto.cpp
blob75f907a209b2d053ea2175fe29fb266d69a88c6d
1 // RUN: %clang_analyze_cc1 -triple i386-pc-linux-gnu -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s
2 // RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s
4 int foo(int cond)
6 label_true:
7 asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop);
8 return 0;
9 loop:
10 return 0;
13 // CHECK-LABEL: loop
14 // CHECK-NEXT: 0
15 // CHECK-NEXT: return
16 // CHECK-NEXT: Preds (1): B3
17 // CHECK-NEXT: Succs (1): B0
19 // CHECK-LABEL: label_true
20 // CHECK-NEXT: cond
21 // CHECK-NEXT: [B3.1]
22 // CHECK-NEXT: T: asm goto
23 // CHECK-NEXT: Preds (2): B3 B4
24 // CHECK-NEXT: Succs (3): B2 B3 B1
26 int bar(int cond)
28 asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::L1, L2);
29 return 0;
30 L1:
31 L2:
32 return 0;
35 // CHECK: [B4]
36 // CHECK-NEXT: cond
37 // CHECK-NEXT: [B4.1]
38 // CHECK-NEXT: T: asm goto
39 // CHECK-NEXT: Preds (1): B5
40 // CHECK-NEXT: Succs (3): B3 B2 B1
42 int zoo(int n)
44 A5:
45 A1:
46 asm goto("testl %0, %0; jne %l1;" :: "r"(n)::A1, A2, A3, A4, A5);
47 A2:
48 A3:
49 A4:
50 return 0;
53 // CHECK-LABEL: A1
54 // CHECK-NEXT: n
55 // CHECK-NEXT: [B4.1]
56 // CHECK-NEXT: T: asm goto
57 // CHECK-NEXT: Preds (2): B5 B4
58 // CHECK-NEXT: Succs (5): B3 B4 B2 B1 B5
60 void baz(void)
62 asm goto("" :: "r"(1 ? 2 : 0 << -1) :: error);
63 error:;
66 // CHECK: [B2]
67 // CHECK-NEXT: 1: [B5.2] ? [B3.1] : [B4.4]
68 // CHECK-NEXT: T: asm goto ("" : : "r" ([B2.1]) : : error);
69 // CHECK-NEXT: Preds (2): B3 B4
70 // CHECK-NEXT: Succs (1): B1