[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / CodeGen / X86 / win-funclet-cfi.ll
blobf9a1e2f0d2880ddfb42c95ead0c24dce86eb1f43
1 ; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
3 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-windows-msvc"
6 define void @"\01?f@@YAXXZ"(i1 %B) personality ptr @__CxxFrameHandler3 {
7 entry:
8   invoke void @g()
9           to label %unreachable unwind label %cleanupblock
11 cleanupblock:
12   %cleanp = cleanuppad within none []
13   call void @g() [ "funclet"(token %cleanp) ]
14   cleanupret from %cleanp unwind label %catch.dispatch
16 catch.dispatch:
17   %cs1 = catchswitch within none [label %catch] unwind to caller
19 catch:
20   %cp = catchpad within %cs1 [ptr null, i32 64, ptr null]
21   call void @g() [ "funclet"(token %cp) ]
22   catchret from %cp to label %try.cont
24 try.cont:
25   ret void
27 unreachable:
28   unreachable
32 declare void @g()
34 declare i32 @__CxxFrameHandler3(...)
36 ; Destructors need CFI but they shouldn't use the .seh_handler directive.
37 ; CHECK: "?dtor$[[cleanup:[0-9]+]]@?0??f@@YAXXZ@4HA":
38 ; CHECK: .seh_proc "?dtor$[[cleanup]]@?0??f@@YAXXZ@4HA"
39 ; CHECK-NOT: .seh_handler __CxxFrameHandler3
40 ; CHECK: LBB0_[[cleanup]]: # %cleanupblock{{$}}
42 ; Emit CFI for pushing RBP.
43 ; CHECK: movq    %rdx, 16(%rsp)
44 ; CHECK: pushq   %rbp
45 ; CHECK: .seh_pushreg %rbp
47 ; Emit CFI for allocating from the stack pointer.
48 ; CHECK: subq    $32, %rsp
49 ; CHECK: .seh_stackalloc 32
51 ; CHECK: leaq    48(%rdx), %rbp
52 ; CHECK-NOT: .seh_setframe
54 ; Prologue is done, emit the .seh_endprologue directive.
55 ; CHECK: .seh_endprologue
57 ; Make sure there is a nop after a call if the call precedes the epilogue.
58 ; CHECK: callq g
59 ; CHECK-NEXT: nop
60 ; CHECK-NEXT: .seh_startepilogue
62 ; Don't emit a reference to the LSDA.
63 ; CHECK: .seh_handlerdata
64 ; CHECK-NOT:  .long   ("$cppxdata$?f@@YAXXZ")@IMGREL
65 ; CHECK-NEXT: .text
66 ; CHECK: .seh_endproc
68 ; CHECK: "?catch$[[catch:[0-9]+]]@?0??f@@YAXXZ@4HA":
69 ; CHECK: .seh_proc "?catch$[[catch]]@?0??f@@YAXXZ@4HA"
70 ; CHECK-NEXT: .seh_handler __CxxFrameHandler3, @unwind, @except
71 ; CHECK: LBB0_[[catch]]: # %catch{{$}}
73 ; Emit CFI for pushing RBP.
74 ; CHECK: movq    %rdx, 16(%rsp)
75 ; CHECK: pushq   %rbp
76 ; CHECK: .seh_pushreg %rbp
78 ; Emit CFI for allocating from the stack pointer.
79 ; CHECK: subq    $32, %rsp
80 ; CHECK: .seh_stackalloc 32
82 ; CHECK: leaq    48(%rdx), %rbp
83 ; CHECK-NOT: .seh_setframe
85 ; Prologue is done, emit the .seh_endprologue directive.
86 ; CHECK: .seh_endprologue
88 ; Make sure there is at least one instruction after a call before the epilogue.
89 ; CHECK: callq g
90 ; CHECK-NEXT: leaq    .LBB0_{{[0-9]+}}(%rip), %rax
91 ; CHECK-NEXT: .seh_startepilogue
93 ; Emit a reference to the LSDA.
94 ; CHECK: .seh_handlerdata
95 ; CHECK-NEXT:  .long   ("$cppxdata$?f@@YAXXZ")@IMGREL
96 ; CHECK-NEXT: .text
97 ; CHECK: .seh_endproc