blob: 0ba152445f1cd6e38951278eab1e9e04864027f7 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6
; RUN: llc -mtriple=x86_64-linux-gnu -stop-after=prolog-epilog -o - %s | FileCheck %s --check-prefix=LINUX
; RUN: llc -mtriple=x86_64-pc-win32-coreclr -stop-after=prolog-epilog -o - %s | FileCheck %s --check-prefix=CORECLR
; The flag clobbers of the inline probe sequences are dead.
define void @large_frame() "probe-stack"="inline-asm" {
; LINUX-LABEL: name: large_frame
; LINUX: bb.0 (%ir-block.0):
; LINUX-NEXT: successors: %bb.1(0x80000000)
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: $r11 = frame-setup COPY $rsp
; LINUX-NEXT: $r11 = frame-setup SUB64ri32 $r11, 36864, implicit-def dead $eflags
; LINUX-NEXT: CFI_INSTRUCTION def_cfa_register $r11
; LINUX-NEXT: CFI_INSTRUCTION adjust_cfa_offset 36864
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.1 (%ir-block.0):
; LINUX-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
; LINUX-NEXT: liveins: $r11
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: $rsp = frame-setup SUB64ri32 $rsp, 4096, implicit-def dead $eflags
; LINUX-NEXT: frame-setup MOV64mi32 $rsp, 1, $noreg, 0, $noreg, 0
; LINUX-NEXT: frame-setup CMP64rr $rsp, $r11, implicit-def $eflags
; LINUX-NEXT: frame-setup JCC_1 %bb.1, 5, implicit $eflags
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.2 (%ir-block.0):
; LINUX-NEXT: $rsp = frame-setup SUB64ri32 $rsp, 3144, implicit-def dead $eflags
; LINUX-NEXT: CFI_INSTRUCTION def_cfa_register $rsp
; LINUX-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 40016
; LINUX-NEXT: renamable $rdi = LEA64r $rsp, 1, $noreg, 8, $noreg
; LINUX-NEXT: CALL64pcrel32 target-flags(x86-plt) @use, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
; LINUX-NEXT: $rsp = frame-destroy ADD64ri32 $rsp, 40008, implicit-def dead $eflags
; LINUX-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 8
; LINUX-NEXT: RET 0
;
; CORECLR-LABEL: name: large_frame
; CORECLR: bb.0 (%ir-block.0):
; CORECLR-NEXT: successors: %bb.3(0x40000000), %bb.1(0x40000000)
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: $rax = frame-setup MOV32ri64 40040
; CORECLR-NEXT: $rcx = frame-setup XOR64rr undef $rcx, undef $rcx, implicit-def dead $eflags
; CORECLR-NEXT: $rdx = frame-setup MOV64rr $rsp
; CORECLR-NEXT: $rdx = frame-setup SUB64rr $rdx, $rax, implicit-def $eflags
; CORECLR-NEXT: $rdx = frame-setup CMOV64rr $rdx, $rcx, 2, implicit $eflags
; CORECLR-NEXT: $rcx = frame-setup MOV64rm $noreg, 1, $noreg, 16, $gs
; CORECLR-NEXT: frame-setup CMP64rr $rdx, $rcx, implicit-def $eflags
; CORECLR-NEXT: frame-setup JCC_1 %bb.3, 3, implicit $eflags
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: bb.1 (%ir-block.0):
; CORECLR-NEXT: successors: %bb.2(0x80000000)
; CORECLR-NEXT: liveins: $rdx
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: $rdx = frame-setup AND64ri32 $rdx, -4096, implicit-def dead $eflags
; CORECLR-NEXT: frame-setup JMP_1 %bb.2
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: bb.2 (%ir-block.0):
; CORECLR-NEXT: successors: %bb.3(0x40000000), %bb.2(0x40000000)
; CORECLR-NEXT: liveins: $rcx, $rdx
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: $rcx = frame-setup LEA64r $rcx, 1, $noreg, -4096, $noreg
; CORECLR-NEXT: frame-setup MOV8mi $rcx, 1, $noreg, 0, $noreg, 0
; CORECLR-NEXT: frame-setup CMP64rr $rdx, $rcx, implicit-def $eflags
; CORECLR-NEXT: frame-setup JCC_1 %bb.2, 5, implicit $eflags
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: bb.3 (%ir-block.0):
; CORECLR-NEXT: liveins: $rax
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: $rsp = frame-setup SUB64rr $rsp, $rax, implicit-def dead $eflags
; CORECLR-NEXT: frame-setup SEH_StackAlloc 40040
; CORECLR-NEXT: frame-setup SEH_EndPrologue
; CORECLR-NEXT: renamable $rcx = LEA64r $rsp, 1, $noreg, 40, $noreg
; CORECLR-NEXT: CALL64pcrel32 @use, csr_win64, implicit $rsp, implicit $ssp, implicit $rcx, implicit-def $rsp, implicit-def $ssp
; CORECLR-NEXT: SEH_BeginEpilogue
; CORECLR-NEXT: $rsp = frame-destroy ADD64ri32 $rsp, 40040, implicit-def dead $eflags
; CORECLR-NEXT: SEH_EndEpilogue
; CORECLR-NEXT: RET 0
%a = alloca [40000 x i8]
call void @use(ptr %a)
ret void
}
define void @large_frame_align() "probe-stack"="inline-asm" {
; LINUX-LABEL: name: large_frame_align
; LINUX: bb.1 (%ir-block.0):
; LINUX-NEXT: successors: %bb.2(0x40000000), %bb.0(0x40000000)
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
; LINUX-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
; LINUX-NEXT: frame-setup CFI_INSTRUCTION offset $rbp, -16
; LINUX-NEXT: $rbp = frame-setup MOV64rr $rsp
; LINUX-NEXT: frame-setup CFI_INSTRUCTION def_cfa_register $rbp
; LINUX-NEXT: $r11 = frame-setup COPY $rsp
; LINUX-NEXT: $r11 = frame-setup AND64ri32 $r11, -4096, implicit-def dead $eflags
; LINUX-NEXT: frame-setup CMP64rr $r11, $rsp, implicit-def $eflags
; LINUX-NEXT: frame-setup JCC_1 %bb.0, 4, implicit $eflags
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.2 (%ir-block.0):
; LINUX-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000)
; LINUX-NEXT: liveins: $r11
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: $rsp = frame-setup SUB64ri32 $rsp, 4096, implicit-def dead $eflags
; LINUX-NEXT: frame-setup CMP64rr $rsp, $r11, implicit-def $eflags
; LINUX-NEXT: frame-setup JCC_1 %bb.4, 2, implicit $eflags
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.3 (%ir-block.0):
; LINUX-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000)
; LINUX-NEXT: liveins: $r11
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: frame-setup MOV64mi32 $rsp, 1, $noreg, 0, $noreg, 0
; LINUX-NEXT: $rsp = frame-setup SUB64ri32 $rsp, 4096, implicit-def dead $eflags
; LINUX-NEXT: frame-setup CMP64rr $r11, $rsp, implicit-def $eflags
; LINUX-NEXT: frame-setup JCC_1 %bb.3, 2, implicit $eflags
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.4 (%ir-block.0):
; LINUX-NEXT: successors: %bb.0(0x80000000)
; LINUX-NEXT: liveins: $r11
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: $rsp = frame-setup COPY $r11
; LINUX-NEXT: frame-setup MOV64mi32 $rsp, 1, $noreg, 0, $noreg, 0
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.0 (%ir-block.0):
; LINUX-NEXT: successors: %bb.5(0x80000000)
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: $r11 = frame-setup COPY $rsp
; LINUX-NEXT: $r11 = frame-setup SUB64ri32 $r11, 40960, implicit-def dead $eflags
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.5 (%ir-block.0):
; LINUX-NEXT: successors: %bb.5(0x40000000), %bb.6(0x40000000)
; LINUX-NEXT: liveins: $r11
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: $rsp = frame-setup SUB64ri32 $rsp, 4096, implicit-def dead $eflags
; LINUX-NEXT: frame-setup MOV64mi32 $rsp, 1, $noreg, 0, $noreg, 0
; LINUX-NEXT: frame-setup CMP64rr $rsp, $r11, implicit-def $eflags
; LINUX-NEXT: frame-setup JCC_1 %bb.5, 5, implicit $eflags
; LINUX-NEXT: {{ $}}
; LINUX-NEXT: bb.6 (%ir-block.0):
; LINUX-NEXT: $rdi = MOV64rr $rsp
; LINUX-NEXT: CALL64pcrel32 target-flags(x86-plt) @use, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
; LINUX-NEXT: $rsp = MOV64rr $rbp
; LINUX-NEXT: $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
; LINUX-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $rsp, 8
; LINUX-NEXT: RET 0
;
; CORECLR-LABEL: name: large_frame_align
; CORECLR: bb.0 (%ir-block.0):
; CORECLR-NEXT: successors: %bb.3(0x40000000), %bb.1(0x40000000)
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
; CORECLR-NEXT: frame-setup SEH_PushReg 52
; CORECLR-NEXT: $rax = frame-setup MOV32ri64 45040
; CORECLR-NEXT: $rcx = frame-setup XOR64rr undef $rcx, undef $rcx, implicit-def dead $eflags
; CORECLR-NEXT: $rdx = frame-setup MOV64rr $rsp
; CORECLR-NEXT: $rdx = frame-setup SUB64rr $rdx, $rax, implicit-def $eflags
; CORECLR-NEXT: $rdx = frame-setup CMOV64rr $rdx, $rcx, 2, implicit $eflags
; CORECLR-NEXT: $rcx = frame-setup MOV64rm $noreg, 1, $noreg, 16, $gs
; CORECLR-NEXT: frame-setup CMP64rr $rdx, $rcx, implicit-def $eflags
; CORECLR-NEXT: frame-setup JCC_1 %bb.3, 3, implicit $eflags
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: bb.1 (%ir-block.0):
; CORECLR-NEXT: successors: %bb.2(0x80000000)
; CORECLR-NEXT: liveins: $rdx
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: $rdx = frame-setup AND64ri32 $rdx, -4096, implicit-def dead $eflags
; CORECLR-NEXT: frame-setup JMP_1 %bb.2
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: bb.2 (%ir-block.0):
; CORECLR-NEXT: successors: %bb.3(0x40000000), %bb.2(0x40000000)
; CORECLR-NEXT: liveins: $rcx, $rdx
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: $rcx = frame-setup LEA64r $rcx, 1, $noreg, -4096, $noreg
; CORECLR-NEXT: frame-setup MOV8mi $rcx, 1, $noreg, 0, $noreg, 0
; CORECLR-NEXT: frame-setup CMP64rr $rdx, $rcx, implicit-def $eflags
; CORECLR-NEXT: frame-setup JCC_1 %bb.2, 5, implicit $eflags
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: bb.3 (%ir-block.0):
; CORECLR-NEXT: liveins: $rax
; CORECLR-NEXT: {{ $}}
; CORECLR-NEXT: $rsp = frame-setup SUB64rr $rsp, $rax, implicit-def dead $eflags
; CORECLR-NEXT: frame-setup SEH_StackAlloc 45040
; CORECLR-NEXT: $rbp = LEA64r $rsp, 1, $noreg, 128, $noreg
; CORECLR-NEXT: frame-setup SEH_SetFrame 52, 128
; CORECLR-NEXT: frame-setup SEH_EndPrologue
; CORECLR-NEXT: $rsp = frame-setup AND64ri32 $rsp, -4096, implicit-def dead $eflags
; CORECLR-NEXT: renamable $rcx = LEA64r $rsp, 1, $noreg, 4096, $noreg
; CORECLR-NEXT: CALL64pcrel32 @use, csr_win64, implicit $rsp, implicit $ssp, implicit $rcx, implicit-def $rsp, implicit-def $ssp
; CORECLR-NEXT: SEH_BeginEpilogue
; CORECLR-NEXT: $rsp = LEA64r $rbp, 1, $noreg, 44912, $noreg
; CORECLR-NEXT: $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
; CORECLR-NEXT: SEH_EndEpilogue
; CORECLR-NEXT: RET 0
%a = alloca [40000 x i8], align 4096
call void @use(ptr %a)
ret void
}
declare void @use(ptr)