1 ; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
3 @str = linkonce_odr unnamed_addr constant [27 x i8] c"GetExceptionCode(): 0x%lx\0A\00", align 1
5 declare i32 @llvm.eh.exceptioncode(token)
6 declare i32 @__C_specific_handler(...)
8 declare i32 @printf(i8* nocapture readonly, ...) nounwind
10 define i32 @main() personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
13 to label %__try.cont unwind label %lpad
19 %cs1 = catchswitch within none [label %catchall] unwind to caller
22 %p = catchpad within %cs1 [i8* null, i32 64, i8* null]
23 %code = call i32 @llvm.eh.exceptioncode(token %p)
24 call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0), i32 %code) [ "funclet"(token %p) ]
25 catchret from %p to label %__try.cont
28 ; Check that we can get the exception code from eax to the printf.
33 ; CHECK: .LBB0_2: # %catchall
34 ; CHECK: leaq str(%rip), %rcx
35 ; CHECK: movl %eax, %edx
38 ; CHECK: .seh_handlerdata
39 ; CHECK-NEXT: .Lmain$parent_frame_offset
40 ; CHECK-NEXT: .long (.Llsda_end0-.Llsda_begin0)/16
41 ; CHECK-NEXT: .Llsda_begin0:
42 ; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL
43 ; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL+1
45 ; CHECK-NEXT: .long .LBB0_2@IMGREL
46 ; CHECK-NEXT: .Llsda_end0: