• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=x86_64-pc-windows-msvc -mattr=+avx < %s | FileCheck %s
2
3; void bar(int a, int b, int c, int d, int e);
4; void baz(int x);
5;
6; void foo(int a, int b, int c, int d, int e)
7; {
8;   __asm("nop" ::: "bx", "cx", "xmm5", "xmm6", "ymm7");
9;   try {
10;     bar(a, b, c, d, e);
11;   }
12;   catch (...) {
13;     baz(a);
14;     if (a)
15;       __asm("nop" ::: "xmm8");
16;   }
17; }
18
19%rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
20
21$"??_R0H@8" = comdat any
22
23@"??_7type_info@@6B@" = external constant i8*
24@"??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
25
26declare dso_local i32 @__CxxFrameHandler3(...)
27declare dso_local void @"?bar@@YAXHHHHH@Z"(i32, i32, i32, i32, i32)
28declare dso_local void @"?baz@@YAXH@Z"(i32)
29
30define dso_local void @"?foo@@YAXHHHHH@Z"(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
31entry:
32  %e.addr = alloca i32, align 4
33  %d.addr = alloca i32, align 4
34  %c.addr = alloca i32, align 4
35  %b.addr = alloca i32, align 4
36  %a.addr = alloca i32, align 4
37  store i32 %e, i32* %e.addr, align 4
38  store i32 %d, i32* %d.addr, align 4
39  store i32 %c, i32* %c.addr, align 4
40  store i32 %b, i32* %b.addr, align 4
41  store i32 %a, i32* %a.addr, align 4
42  call void asm sideeffect "nop", "~{bx},~{cx},~{xmm5},~{xmm6},~{ymm7}"()
43  %0 = load i32, i32* %e.addr, align 4
44  %1 = load i32, i32* %d.addr, align 4
45  %2 = load i32, i32* %c.addr, align 4
46  %3 = load i32, i32* %b.addr, align 4
47  %4 = load i32, i32* %a.addr, align 4
48  invoke void @"?bar@@YAXHHHHH@Z"(i32 %4, i32 %3, i32 %2, i32 %1, i32 %0)
49          to label %invoke.cont unwind label %catch.dispatch
50
51catch.dispatch:                                   ; preds = %entry
52  %5 = catchswitch within none [label %catch] unwind to caller
53
54catch:                                            ; preds = %catch.dispatch
55  %6 = catchpad within %5 [i8* null, i32 64, i8* null]
56  %7 = load i32, i32* %a.addr, align 4
57  call void @"?baz@@YAXH@Z"(i32 %7) [ "funclet"(token %6) ]
58  %8 = load i32, i32* %a.addr, align 4
59  %tobool = icmp ne i32 %8, 0
60  br i1 %tobool, label %if.then, label %if.end
61
62if.then:                                          ; preds = %catch
63  call void asm sideeffect "nop", "~{xmm8}"() [ "funclet"(token %6) ]
64  br label %if.end
65
66invoke.cont:                                      ; preds = %entry
67  br label %try.cont
68
69if.end:                                           ; preds = %if.then, %catch
70  catchret from %6 to label %catchret.dest
71
72catchret.dest:                                    ; preds = %if.end
73  br label %try.cont
74
75try.cont:                                         ; preds = %catchret.dest, %invoke.cont
76  ret void
77}
78
79; CHECK: # %catch
80; CHECK: movq    %rdx, 16(%rsp)
81; CHECK: pushq   %rbp
82; CHECK: .seh_pushreg %rbp
83; CHECK: pushq   %rbx
84; CHECK: .seh_pushreg %rbx
85; CHECK: subq    $88, %rsp
86; CHECK: .seh_stackalloc 88
87; CHECK: leaq    112(%rdx), %rbp
88; CHECK: vmovaps %xmm8, 32(%rsp)
89; CHECK: .seh_savexmm %xmm8, 32
90; CHECK: vmovaps %xmm7, 48(%rsp)
91; CHECK: .seh_savexmm %xmm7, 48
92; CHECK: vmovaps %xmm6, 64(%rsp)
93; CHECK: .seh_savexmm %xmm6, 64
94; CHECK: .seh_endprologue
95; CHECK: movl   -{{[0-9]+}}(%rbp), %ecx
96; CHECK: vmovaps 64(%rsp), %xmm6
97; CHECK: vmovaps 48(%rsp), %xmm7
98; CHECK: vmovaps 32(%rsp), %xmm8
99; CHECK: leaq    .LBB0_1(%rip), %rax
100; CHECK: addq    $88, %rsp
101; CHECK: popq    %rbx
102; CHECK: popq    %rbp
103; CHECK: retq # CATCHRET
104
105; CHECK-LABEL: "$handlerMap$0$?foo@@YAXHHHHH@Z":
106; CHECK-NEXT: .long   64                      # Adjectives
107; CHECK-NEXT: .long   0                       # Type
108; CHECK-NEXT: .long   0                       # CatchObjOffset
109; CHECK-NEXT: .long   "?catch$2@?0??foo@@YAXHHHHH@Z@4HA"@IMGREL # Handler
110; Sum of:
111;   16 RDX store offset
112;   16 two pushes
113;   72 stack alloc
114; CHECK-NEXT: .long   120                     # ParentFrameOffset
115
116