[x86] auto-generate checks; NFC

There's a proposal to change/add to this file in D45653,
so we should know exactly what those differences would be. 

llvm-svn: 330445
This commit is contained in:
Sanjay Patel 2018-04-20 16:46:58 +00:00
parent 773872fd67
commit f04ab64b25
1 changed files with 411 additions and 213 deletions

View File

@ -1,17 +1,20 @@
; RUN: llc < %s -mtriple=i686-linux -mcpu=core2 -mattr=+sse2 -asm-verbose=false | FileCheck %s -check-prefix=32 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-linux -mcpu=core2 -mattr=+sse2 -asm-verbose=false | FileCheck %s -check-prefix=64 ; RUN: llc < %s -mtriple=i686-linux -mcpu=core2 -mattr=+sse2 | FileCheck %s --check-prefix=X32
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -mcpu=core2 -mattr=+sse2 -asm-verbose=false | FileCheck %s -check-prefix=X32ABI ; RUN: llc < %s -mtriple=x86_64-linux -mcpu=core2 -mattr=+sse2 | FileCheck %s --check-prefix=X64
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -mcpu=core2 -mattr=+sse2 | FileCheck %s --check-prefix=X32ABI
define void @t1(i32 %x) nounwind ssp { define void @t1(i32 %x) nounwind ssp {
entry: ; X32-LABEL: t1:
; 32-LABEL: t1: ; X32: # %bb.0:
; 32: jmp {{_?}}foo ; X32-NEXT: jmp foo # TAILCALL
;
; 64-LABEL: t1: ; X64-LABEL: t1:
; 64: jmp {{_?}}foo ; X64: # %bb.0:
; X64-NEXT: jmp foo # TAILCALL
;
; X32ABI-LABEL: t1: ; X32ABI-LABEL: t1:
; X32ABI: jmp {{_?}}foo ; X32ABI: # %bb.0:
; X32ABI-NEXT: jmp foo # TAILCALL
tail call void @foo() nounwind tail call void @foo() nounwind
ret void ret void
} }
@ -19,128 +22,167 @@ entry:
declare void @foo() declare void @foo()
define void @t2() nounwind ssp { define void @t2() nounwind ssp {
entry: ; X32-LABEL: t2:
; 32-LABEL: t2: ; X32: # %bb.0:
; 32: jmp {{_?}}foo2 ; X32-NEXT: jmp foo2 # TAILCALL
;
; 64-LABEL: t2: ; X64-LABEL: t2:
; 64: jmp {{_?}}foo2 ; X64: # %bb.0:
; X64-NEXT: jmp foo2 # TAILCALL
;
; X32ABI-LABEL: t2: ; X32ABI-LABEL: t2:
; X32ABI: jmp {{_?}}foo2 ; X32ABI: # %bb.0:
%0 = tail call i32 @foo2() nounwind ; X32ABI-NEXT: jmp foo2 # TAILCALL
%t0 = tail call i32 @foo2() nounwind
ret void ret void
} }
declare i32 @foo2() declare i32 @foo2()
define void @t3() nounwind ssp { define void @t3() nounwind ssp {
entry: ; X32-LABEL: t3:
; 32-LABEL: t3: ; X32: # %bb.0:
; 32: jmp {{_?}}foo3 ; X32-NEXT: jmp foo3 # TAILCALL
;
; 64-LABEL: t3: ; X64-LABEL: t3:
; 64: jmp {{_?}}foo3 ; X64: # %bb.0:
; X64-NEXT: jmp foo3 # TAILCALL
;
; X32ABI-LABEL: t3: ; X32ABI-LABEL: t3:
; X32ABI: jmp {{_?}}foo3 ; X32ABI: # %bb.0:
%0 = tail call i32 @foo3() nounwind ; X32ABI-NEXT: jmp foo3 # TAILCALL
%t0 = tail call i32 @foo3() nounwind
ret void ret void
} }
declare i32 @foo3() declare i32 @foo3()
define void @t4(void (i32)* nocapture %x) nounwind ssp { define void @t4(void (i32)* nocapture %x) nounwind ssp {
entry: ; X32-LABEL: t4:
; 32-LABEL: t4: ; X32: # %bb.0:
; 32: calll * ; X32-NEXT: subl $12, %esp
; FIXME: gcc can generate a tailcall for this. But it's tricky. ; X32-NEXT: movl $0, (%esp)
; X32-NEXT: calll *{{[0-9]+}}(%esp)
; 64-LABEL: t4: ; X32-NEXT: addl $12, %esp
; 64-NOT: call ; X32-NEXT: retl
; 64: jmpq * ;
; X64-LABEL: t4:
; X64: # %bb.0:
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: xorl %edi, %edi
; X64-NEXT: jmpq *%rax # TAILCALL
;
; X32ABI-LABEL: t4: ; X32ABI-LABEL: t4:
; X32ABI-NOT: call ; X32ABI: # %bb.0:
; X32ABI: jmpq * ; X32ABI-NEXT: movl %edi, %eax
; X32ABI-NEXT: xorl %edi, %edi
; X32ABI-NEXT: jmpq *%rax # TAILCALL
tail call void %x(i32 0) nounwind tail call void %x(i32 0) nounwind
ret void ret void
} }
define void @t5(void ()* nocapture %x) nounwind ssp {
entry:
; 32-LABEL: t5:
; 32-NOT: call
; 32: jmpl *4(%esp)
; 64-LABEL: t5:
; 64-NOT: call
; 64: jmpq *%rdi
; X32ABI-LABEL: t5:
; X32ABI-NOT: call
; FIXME: This isn't needed since x32 psABI specifies that callers must ; FIXME: This isn't needed since x32 psABI specifies that callers must
; zero-extend pointers passed in registers. ; zero-extend pointers passed in registers.
; X32ABI: movl %edi, %eax
; X32ABI: jmpq *%rax define void @t5(void ()* nocapture %x) nounwind ssp {
; X32-LABEL: t5:
; X32: # %bb.0:
; X32-NEXT: jmpl *{{[0-9]+}}(%esp) # TAILCALL
;
; X64-LABEL: t5:
; X64: # %bb.0:
; X64-NEXT: jmpq *%rdi # TAILCALL
;
; X32ABI-LABEL: t5:
; X32ABI: # %bb.0:
; X32ABI-NEXT: movl %edi, %eax
; X32ABI-NEXT: jmpq *%rax # TAILCALL
tail call void %x() nounwind tail call void %x() nounwind
ret void ret void
} }
define i32 @t6(i32 %x) nounwind ssp { define i32 @t6(i32 %x) nounwind ssp {
entry: ; X32-LABEL: t6:
; 32-LABEL: t6: ; X32: # %bb.0:
; 32: calll {{_?}}t6 ; X32-NEXT: subl $12, %esp
; 32: jmp {{_?}}bar ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; X32-NEXT: cmpl $9, %eax
; 64-LABEL: t6: ; X32-NEXT: jg .LBB5_2
; 64: jmp {{_?}}t6 ; X32-NEXT: # %bb.1: # %bb
; 64: jmp {{_?}}bar ; X32-NEXT: decl %eax
; X32-NEXT: movl %eax, (%esp)
; X32-NEXT: calll t6
; X32-NEXT: addl $12, %esp
; X32-NEXT: retl
; X32-NEXT: .LBB5_2: # %bb1
; X32-NEXT: addl $12, %esp
; X32-NEXT: jmp bar # TAILCALL
;
; X64-LABEL: t6:
; X64: # %bb.0:
; X64-NEXT: cmpl $9, %edi
; X64-NEXT: jg .LBB5_2
; X64-NEXT: # %bb.1: # %bb
; X64-NEXT: decl %edi
; X64-NEXT: jmp t6 # TAILCALL
; X64-NEXT: .LBB5_2: # %bb1
; X64-NEXT: jmp bar # TAILCALL
;
; X32ABI-LABEL: t6: ; X32ABI-LABEL: t6:
; X32ABI: jmp {{_?}}t6 ; X32ABI: # %bb.0:
; X32ABI: jmp {{_?}}bar ; X32ABI-NEXT: cmpl $9, %edi
%0 = icmp slt i32 %x, 10 ; X32ABI-NEXT: jg .LBB5_2
br i1 %0, label %bb, label %bb1 ; X32ABI-NEXT: # %bb.1: # %bb
; X32ABI-NEXT: decl %edi
; X32ABI-NEXT: jmp t6 # TAILCALL
; X32ABI-NEXT: .LBB5_2: # %bb1
; X32ABI-NEXT: jmp bar # TAILCALL
%t0 = icmp slt i32 %x, 10
br i1 %t0, label %bb, label %bb1
bb: bb:
%1 = add nsw i32 %x, -1 %t1 = add nsw i32 %x, -1
%2 = tail call i32 @t6(i32 %1) nounwind ssp %t2 = tail call i32 @t6(i32 %t1) nounwind ssp
ret i32 %2 ret i32 %t2
bb1: bb1:
%3 = tail call i32 @bar(i32 %x) nounwind %t3 = tail call i32 @bar(i32 %x) nounwind
ret i32 %3 ret i32 %t3
} }
declare i32 @bar(i32) declare i32 @bar(i32)
define i32 @t7(i32 %a, i32 %b, i32 %c) nounwind ssp { define i32 @t7(i32 %a, i32 %b, i32 %c) nounwind ssp {
entry: ; X32-LABEL: t7:
; 32-LABEL: t7: ; X32: # %bb.0:
; 32: jmp {{_?}}bar2 ; X32-NEXT: jmp bar2 # TAILCALL
;
; 64-LABEL: t7: ; X64-LABEL: t7:
; 64: jmp {{_?}}bar2 ; X64: # %bb.0:
; X64-NEXT: jmp bar2 # TAILCALL
;
; X32ABI-LABEL: t7: ; X32ABI-LABEL: t7:
; X32ABI: jmp {{_?}}bar2 ; X32ABI: # %bb.0:
%0 = tail call i32 @bar2(i32 %a, i32 %b, i32 %c) nounwind ; X32ABI-NEXT: jmp bar2 # TAILCALL
ret i32 %0 %t0 = tail call i32 @bar2(i32 %a, i32 %b, i32 %c) nounwind
ret i32 %t0
} }
declare i32 @bar2(i32, i32, i32) declare i32 @bar2(i32, i32, i32)
define signext i16 @t8() nounwind ssp { define signext i16 @t8() nounwind ssp {
entry: ; X32-LABEL: t8:
; 32-LABEL: t8: ; X32: # %bb.0: # %entry
; 32: jmp {{_?}}bar3 ; X32-NEXT: jmp bar3 # TAILCALL
;
; 64-LABEL: t8: ; X64-LABEL: t8:
; 64: jmp {{_?}}bar3 ; X64: # %bb.0: # %entry
; X64-NEXT: jmp bar3 # TAILCALL
;
; X32ABI-LABEL: t8: ; X32ABI-LABEL: t8:
; X32ABI: jmp {{_?}}bar3 ; X32ABI: # %bb.0: # %entry
; X32ABI-NEXT: jmp bar3 # TAILCALL
entry:
%0 = tail call signext i16 @bar3() nounwind ; <i16> [#uses=1] %0 = tail call signext i16 @bar3() nounwind ; <i16> [#uses=1]
ret i16 %0 ret i16 %0
} }
@ -148,56 +190,87 @@ entry:
declare signext i16 @bar3() declare signext i16 @bar3()
define signext i16 @t9(i32 (i32)* nocapture %x) nounwind ssp { define signext i16 @t9(i32 (i32)* nocapture %x) nounwind ssp {
entry: ; X32-LABEL: t9:
; 32-LABEL: t9: ; X32: # %bb.0: # %entry
; 32: calll * ; X32-NEXT: subl $12, %esp
; X32-NEXT: movl $0, (%esp)
; 64-LABEL: t9: ; X32-NEXT: calll *{{[0-9]+}}(%esp)
; 64: jmpq * ; X32-NEXT: addl $12, %esp
; X32-NEXT: retl
;
; X64-LABEL: t9:
; X64: # %bb.0: # %entry
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: xorl %edi, %edi
; X64-NEXT: jmpq *%rax # TAILCALL
;
; X32ABI-LABEL: t9: ; X32ABI-LABEL: t9:
; X32ABI: jmpq * ; X32ABI: # %bb.0: # %entry
; X32ABI-NEXT: movl %edi, %eax
; X32ABI-NEXT: xorl %edi, %edi
; X32ABI-NEXT: jmpq *%rax # TAILCALL
entry:
%0 = bitcast i32 (i32)* %x to i16 (i32)* %0 = bitcast i32 (i32)* %x to i16 (i32)*
%1 = tail call signext i16 %0(i32 0) nounwind %1 = tail call signext i16 %0(i32 0) nounwind
ret i16 %1 ret i16 %1
} }
define void @t10() nounwind ssp { define void @t10() nounwind ssp {
entry: ; X32-LABEL: t10:
; 32-LABEL: t10: ; X32: # %bb.0: # %entry
; 32: calll ; X32-NEXT: subl $12, %esp
; X32-NEXT: calll foo4
; 64-LABEL: t10: ;
; 64: callq ; X64-LABEL: t10:
; X64: # %bb.0: # %entry
; X64-NEXT: pushq %rax
; X64-NEXT: callq foo4
;
; X32ABI-LABEL: t10: ; X32ABI-LABEL: t10:
; X32ABI: callq ; X32ABI: # %bb.0: # %entry
; X32ABI-NEXT: pushq %rax
; X32ABI-NEXT: callq foo4
entry:
%0 = tail call i32 @foo4() noreturn nounwind %0 = tail call i32 @foo4() noreturn nounwind
unreachable unreachable
} }
declare i32 @foo4() declare i32 @foo4()
define i32 @t11(i32 %x, i32 %y, i32 %z.0, i32 %z.1, i32 %z.2) nounwind ssp {
; In 32-bit mode, it's emitting a bunch of dead loads that are not being ; In 32-bit mode, it's emitting a bunch of dead loads that are not being
; eliminated currently. ; eliminated currently.
; 32-LABEL: t11: define i32 @t11(i32 %x, i32 %y, i32 %z.0, i32 %z.1, i32 %z.2) nounwind ssp {
; 32-NOT: subl ${{[0-9]+}}, %esp ; X32-LABEL: t11:
; 32: je ; X32: # %bb.0: # %entry
; 32-NOT: movl ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; 32-NOT: addl ${{[0-9]+}}, %esp ; X32-NEXT: testl %eax, %eax
; 32: jmp {{_?}}foo5 ; X32-NEXT: je .LBB10_1
; X32-NEXT: # %bb.2: # %bb
; 64-LABEL: t11: ; X32-NEXT: jmp foo5 # TAILCALL
; 64-NOT: subq ${{[0-9]+}}, %rsp ; X32-NEXT: .LBB10_1: # %bb6
; 64-NOT: addq ${{[0-9]+}}, %rsp ; X32-NEXT: xorl %eax, %eax
; 64: jmp {{_?}}foo5 ; X32-NEXT: retl
;
; X64-LABEL: t11:
; X64: # %bb.0: # %entry
; X64-NEXT: testl %edi, %edi
; X64-NEXT: je .LBB10_1
; X64-NEXT: # %bb.2: # %bb
; X64-NEXT: jmp foo5 # TAILCALL
; X64-NEXT: .LBB10_1: # %bb6
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: retq
;
; X32ABI-LABEL: t11: ; X32ABI-LABEL: t11:
; X32ABI-NOT: subl ${{[0-9]+}}, %esp ; X32ABI: # %bb.0: # %entry
; X32ABI-NOT: addl ${{[0-9]+}}, %esp ; X32ABI-NEXT: testl %edi, %edi
; X32ABI: jmp {{_?}}foo5 ; X32ABI-NEXT: je .LBB10_1
; X32ABI-NEXT: # %bb.2: # %bb
; X32ABI-NEXT: jmp foo5 # TAILCALL
; X32ABI-NEXT: .LBB10_1: # %bb6
; X32ABI-NEXT: xorl %eax, %eax
; X32ABI-NEXT: retq
entry: entry:
%0 = icmp eq i32 %x, 0 %0 = icmp eq i32 %x, 0
br i1 %0, label %bb6, label %bb br i1 %0, label %bb6, label %bb
@ -215,20 +288,36 @@ declare i32 @foo5(i32, i32, i32, i32, i32)
%struct.t = type { i32, i32, i32, i32, i32 } %struct.t = type { i32, i32, i32, i32, i32 }
define i32 @t12(i32 %x, i32 %y, %struct.t* byval align 4 %z) nounwind ssp { define i32 @t12(i32 %x, i32 %y, %struct.t* byval align 4 %z) nounwind ssp {
; 32-LABEL: t12: ; X32-LABEL: t12:
; 32-NOT: subl ${{[0-9]+}}, %esp ; X32: # %bb.0: # %entry
; 32-NOT: addl ${{[0-9]+}}, %esp ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; 32: jmp {{_?}}foo6 ; X32-NEXT: testl %eax, %eax
; X32-NEXT: je .LBB11_1
; 64-LABEL: t12: ; X32-NEXT: # %bb.2: # %bb
; 64-NOT: subq ${{[0-9]+}}, %rsp ; X32-NEXT: jmp foo6 # TAILCALL
; 64-NOT: addq ${{[0-9]+}}, %rsp ; X32-NEXT: .LBB11_1: # %bb2
; 64: jmp {{_?}}foo6 ; X32-NEXT: xorl %eax, %eax
; X32-NEXT: retl
;
; X64-LABEL: t12:
; X64: # %bb.0: # %entry
; X64-NEXT: testl %edi, %edi
; X64-NEXT: je .LBB11_1
; X64-NEXT: # %bb.2: # %bb
; X64-NEXT: jmp foo6 # TAILCALL
; X64-NEXT: .LBB11_1: # %bb2
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: retq
;
; X32ABI-LABEL: t12: ; X32ABI-LABEL: t12:
; X32ABI-NOT: subl ${{[0-9]+}}, %esp ; X32ABI: # %bb.0: # %entry
; X32ABI-NOT: addl ${{[0-9]+}}, %esp ; X32ABI-NEXT: testl %edi, %edi
; X32ABI: jmp {{_?}}foo6 ; X32ABI-NEXT: je .LBB11_1
; X32ABI-NEXT: # %bb.2: # %bb
; X32ABI-NEXT: jmp foo6 # TAILCALL
; X32ABI-NEXT: .LBB11_1: # %bb2
; X32ABI-NEXT: xorl %eax, %eax
; X32ABI-NEXT: retq
entry: entry:
%0 = icmp eq i32 %x, 0 %0 = icmp eq i32 %x, 0
br i1 %0, label %bb2, label %bb br i1 %0, label %bb2, label %bb
@ -248,20 +337,52 @@ declare i32 @foo6(i32, i32, %struct.t* byval align 4)
%struct.cp = type { float, float, float, float, float } %struct.cp = type { float, float, float, float, float }
define %struct.ns* @t13(%struct.cp* %yy) nounwind ssp { define %struct.ns* @t13(%struct.cp* %yy) nounwind ssp {
; 32-LABEL: t13: ; X32-LABEL: t13:
; 32-NOT: jmp ; X32: # %bb.0: # %entry
; 32: calll ; X32-NEXT: subl $28, %esp
; 32: ret ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; X32-NEXT: movl 16(%eax), %ecx
; 64-LABEL: t13: ; X32-NEXT: movl %ecx, {{[0-9]+}}(%esp)
; 64-NOT: jmp ; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
; 64: callq ; X32-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
; 64: ret ; X32-NEXT: movsd %xmm1, {{[0-9]+}}(%esp)
; X32-NEXT: movsd %xmm0, (%esp)
; X32-NEXT: xorl %ecx, %ecx
; X32-NEXT: calll foo7
; X32-NEXT: addl $28, %esp
; X32-NEXT: retl
;
; X64-LABEL: t13:
; X64: # %bb.0: # %entry
; X64-NEXT: pushq %rax
; X64-NEXT: subq $8, %rsp
; X64-NEXT: movl 16(%rdi), %eax
; X64-NEXT: movq (%rdi), %rcx
; X64-NEXT: movq 8(%rdi), %rdx
; X64-NEXT: xorl %edi, %edi
; X64-NEXT: pushq %rax
; X64-NEXT: pushq %rdx
; X64-NEXT: pushq %rcx
; X64-NEXT: callq foo7
; X64-NEXT: addq $32, %rsp
; X64-NEXT: popq %rcx
; X64-NEXT: retq
;
; X32ABI-LABEL: t13: ; X32ABI-LABEL: t13:
; X32ABI-NOT: jmp ; X32ABI: # %bb.0: # %entry
; X32ABI: callq ; X32ABI-NEXT: pushq %rax
; X32ABI: ret ; X32ABI-NEXT: subl $8, %esp
; X32ABI-NEXT: movl 16(%edi), %eax
; X32ABI-NEXT: movq (%edi), %rcx
; X32ABI-NEXT: movq 8(%edi), %rdx
; X32ABI-NEXT: xorl %edi, %edi
; X32ABI-NEXT: pushq %rax
; X32ABI-NEXT: pushq %rdx
; X32ABI-NEXT: pushq %rcx
; X32ABI-NEXT: callq foo7
; X32ABI-NEXT: addl $32, %esp
; X32ABI-NEXT: popq %rcx
; X32ABI-NEXT: retq
entry: entry:
%0 = tail call fastcc %struct.ns* @foo7(%struct.cp* byval align 4 %yy, i8 signext 0) nounwind %0 = tail call fastcc %struct.ns* @foo7(%struct.cp* byval align 4 %yy, i8 signext 0) nounwind
ret %struct.ns* %0 ret %struct.ns* %0
@ -277,16 +398,27 @@ declare fastcc %struct.ns* @foo7(%struct.cp* byval align 4, i8 signext) nounwind
%struct.__block_literal_2 = type { i8*, i32, i32, i8*, %struct.__block_descriptor_withcopydispose*, void ()* } %struct.__block_literal_2 = type { i8*, i32, i32, i8*, %struct.__block_descriptor_withcopydispose*, void ()* }
define void @t14(%struct.__block_literal_2* nocapture %.block_descriptor) nounwind ssp { define void @t14(%struct.__block_literal_2* nocapture %.block_descriptor) nounwind ssp {
entry: ; X32-LABEL: t14:
; 64-LABEL: t14: ; X32: # %bb.0: # %entry
; 64: movq 32(%rdi) ; X32-NEXT: subl $12, %esp
; 64-NOT: movq 16(%rdi) ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; 64: jmpq *16({{%rdi|%rax}}) ; X32-NEXT: movl 20(%eax), %eax
; X32-NEXT: movl %eax, (%esp)
; X32-NEXT: calll *12(%eax)
; X32-NEXT: addl $12, %esp
; X32-NEXT: retl
;
; X64-LABEL: t14:
; X64: # %bb.0: # %entry
; X64-NEXT: movq 32(%rdi), %rdi
; X64-NEXT: jmpq *16(%rdi) # TAILCALL
;
; X32ABI-LABEL: t14: ; X32ABI-LABEL: t14:
; X32ABI: movl 20(%edi), %edi ; X32ABI: # %bb.0: # %entry
; X32ABI-NEXT: movl 12(%edi), %eax ; X32ABI-NEXT: movl 20(%edi), %edi
; X32ABI-NEXT: jmpq *%rax ; X32ABI-NEXT: movl 12(%edi), %eax
; X32ABI-NEXT: jmpq *%rax # TAILCALL
entry:
%0 = getelementptr inbounds %struct.__block_literal_2, %struct.__block_literal_2* %.block_descriptor, i64 0, i32 5 ; <void ()**> [#uses=1] %0 = getelementptr inbounds %struct.__block_literal_2, %struct.__block_literal_2* %.block_descriptor, i64 0, i32 5 ; <void ()**> [#uses=1]
%1 = load void ()*, void ()** %0, align 8 ; <void ()*> [#uses=2] %1 = load void ()*, void ()** %0, align 8 ; <void ()*> [#uses=2]
%2 = bitcast void ()* %1 to %struct.__block_literal_1* ; <%struct.__block_literal_1*> [#uses=1] %2 = bitcast void ()* %1 to %struct.__block_literal_1* ; <%struct.__block_literal_1*> [#uses=1]
@ -302,17 +434,35 @@ entry:
%struct.foo = type { [4 x i32] } %struct.foo = type { [4 x i32] }
define void @t15(%struct.foo* noalias sret %agg.result) nounwind { define void @t15(%struct.foo* noalias sret %agg.result) nounwind {
; 32-LABEL: t15: ; X32-LABEL: t15:
; 32: calll {{_?}}f ; X32: # %bb.0:
; 32: retl $4 ; X32-NEXT: pushl %esi
; X32-NEXT: subl $8, %esp
; 64-LABEL: t15: ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
; 64: callq {{_?}}f ; X32-NEXT: movl %esi, %ecx
; 64: retq ; X32-NEXT: calll f
; X32-NEXT: movl %esi, %eax
; X32-NEXT: addl $8, %esp
; X32-NEXT: popl %esi
; X32-NEXT: retl $4
;
; X64-LABEL: t15:
; X64: # %bb.0:
; X64-NEXT: pushq %rbx
; X64-NEXT: movq %rdi, %rbx
; X64-NEXT: callq f
; X64-NEXT: movq %rbx, %rax
; X64-NEXT: popq %rbx
; X64-NEXT: retq
;
; X32ABI-LABEL: t15: ; X32ABI-LABEL: t15:
; X32ABI: callq {{_?}}f ; X32ABI: # %bb.0:
; X32ABI: retq ; X32ABI-NEXT: pushq %rbx
; X32ABI-NEXT: movl %edi, %ebx
; X32ABI-NEXT: callq f
; X32ABI-NEXT: movl %ebx, %eax
; X32ABI-NEXT: popq %rbx
; X32ABI-NEXT: retq
tail call fastcc void @f(%struct.foo* noalias sret %agg.result) nounwind tail call fastcc void @f(%struct.foo* noalias sret %agg.result) nounwind
ret void ret void
} }
@ -320,16 +470,22 @@ define void @t15(%struct.foo* noalias sret %agg.result) nounwind {
declare void @f(%struct.foo* noalias sret) nounwind declare void @f(%struct.foo* noalias sret) nounwind
define void @t16() nounwind ssp { define void @t16() nounwind ssp {
entry: ; X32-LABEL: t16:
; 32-LABEL: t16: ; X32: # %bb.0: # %entry
; 32: calll {{_?}}bar4 ; X32-NEXT: subl $12, %esp
; 32: fstp ; X32-NEXT: calll bar4
; X32-NEXT: fstp %st(0)
; 64-LABEL: t16: ; X32-NEXT: addl $12, %esp
; 64: jmp {{_?}}bar4 ; X32-NEXT: retl
;
; X64-LABEL: t16:
; X64: # %bb.0: # %entry
; X64-NEXT: jmp bar4 # TAILCALL
;
; X32ABI-LABEL: t16: ; X32ABI-LABEL: t16:
; X32ABI: jmp {{_?}}bar4 ; X32ABI: # %bb.0: # %entry
; X32ABI-NEXT: jmp bar4 # TAILCALL
entry:
%0 = tail call double @bar4() nounwind %0 = tail call double @bar4() nounwind
ret void ret void
} }
@ -338,17 +494,20 @@ declare double @bar4()
; rdar://6283267 ; rdar://6283267
define void @t17() nounwind ssp { define void @t17() nounwind ssp {
entry: ; X32-LABEL: t17:
; 32-LABEL: t17: ; X32: # %bb.0: # %entry
; 32: jmp {{_?}}bar5 ; X32-NEXT: jmp bar5 # TAILCALL
;
; 64-LABEL: t17: ; X64-LABEL: t17:
; 64: xorl %eax, %eax ; X64: # %bb.0: # %entry
; 64: jmp {{_?}}bar5 ; X64-NEXT: xorl %eax, %eax
; X64-NEXT: jmp bar5 # TAILCALL
;
; X32ABI-LABEL: t17: ; X32ABI-LABEL: t17:
; X32ABI: xorl %eax, %eax ; X32ABI: # %bb.0: # %entry
; X32ABI: jmp {{_?}}bar5 ; X32ABI-NEXT: xorl %eax, %eax
; X32ABI-NEXT: jmp bar5 # TAILCALL
entry:
tail call void (...) @bar5() nounwind tail call void (...) @bar5() nounwind
ret void ret void
} }
@ -357,18 +516,24 @@ declare void @bar5(...)
; rdar://7774847 ; rdar://7774847
define void @t18() nounwind ssp { define void @t18() nounwind ssp {
entry: ; X32-LABEL: t18:
; 32-LABEL: t18: ; X32: # %bb.0: # %entry
; 32: calll {{_?}}bar6 ; X32-NEXT: subl $12, %esp
; 32: fstp %st(0) ; X32-NEXT: calll bar6
; X32-NEXT: fstp %st(0)
; 64-LABEL: t18: ; X32-NEXT: addl $12, %esp
; 64: xorl %eax, %eax ; X32-NEXT: retl
; 64: jmp {{_?}}bar6 ;
; X64-LABEL: t18:
; X64: # %bb.0: # %entry
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: jmp bar6 # TAILCALL
;
; X32ABI-LABEL: t18: ; X32ABI-LABEL: t18:
; X32ABI: xorl %eax, %eax ; X32ABI: # %bb.0: # %entry
; X32ABI: jmp {{_?}}bar6 ; X32ABI-NEXT: xorl %eax, %eax
; X32ABI-NEXT: jmp bar6 # TAILCALL
entry:
%0 = tail call double (...) @bar6() nounwind %0 = tail call double (...) @bar6() nounwind
ret void ret void
} }
@ -376,14 +541,39 @@ entry:
declare double @bar6(...) declare double @bar6(...)
define void @t19() alignstack(32) nounwind { define void @t19() alignstack(32) nounwind {
entry: ; X32-LABEL: t19:
; CHECK-LABEL: t19: ; X32: # %bb.0: # %entry
; CHECK: andl $-32 ; X32-NEXT: pushl %ebp
; CHECK: calll {{_?}}foo ; X32-NEXT: movl %esp, %ebp
; X32-NEXT: andl $-32, %esp
; X32-NEXT: subl $32, %esp
; X32-NEXT: calll foo
; X32-NEXT: movl %ebp, %esp
; X32-NEXT: popl %ebp
; X32-NEXT: retl
;
; X64-LABEL: t19:
; X64: # %bb.0: # %entry
; X64-NEXT: pushq %rbp
; X64-NEXT: movq %rsp, %rbp
; X64-NEXT: andq $-32, %rsp
; X64-NEXT: subq $32, %rsp
; X64-NEXT: callq foo
; X64-NEXT: movq %rbp, %rsp
; X64-NEXT: popq %rbp
; X64-NEXT: retq
;
; X32ABI-LABEL: t19: ; X32ABI-LABEL: t19:
; X32ABI: andl $-32 ; X32ABI: # %bb.0: # %entry
; X32ABI: callq {{_?}}foo ; X32ABI-NEXT: pushq %rbp
; X32ABI-NEXT: movl %esp, %ebp
; X32ABI-NEXT: andl $-32, %esp
; X32ABI-NEXT: subl $32, %esp
; X32ABI-NEXT: callq foo
; X32ABI-NEXT: movl %ebp, %esp
; X32ABI-NEXT: popq %rbp
; X32ABI-NEXT: retq
entry:
tail call void @foo() nounwind tail call void @foo() nounwind
ret void ret void
} }
@ -393,16 +583,24 @@ entry:
; rdar://7874780 ; rdar://7874780
define double @t20(double %x) nounwind { define double @t20(double %x) nounwind {
entry: ; X32-LABEL: t20:
; 32-LABEL: t20: ; X32: # %bb.0: # %entry
; 32: calll {{_?}}foo20 ; X32-NEXT: subl $12, %esp
; 32: fldl (%esp) ; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
; X32-NEXT: calll foo20
; 64-LABEL: t20: ; X32-NEXT: movsd %xmm0, (%esp)
; 64: jmp {{_?}}foo20 ; X32-NEXT: fldl (%esp)
; X32-NEXT: addl $12, %esp
; X32-NEXT: retl
;
; X64-LABEL: t20:
; X64: # %bb.0: # %entry
; X64-NEXT: jmp foo20 # TAILCALL
;
; X32ABI-LABEL: t20: ; X32ABI-LABEL: t20:
; X32ABI: jmp {{_?}}foo20 ; X32ABI: # %bb.0: # %entry
; X32ABI-NEXT: jmp foo20 # TAILCALL
entry:
%0 = tail call fastcc double @foo20(double %x) nounwind %0 = tail call fastcc double @foo20(double %x) nounwind
ret double %0 ret double %0
} }