• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs < %s | FileCheck %s
2
3; We should store -2 into UnwindHelp in a slot immediately after the last XMM
4; CSR save.
5
6declare void @g()
7declare i32 @__CxxFrameHandler3(...)
8
9@fp_global = global double 0.0
10
11define void @f() personality i32 (...)* @__CxxFrameHandler3 {
12  %v = load double, double* @fp_global
13  call void @g()
14  %v1 = fadd double %v, 1.0
15  store double %v1, double* @fp_global
16  invoke void @g()
17      to label %return unwind label %catch.dispatch
18
19return:
20  ret void
21
22catch.dispatch:
23  %cs1 = catchswitch within none [label %catch] unwind to caller
24
25catch:
26  %p = catchpad within %cs1 [i8* null, i32 64, i8* null]
27  catchret from %p to label %return
28}
29
30; CHECK: f: # @f
31; CHECK: pushq   %rbp
32; CHECK: .seh_pushreg %rbp
33; CHECK: subq    $64, %rsp
34; CHECK: .seh_stackalloc 64
35; CHECK: leaq    64(%rsp), %rbp
36; CHECK: .seh_setframe %rbp, 64
37; CHECK: movaps  %xmm6, -16(%rbp)        # 16-byte Spill
38; CHECK: .seh_savexmm %xmm6, 48
39; CHECK: .seh_endprologue
40; CHECK: movq    $-2, -24(%rbp)
41; CHECK: movsd   fp_global(%rip), %xmm6  # xmm6 = mem[0],zero
42; CHECK: callq   g
43; CHECK: addsd   __real@3ff0000000000000(%rip), %xmm6
44; CHECK: movsd   %xmm6, fp_global(%rip)
45; CHECK: .Ltmp{{.*}}
46; CHECK: callq   g
47; CHECK: .Ltmp{{.*}}
48; CHECK: .LBB{{.*}} # Block address taken
49; CHECK: movaps  -16(%rbp), %xmm6
50; CHECK: addq    $64, %rsp
51; CHECK: popq    %rbp
52; CHECK: retq
53; CHECK: .seh_handlerdata
54; CHECK: # %catch
55; CHECK: movq    %rdx, 16(%rsp)
56; CHECK: pushq   %rbp
57; CHECK: .seh_pushreg %rbp
58; CHECK: subq    $48, %rsp
59; CHECK: .seh_stackalloc 48
60; CHECK: leaq    64(%rdx), %rbp
61; CHECK: movapd  %xmm6, 32(%rsp)
62; CHECK: .seh_savexmm %xmm6, 32
63; CHECK: .seh_endprologue
64; CHECK: movapd  32(%rsp), %xmm6
65; CHECK: leaq    .LBB0_1(%rip), %rax
66; CHECK: addq    $48, %rsp
67; CHECK: popq    %rbp
68; CHECK: retq # CATCHRET
69