[MIPS GlobalISel] Select MSA vector generic and builtin add
[llvm-core.git] / test / CodeGen / AArch64 / seh_funclet_x1.ll
blob8f2a4dade30909d1d0b4cda3fc84b78b29a2a059
1 ; RUN: llc -o - %s -verify-machineinstrs -mtriple=aarch64-windows | FileCheck %s
3 ; Windows runtime passes the establisher frame as the second argument to the
4 ; termination handler.  Check that we copy it into fp.
6 ; CHECK:      ?dtor$3@?0?main@4HA":
7 ; CHECK:      .seh_proc "?dtor$3@?0?main@4HA"
8 ; CHECK:      stp     x29, x30, [sp, #-16]!   ; 16-byte Folded Spill
9 ; CHECK-NEXT: mov     x29, x1
11 target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
12 target triple = "aarch64-unknown-windows-msvc19.15.26732"
14 ; Function Attrs: noinline nounwind optnone uwtable
15 define dso_local i32 @main() #0 personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
16 entry:
17   %retval = alloca i32, align 4
18   %Counter = alloca i32, align 4
19   %__exception_code = alloca i32, align 4
20   call void (...) @llvm.localescape(i32* %Counter)
21   store i32 0, i32* %retval, align 4
22   store i32 0, i32* %Counter, align 4
23   %call = invoke i32 bitcast (i32 (...)* @RaiseStatus to i32 (i32)*)(i32 -1073741675) #3
24           to label %invoke.cont unwind label %ehcleanup
26 invoke.cont:                                      ; preds = %entry
27   %0 = call i8* @llvm.localaddress()
28   invoke void @"?fin$0@0@main@@"(i8 0, i8* %0) #3
29           to label %invoke.cont1 unwind label %catch.dispatch
31 invoke.cont1:                                     ; preds = %invoke.cont
32   br label %__try.cont
34 ehcleanup:                                        ; preds = %entry
35   %1 = cleanuppad within none []
36   %2 = call i8* @llvm.localaddress()
37   invoke void @"?fin$0@0@main@@"(i8 1, i8* %2) #3 [ "funclet"(token %1) ]
38           to label %invoke.cont2 unwind label %catch.dispatch
40 invoke.cont2:                                     ; preds = %ehcleanup
41   cleanupret from %1 unwind label %catch.dispatch
43 catch.dispatch:                                   ; preds = %invoke.cont2, %ehcleanup, %invoke.cont
44   %3 = catchswitch within none [label %__except] unwind to caller
46 __except:                                         ; preds = %catch.dispatch
47   %4 = catchpad within %3 [i8* null]
48   catchret from %4 to label %__except3
50 __except3:                                        ; preds = %__except
51   %5 = call i32 @llvm.eh.exceptioncode(token %4)
52   store i32 %5, i32* %__exception_code, align 4
53   %6 = load i32, i32* %Counter, align 4
54   %add = add nsw i32 %6, 5
55   store i32 %add, i32* %Counter, align 4
56   br label %__try.cont
58 __try.cont:                                       ; preds = %__except3, %invoke.cont1
59   %7 = load i32, i32* %retval, align 4
60   ret i32 %7
63 define internal void @"?fin$0@0@main@@"(i8 %abnormal_termination, i8* %frame_pointer) {
64 entry:
65   %frame_pointer.addr = alloca i8*, align 8
66   %abnormal_termination.addr = alloca i8, align 1
67   %0 = call i8* @llvm.localrecover(i8* bitcast (i32 ()* @main to i8*), i8* %frame_pointer, i32 0)
68   %Counter = bitcast i8* %0 to i32*
69   store i8* %frame_pointer, i8** %frame_pointer.addr, align 8
70   store i8 %abnormal_termination, i8* %abnormal_termination.addr, align 1
71   store i32 3, i32* %Counter, align 4
72   call void @"?fin$1@0@main@@"(i8 0, i8* %frame_pointer)
73   %1 = load i32, i32* %Counter, align 4
74   %add = add nsw i32 %1, 2
75   store i32 %add, i32* %Counter, align 4
76   %call = call i32 bitcast (i32 (...)* @RaiseStatus to i32 (i32)*)(i32 -1073741675)
77   ret void
80 ; Function Attrs: nounwind readnone
81 declare i8* @llvm.localrecover(i8*, i8*, i32) #1
83 define internal void @"?fin$1@0@main@@"(i8 %abnormal_termination, i8* %frame_pointer) {
84 entry:
85   %frame_pointer.addr = alloca i8*, align 8
86   %abnormal_termination.addr = alloca i8, align 1
87   %0 = call i8* @llvm.localrecover(i8* bitcast (i32 ()* @main to i8*), i8* %frame_pointer, i32 0)
88   %Counter = bitcast i8* %0 to i32*
89   store i8* %frame_pointer, i8** %frame_pointer.addr, align 8
90   store i8 %abnormal_termination, i8* %abnormal_termination.addr, align 1
91   %1 = load i32, i32* %Counter, align 4
92   %cmp = icmp eq i32 %1, 3
93   br i1 %cmp, label %if.then, label %if.end
95 if.then:                                          ; preds = %entry
96   %2 = load i32, i32* %Counter, align 4
97   %add = add nsw i32 %2, 1
98   store i32 %add, i32* %Counter, align 4
99   br label %if.end
101 if.end:                                           ; preds = %if.then, %entry
102   ret void
105 declare dso_local i32 @RaiseStatus(...)
107 declare dso_local i32 @__C_specific_handler(...)
109 ; Function Attrs: nounwind readnone
110 declare i8* @llvm.localaddress() #1
112 ; Function Attrs: nounwind readnone
113 declare i32 @llvm.eh.exceptioncode(token) #1
115 ; Function Attrs: nounwind
116 declare void @llvm.localescape(...) #2
118 attributes #0 = { noinline nounwind optnone uwtable }
119 attributes #1 = { nounwind readnone }
120 attributes #2 = { nounwind }
121 attributes #3 = { noinline }