[AArch64] [MinGW] Allow enabling SEH exceptions
[llvm-core.git] / test / CodeGen / AArch64 / wineh-mingw.ll
blobae26b06cfa3857d7c513ddac3a28a12fd5aa21df
1 ; RUN: llc < %s -exception-model=wineh -mtriple=aarch64-pc-mingw32 | FileCheck %s -check-prefix=WINEH
2 ; RUN: llc < %s -exception-model=wineh -mtriple=aarch64-pc-mingw32 -filetype=obj | llvm-readobj -s | FileCheck %s -check-prefix=WINEH-SECTIONS
4 ; Check emission of eh handler and handler data
5 declare i32 @_d_eh_personality(i32, i32, i64, i8*, i8*)
6 declare void @_d_eh_resume_unwind(i8*)
8 declare i32 @bar()
10 define i32 @foo4() #0 personality i32 (i32, i32, i64, i8*, i8*)* @_d_eh_personality {
11 entry:
12   %step = alloca i32, align 4
13   store i32 0, i32* %step
14   %tmp = load i32, i32* %step
16   %tmp1 = invoke i32 @bar()
17           to label %finally unwind label %landingpad
19 finally:
20   store i32 1, i32* %step
21   br label %endtryfinally
23 landingpad:
24   %landing_pad = landingpad { i8*, i32 }
25           cleanup
26   %tmp3 = extractvalue { i8*, i32 } %landing_pad, 0
27   store i32 2, i32* %step
28   call void @_d_eh_resume_unwind(i8* %tmp3)
29   unreachable
31 endtryfinally:
32   %tmp10 = load i32, i32* %step
33   ret i32 %tmp10
35 ; WINEH-LABEL: foo4:
36 ; WINEH: .seh_proc foo4
37 ; WINEH: .seh_handler _d_eh_personality, @unwind, @except
38 ; WINEH: ret
39 ; WINEH: .section .xdata,"dr"
40 ; WINEH-NEXT: .seh_handlerdata
41 ; WINEH-NEXT: .text
42 ; WINEH-NEXT: .seh_endproc
43 ; WINEH: .section .xdata,"dr"
44 ; WINEH-NEXT: .p2align 2
45 ; WINEH-NEXT: GCC_except_table0:
47 ; WINEH-SECTIONS: Name: .xdata
48 ; WINEH-SECTIONS-NOT: Name: .gcc_except_table