2015-02-24 08:11:32 +08:00
|
|
|
; RUN: llc < %s -O0 -mattr=sse2 -mtriple=x86_64-pc-windows-itanium | FileCheck %s -check-prefix=WIN64 -check-prefix=NORM
|
|
|
|
; RUN: llc < %s -O0 -mattr=sse2 -mtriple=x86_64-pc-mingw32 | FileCheck %s -check-prefix=WIN64 -check-prefix=NORM
|
|
|
|
; RUN: llc < %s -O0 -mattr=sse2 -mtriple=x86_64-pc-mingw32 -mcpu=atom | FileCheck %s -check-prefix=WIN64 -check-prefix=ATOM
|
2014-06-25 20:41:52 +08:00
|
|
|
|
|
|
|
; Check function without prolog
|
|
|
|
define void @foo0() uwtable {
|
|
|
|
entry:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
; WIN64-LABEL: foo0:
|
2016-09-23 03:50:05 +08:00
|
|
|
; WIN64-NOT: .seh_proc foo0
|
|
|
|
; WIN64-NOT: .seh_endprologue
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: ret
|
2016-09-23 03:50:05 +08:00
|
|
|
; WIN64-NOT: .seh_endproc
|
2014-06-25 20:41:52 +08:00
|
|
|
|
|
|
|
; Checks a small stack allocation
|
|
|
|
define void @foo1() uwtable {
|
|
|
|
entry:
|
|
|
|
%baz = alloca [2000 x i16], align 2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
; WIN64-LABEL: foo1:
|
|
|
|
; WIN64: .seh_proc foo1
|
2015-02-24 08:11:32 +08:00
|
|
|
; NORM: subq $4000, %rsp
|
|
|
|
; ATOM: leaq -4000(%rsp), %rsp
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: .seh_stackalloc 4000
|
|
|
|
; WIN64: .seh_endprologue
|
|
|
|
; WIN64: addq $4000, %rsp
|
|
|
|
; WIN64: ret
|
|
|
|
; WIN64: .seh_endproc
|
|
|
|
|
|
|
|
; Checks a stack allocation requiring call to __chkstk/___chkstk_ms
|
|
|
|
define void @foo2() uwtable {
|
|
|
|
entry:
|
|
|
|
%baz = alloca [4000 x i16], align 2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
; WIN64-LABEL: foo2:
|
|
|
|
; WIN64: .seh_proc foo2
|
2015-02-24 05:50:30 +08:00
|
|
|
; WIN64: movl $8000, %eax
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: callq {{__chkstk|___chkstk_ms}}
|
|
|
|
; WIN64: subq %rax, %rsp
|
|
|
|
; WIN64: .seh_stackalloc 8000
|
|
|
|
; WIN64: .seh_endprologue
|
|
|
|
; WIN64: addq $8000, %rsp
|
|
|
|
; WIN64: ret
|
|
|
|
; WIN64: .seh_endproc
|
|
|
|
|
|
|
|
|
|
|
|
define i32 @foo3(i32 %f_arg, i32 %e_arg, i32 %d_arg, i32 %c_arg, i32 %b_arg, i32 %a_arg) uwtable {
|
|
|
|
entry:
|
|
|
|
%a = alloca i32
|
|
|
|
%b = alloca i32
|
|
|
|
%c = alloca i32
|
|
|
|
%d = alloca i32
|
|
|
|
%e = alloca i32
|
|
|
|
%f = alloca i32
|
|
|
|
store i32 %a_arg, i32* %a
|
|
|
|
store i32 %b_arg, i32* %b
|
|
|
|
store i32 %c_arg, i32* %c
|
|
|
|
store i32 %d_arg, i32* %d
|
|
|
|
store i32 %e_arg, i32* %e
|
|
|
|
store i32 %f_arg, i32* %f
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* %a
|
2014-06-25 20:41:52 +08:00
|
|
|
%tmp1 = mul i32 %tmp, 2
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp2 = load i32, i32* %b
|
2014-06-25 20:41:52 +08:00
|
|
|
%tmp3 = mul i32 %tmp2, 3
|
|
|
|
%tmp4 = add i32 %tmp1, %tmp3
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp5 = load i32, i32* %c
|
2014-06-25 20:41:52 +08:00
|
|
|
%tmp6 = mul i32 %tmp5, 5
|
|
|
|
%tmp7 = add i32 %tmp4, %tmp6
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp8 = load i32, i32* %d
|
2014-06-25 20:41:52 +08:00
|
|
|
%tmp9 = mul i32 %tmp8, 7
|
|
|
|
%tmp10 = add i32 %tmp7, %tmp9
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp11 = load i32, i32* %e
|
2014-06-25 20:41:52 +08:00
|
|
|
%tmp12 = mul i32 %tmp11, 11
|
|
|
|
%tmp13 = add i32 %tmp10, %tmp12
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp14 = load i32, i32* %f
|
2014-06-25 20:41:52 +08:00
|
|
|
%tmp15 = mul i32 %tmp14, 13
|
|
|
|
%tmp16 = add i32 %tmp13, %tmp15
|
|
|
|
ret i32 %tmp16
|
|
|
|
}
|
|
|
|
; WIN64-LABEL: foo3:
|
|
|
|
; WIN64: .seh_proc foo3
|
2020-09-22 17:20:10 +08:00
|
|
|
; NORM: subq $24, %rsp
|
|
|
|
; ATOM: leaq -24(%rsp), %rsp
|
|
|
|
; WIN64: .seh_stackalloc 24
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: .seh_endprologue
|
2020-09-22 17:20:10 +08:00
|
|
|
; WIN64: addq $24, %rsp
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: ret
|
|
|
|
; WIN64: .seh_endproc
|
|
|
|
|
|
|
|
|
|
|
|
; Check emission of eh handler and handler data
|
|
|
|
declare i32 @_d_eh_personality(i32, i32, i64, i8*, i8*)
|
|
|
|
declare void @_d_eh_resume_unwind(i8*)
|
|
|
|
|
|
|
|
declare i32 @bar()
|
|
|
|
|
2015-06-18 04:52:32 +08:00
|
|
|
define i32 @foo4() #0 personality i32 (i32, i32, i64, i8*, i8*)* @_d_eh_personality {
|
2014-06-25 20:41:52 +08:00
|
|
|
entry:
|
|
|
|
%step = alloca i32, align 4
|
|
|
|
store i32 0, i32* %step
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* %step
|
2014-06-25 20:41:52 +08:00
|
|
|
|
|
|
|
%tmp1 = invoke i32 @bar()
|
|
|
|
to label %finally unwind label %landingpad
|
|
|
|
|
|
|
|
finally:
|
|
|
|
store i32 1, i32* %step
|
|
|
|
br label %endtryfinally
|
|
|
|
|
|
|
|
landingpad:
|
2015-06-18 04:52:32 +08:00
|
|
|
%landing_pad = landingpad { i8*, i32 }
|
2014-06-25 20:41:52 +08:00
|
|
|
cleanup
|
|
|
|
%tmp3 = extractvalue { i8*, i32 } %landing_pad, 0
|
|
|
|
store i32 2, i32* %step
|
|
|
|
call void @_d_eh_resume_unwind(i8* %tmp3)
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
endtryfinally:
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp10 = load i32, i32* %step
|
2014-06-25 20:41:52 +08:00
|
|
|
ret i32 %tmp10
|
|
|
|
}
|
|
|
|
; WIN64-LABEL: foo4:
|
|
|
|
; WIN64: .seh_proc foo4
|
|
|
|
; WIN64: .seh_handler _d_eh_personality, @unwind, @except
|
2019-09-10 07:04:25 +08:00
|
|
|
; NORM: subq $40, %rsp
|
|
|
|
; ATOM: leaq -40(%rsp), %rsp
|
|
|
|
; WIN64: .seh_stackalloc 40
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: .seh_endprologue
|
2019-09-10 07:04:25 +08:00
|
|
|
; WIN64: addq $40, %rsp
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: ret
|
|
|
|
; WIN64: .seh_handlerdata
|
|
|
|
; WIN64: .seh_endproc
|
|
|
|
|
|
|
|
|
|
|
|
; Check stack re-alignment and xmm spilling
|
|
|
|
define void @foo5() uwtable {
|
|
|
|
entry:
|
|
|
|
%s = alloca i32, align 64
|
|
|
|
call void asm sideeffect "", "~{rbx},~{rdi},~{xmm6},~{xmm7}"()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
; WIN64-LABEL: foo5:
|
|
|
|
; WIN64: .seh_proc foo5
|
|
|
|
; WIN64: pushq %rbp
|
2019-08-31 05:23:05 +08:00
|
|
|
; WIN64: .seh_pushreg %rbp
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: pushq %rdi
|
2019-08-31 05:23:05 +08:00
|
|
|
; WIN64: .seh_pushreg %rdi
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: pushq %rbx
|
2019-08-31 05:23:05 +08:00
|
|
|
; WIN64: .seh_pushreg %rbx
|
2015-02-24 08:11:32 +08:00
|
|
|
; NORM: subq $96, %rsp
|
|
|
|
; ATOM: leaq -96(%rsp), %rsp
|
2015-02-21 09:04:47 +08:00
|
|
|
; WIN64: .seh_stackalloc 96
|
|
|
|
; WIN64: leaq 96(%rsp), %rbp
|
2019-08-31 05:23:05 +08:00
|
|
|
; WIN64: .seh_setframe %rbp, 96
|
2015-02-21 09:04:47 +08:00
|
|
|
; WIN64: movaps %xmm7, -16(%rbp) # 16-byte Spill
|
2019-08-31 05:23:05 +08:00
|
|
|
; WIN64: .seh_savexmm %xmm7, 80
|
2015-02-21 09:04:47 +08:00
|
|
|
; WIN64: movaps %xmm6, -32(%rbp) # 16-byte Spill
|
2019-08-31 05:23:05 +08:00
|
|
|
; WIN64: .seh_savexmm %xmm6, 64
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: .seh_endprologue
|
2015-02-10 08:57:42 +08:00
|
|
|
; WIN64: andq $-64, %rsp
|
2015-02-21 09:04:47 +08:00
|
|
|
; WIN64: movaps -32(%rbp), %xmm6 # 16-byte Reload
|
|
|
|
; WIN64: movaps -16(%rbp), %xmm7 # 16-byte Reload
|
2015-02-26 05:13:37 +08:00
|
|
|
; WIN64: movq %rbp, %rsp
|
2014-06-25 20:41:52 +08:00
|
|
|
; WIN64: popq %rbx
|
|
|
|
; WIN64: popq %rdi
|
|
|
|
; WIN64: popq %rbp
|
|
|
|
; WIN64: retq
|
|
|
|
; WIN64: .seh_endproc
|