reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
; RUN: llc -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs < %s | FileCheck %s

; We should store -2 into UnwindHelp in a slot immediately after the last XMM
; CSR save.

declare void @g()
declare i32 @__CxxFrameHandler3(...)

@fp_global = global double 0.0

define void @f() personality i32 (...)* @__CxxFrameHandler3 {
  %v = load double, double* @fp_global
  call void @g()
  %v1 = fadd double %v, 1.0
  store double %v1, double* @fp_global
  invoke void @g()
      to label %return unwind label %catch.dispatch

return:
  ret void

catch.dispatch:
  %cs1 = catchswitch within none [label %catch] unwind to caller

catch:
  %p = catchpad within %cs1 [i8* null, i32 64, i8* null]
  catchret from %p to label %return
}

; CHECK: f: # @f
; CHECK: pushq   %rbp
; CHECK: .seh_pushreg %rbp
; CHECK: subq    $64, %rsp
; CHECK: .seh_stackalloc 64
; CHECK: leaq    64(%rsp), %rbp
; CHECK: .seh_setframe %rbp, 64
; CHECK: movaps  %xmm6, -16(%rbp)        # 16-byte Spill
; CHECK: .seh_savexmm %xmm6, 48
; CHECK: .seh_endprologue
; CHECK: movq    $-2, -24(%rbp)
; CHECK: movsd   fp_global(%rip), %xmm6  # xmm6 = mem[0],zero
; CHECK: callq   g
; CHECK: addsd   __real@3ff0000000000000(%rip), %xmm6
; CHECK: movsd   %xmm6, fp_global(%rip)
; CHECK: .Ltmp{{.*}}
; CHECK: callq   g
; CHECK: .Ltmp{{.*}}
; CHECK: .LBB{{.*}} # Block address taken
; CHECK: movaps  -16(%rbp), %xmm6
; CHECK: addq    $64, %rsp
; CHECK: popq    %rbp
; CHECK: retq
; CHECK: .seh_handlerdata
; CHECK: # %catch
; CHECK: movq    %rdx, 16(%rsp)
; CHECK: pushq   %rbp
; CHECK: .seh_pushreg %rbp
; CHECK: subq    $48, %rsp
; CHECK: .seh_stackalloc 48
; CHECK: leaq    64(%rdx), %rbp
; CHECK: movapd  %xmm6, 32(%rsp)
; CHECK: .seh_savexmm %xmm6, 32
; CHECK: .seh_endprologue
; CHECK: movapd  32(%rsp), %xmm6
; CHECK: leaq    .LBB0_1(%rip), %rax
; CHECK: addq    $48, %rsp
; CHECK: popq    %rbp
; CHECK: retq # CATCHRET