2018-04-21 00:46:58 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=i686-linux -mcpu=core2 -mattr=+sse2 | FileCheck %s --check-prefix=X32
|
|
|
|
; 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
|
2010-01-27 14:25:16 +08:00
|
|
|
|
2010-01-29 14:45:59 +08:00
|
|
|
define void @t1(i32 %x) nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t1:
|
|
|
|
; X32: # %bb.0:
|
|
|
|
; X32-NEXT: jmp foo # TAILCALL
|
|
|
|
;
|
|
|
|
; X64-LABEL: t1:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: jmp foo # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t1:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0:
|
|
|
|
; X32ABI-NEXT: jmp foo # TAILCALL
|
2010-01-27 14:25:16 +08:00
|
|
|
tail call void @foo() nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @foo()
|
2010-01-29 14:45:59 +08:00
|
|
|
|
|
|
|
define void @t2() nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t2:
|
|
|
|
; X32: # %bb.0:
|
|
|
|
; X32-NEXT: jmp foo2 # TAILCALL
|
|
|
|
;
|
|
|
|
; X64-LABEL: t2:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: jmp foo2 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t2:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0:
|
|
|
|
; X32ABI-NEXT: jmp foo2 # TAILCALL
|
|
|
|
%t0 = tail call i32 @foo2() nounwind
|
2010-01-29 14:45:59 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @foo2()
|
|
|
|
|
|
|
|
define void @t3() nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t3:
|
|
|
|
; X32: # %bb.0:
|
|
|
|
; X32-NEXT: jmp foo3 # TAILCALL
|
|
|
|
;
|
|
|
|
; X64-LABEL: t3:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: jmp foo3 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t3:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0:
|
|
|
|
; X32ABI-NEXT: jmp foo3 # TAILCALL
|
|
|
|
%t0 = tail call i32 @foo3() nounwind
|
2010-01-29 14:45:59 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @foo3()
|
2010-01-30 09:22:00 +08:00
|
|
|
|
|
|
|
define void @t4(void (i32)* nocapture %x) nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t4:
|
|
|
|
; X32: # %bb.0:
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: movl $0, (%esp)
|
|
|
|
; X32-NEXT: calll *{{[0-9]+}}(%esp)
|
|
|
|
; X32-NEXT: addl $12, %esp
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: t4:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: movq %rdi, %rax
|
|
|
|
; X64-NEXT: xorl %edi, %edi
|
|
|
|
; X64-NEXT: jmpq *%rax # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t4:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0:
|
|
|
|
; X32ABI-NEXT: movl %edi, %eax
|
|
|
|
; X32ABI-NEXT: xorl %edi, %edi
|
|
|
|
; X32ABI-NEXT: jmpq *%rax # TAILCALL
|
2010-01-30 09:22:00 +08:00
|
|
|
tail call void %x(i32 0) nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-01-28 21:38:48 +08:00
|
|
|
; FIXME: This isn't needed since x32 psABI specifies that callers must
|
|
|
|
; zero-extend pointers passed in registers.
|
2018-04-21 00:46:58 +08:00
|
|
|
|
|
|
|
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
|
2010-01-30 09:22:00 +08:00
|
|
|
tail call void %x() nounwind
|
|
|
|
ret void
|
|
|
|
}
|
2010-01-31 14:44:49 +08:00
|
|
|
|
|
|
|
define i32 @t6(i32 %x) nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t6:
|
|
|
|
; X32: # %bb.0:
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: cmpl $9, %eax
|
|
|
|
; X32-NEXT: jg .LBB5_2
|
|
|
|
; X32-NEXT: # %bb.1: # %bb
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t6:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0:
|
|
|
|
; X32ABI-NEXT: cmpl $9, %edi
|
|
|
|
; X32ABI-NEXT: jg .LBB5_2
|
|
|
|
; 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
|
2010-01-31 14:44:49 +08:00
|
|
|
|
|
|
|
bb:
|
2018-04-21 00:46:58 +08:00
|
|
|
%t1 = add nsw i32 %x, -1
|
|
|
|
%t2 = tail call i32 @t6(i32 %t1) nounwind ssp
|
|
|
|
ret i32 %t2
|
2010-01-31 14:44:49 +08:00
|
|
|
|
|
|
|
bb1:
|
2018-04-21 00:46:58 +08:00
|
|
|
%t3 = tail call i32 @bar(i32 %x) nounwind
|
|
|
|
ret i32 %t3
|
2010-01-31 14:44:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @bar(i32)
|
2010-02-02 10:22:50 +08:00
|
|
|
|
|
|
|
define i32 @t7(i32 %a, i32 %b, i32 %c) nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t7:
|
|
|
|
; X32: # %bb.0:
|
|
|
|
; X32-NEXT: jmp bar2 # TAILCALL
|
|
|
|
;
|
|
|
|
; X64-LABEL: t7:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: jmp bar2 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t7:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0:
|
|
|
|
; X32ABI-NEXT: jmp bar2 # TAILCALL
|
|
|
|
%t0 = tail call i32 @bar2(i32 %a, i32 %b, i32 %c) nounwind
|
|
|
|
ret i32 %t0
|
2010-02-02 10:22:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @bar2(i32, i32, i32)
|
2010-02-03 11:28:02 +08:00
|
|
|
|
|
|
|
define signext i16 @t8() nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t8:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: jmp bar3 # TAILCALL
|
|
|
|
;
|
|
|
|
; X64-LABEL: t8:
|
|
|
|
; X64: # %bb.0: # %entry
|
|
|
|
; X64-NEXT: jmp bar3 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t8:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: jmp bar3 # TAILCALL
|
|
|
|
entry:
|
2010-02-03 11:28:02 +08:00
|
|
|
%0 = tail call signext i16 @bar3() nounwind ; <i16> [#uses=1]
|
|
|
|
ret i16 %0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare signext i16 @bar3()
|
|
|
|
|
|
|
|
define signext i16 @t9(i32 (i32)* nocapture %x) nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t9:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: movl $0, (%esp)
|
|
|
|
; X32-NEXT: calll *{{[0-9]+}}(%esp)
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t9:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: movl %edi, %eax
|
|
|
|
; X32ABI-NEXT: xorl %edi, %edi
|
|
|
|
; X32ABI-NEXT: jmpq *%rax # TAILCALL
|
|
|
|
entry:
|
2010-02-03 11:28:02 +08:00
|
|
|
%0 = bitcast i32 (i32)* %x to i16 (i32)*
|
|
|
|
%1 = tail call signext i16 %0(i32 0) nounwind
|
|
|
|
ret i16 %1
|
|
|
|
}
|
2010-02-03 11:55:59 +08:00
|
|
|
|
|
|
|
define void @t10() nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t10:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: calll foo4
|
|
|
|
;
|
|
|
|
; X64-LABEL: t10:
|
|
|
|
; X64: # %bb.0: # %entry
|
|
|
|
; X64-NEXT: pushq %rax
|
|
|
|
; X64-NEXT: callq foo4
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t10:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: pushq %rax
|
|
|
|
; X32ABI-NEXT: callq foo4
|
|
|
|
entry:
|
2010-02-03 11:55:59 +08:00
|
|
|
%0 = tail call i32 @foo4() noreturn nounwind
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @foo4()
|
2010-02-05 10:21:12 +08:00
|
|
|
|
|
|
|
; In 32-bit mode, it's emitting a bunch of dead loads that are not being
|
|
|
|
; eliminated currently.
|
|
|
|
|
2018-04-21 00:46:58 +08:00
|
|
|
define i32 @t11(i32 %x, i32 %y, i32 %z.0, i32 %z.1, i32 %z.2) nounwind ssp {
|
|
|
|
; X32-LABEL: t11:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: testl %eax, %eax
|
|
|
|
; X32-NEXT: je .LBB10_1
|
|
|
|
; X32-NEXT: # %bb.2: # %bb
|
|
|
|
; X32-NEXT: jmp foo5 # TAILCALL
|
|
|
|
; X32-NEXT: .LBB10_1: # %bb6
|
|
|
|
; X32-NEXT: xorl %eax, %eax
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t11:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: testl %edi, %edi
|
|
|
|
; 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
|
2010-02-05 10:21:12 +08:00
|
|
|
entry:
|
|
|
|
%0 = icmp eq i32 %x, 0
|
|
|
|
br i1 %0, label %bb6, label %bb
|
|
|
|
|
|
|
|
bb:
|
|
|
|
%1 = tail call i32 @foo5(i32 %x, i32 %y, i32 %z.0, i32 %z.1, i32 %z.2) nounwind
|
|
|
|
ret i32 %1
|
|
|
|
|
|
|
|
bb6:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @foo5(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 {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t12:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: testl %eax, %eax
|
|
|
|
; X32-NEXT: je .LBB11_1
|
|
|
|
; X32-NEXT: # %bb.2: # %bb
|
|
|
|
; X32-NEXT: jmp foo6 # TAILCALL
|
|
|
|
; X32-NEXT: .LBB11_1: # %bb2
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t12:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: testl %edi, %edi
|
|
|
|
; 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
|
2010-02-05 10:21:12 +08:00
|
|
|
entry:
|
|
|
|
%0 = icmp eq i32 %x, 0
|
|
|
|
br i1 %0, label %bb2, label %bb
|
|
|
|
|
|
|
|
bb:
|
|
|
|
%1 = tail call i32 @foo6(i32 %x, i32 %y, %struct.t* byval align 4 %z) nounwind
|
|
|
|
ret i32 %1
|
|
|
|
|
|
|
|
bb2:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @foo6(i32, i32, %struct.t* byval align 4)
|
2010-03-05 16:38:04 +08:00
|
|
|
|
|
|
|
; rdar://r7717598
|
|
|
|
%struct.ns = type { i32, i32 }
|
2011-05-19 03:19:17 +08:00
|
|
|
%struct.cp = type { float, float, float, float, float }
|
2010-03-05 16:38:04 +08:00
|
|
|
|
|
|
|
define %struct.ns* @t13(%struct.cp* %yy) nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t13:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: subl $28, %esp
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: movl 16(%eax), %ecx
|
|
|
|
; X32-NEXT: movl %ecx, {{[0-9]+}}(%esp)
|
|
|
|
; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
|
|
|
|
; X32-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t13:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: pushq %rax
|
|
|
|
; 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
|
2010-03-05 16:38:04 +08:00
|
|
|
entry:
|
|
|
|
%0 = tail call fastcc %struct.ns* @foo7(%struct.cp* byval align 4 %yy, i8 signext 0) nounwind
|
|
|
|
ret %struct.ns* %0
|
|
|
|
}
|
|
|
|
|
2010-03-20 11:17:05 +08:00
|
|
|
; rdar://6195379
|
|
|
|
; llvm can't do sibcall for this in 32-bit mode (yet).
|
2010-03-05 16:38:04 +08:00
|
|
|
declare fastcc %struct.ns* @foo7(%struct.cp* byval align 4, i8 signext) nounwind ssp
|
2010-03-20 11:17:05 +08:00
|
|
|
|
|
|
|
%struct.__block_descriptor = type { i64, i64 }
|
|
|
|
%struct.__block_descriptor_withcopydispose = type { i64, i64, i8*, i8* }
|
|
|
|
%struct.__block_literal_1 = type { i8*, i32, i32, i8*, %struct.__block_descriptor* }
|
|
|
|
%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 {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t14:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t14:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: movl 20(%edi), %edi
|
|
|
|
; X32ABI-NEXT: movl 12(%edi), %eax
|
|
|
|
; X32ABI-NEXT: jmpq *%rax # TAILCALL
|
|
|
|
entry:
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%0 = getelementptr inbounds %struct.__block_literal_2, %struct.__block_literal_2* %.block_descriptor, i64 0, i32 5 ; <void ()**> [#uses=1]
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load void ()*, void ()** %0, align 8 ; <void ()*> [#uses=2]
|
2010-03-20 11:17:05 +08:00
|
|
|
%2 = bitcast void ()* %1 to %struct.__block_literal_1* ; <%struct.__block_literal_1*> [#uses=1]
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%3 = getelementptr inbounds %struct.__block_literal_1, %struct.__block_literal_1* %2, i64 0, i32 3 ; <i8**> [#uses=1]
|
2015-02-28 05:17:42 +08:00
|
|
|
%4 = load i8*, i8** %3, align 8 ; <i8*> [#uses=1]
|
2010-03-20 11:17:05 +08:00
|
|
|
%5 = bitcast i8* %4 to void (i8*)* ; <void (i8*)*> [#uses=1]
|
|
|
|
%6 = bitcast void ()* %1 to i8* ; <i8*> [#uses=1]
|
|
|
|
tail call void %5(i8* %6) nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; rdar://7726868
|
|
|
|
%struct.foo = type { [4 x i32] }
|
|
|
|
|
|
|
|
define void @t15(%struct.foo* noalias sret %agg.result) nounwind {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t15:
|
|
|
|
; X32: # %bb.0:
|
|
|
|
; X32-NEXT: pushl %esi
|
|
|
|
; X32-NEXT: subl $8, %esp
|
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
|
|
|
|
; X32-NEXT: movl %esi, %ecx
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t15:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0:
|
|
|
|
; 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
|
2010-03-20 11:17:05 +08:00
|
|
|
tail call fastcc void @f(%struct.foo* noalias sret %agg.result) nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @f(%struct.foo* noalias sret) nounwind
|
|
|
|
|
|
|
|
define void @t16() nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t16:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: calll bar4
|
|
|
|
; X32-NEXT: fstp %st(0)
|
|
|
|
; X32-NEXT: addl $12, %esp
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: t16:
|
|
|
|
; X64: # %bb.0: # %entry
|
|
|
|
; X64-NEXT: jmp bar4 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t16:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: jmp bar4 # TAILCALL
|
|
|
|
entry:
|
2010-03-20 11:17:05 +08:00
|
|
|
%0 = tail call double @bar4() nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare double @bar4()
|
2010-03-26 10:13:13 +08:00
|
|
|
|
|
|
|
; rdar://6283267
|
|
|
|
define void @t17() nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t17:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: jmp bar5 # TAILCALL
|
|
|
|
;
|
|
|
|
; X64-LABEL: t17:
|
|
|
|
; X64: # %bb.0: # %entry
|
|
|
|
; X64-NEXT: xorl %eax, %eax
|
|
|
|
; X64-NEXT: jmp bar5 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t17:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: xorl %eax, %eax
|
|
|
|
; X32ABI-NEXT: jmp bar5 # TAILCALL
|
|
|
|
entry:
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
tail call void (...) @bar5() nounwind
|
2010-03-26 10:13:13 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @bar5(...)
|
|
|
|
|
|
|
|
; rdar://7774847
|
|
|
|
define void @t18() nounwind ssp {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t18:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: calll bar6
|
|
|
|
; X32-NEXT: fstp %st(0)
|
|
|
|
; X32-NEXT: addl $12, %esp
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: t18:
|
|
|
|
; X64: # %bb.0: # %entry
|
|
|
|
; X64-NEXT: xorl %eax, %eax
|
|
|
|
; X64-NEXT: jmp bar6 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t18:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: xorl %eax, %eax
|
|
|
|
; X32ABI-NEXT: jmp bar6 # TAILCALL
|
|
|
|
entry:
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%0 = tail call double (...) @bar6() nounwind
|
2010-03-26 10:13:13 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare double @bar6(...)
|
2010-03-27 00:26:03 +08:00
|
|
|
|
|
|
|
define void @t19() alignstack(32) nounwind {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t19:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: pushl %ebp
|
|
|
|
; 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
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t19:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; 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:
|
2010-03-27 00:26:03 +08:00
|
|
|
tail call void @foo() nounwind
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2010-04-30 09:12:32 +08:00
|
|
|
; If caller / callee calling convention mismatch then check if the return
|
|
|
|
; values are returned in the same registers.
|
|
|
|
; rdar://7874780
|
|
|
|
|
|
|
|
define double @t20(double %x) nounwind {
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32-LABEL: t20:
|
|
|
|
; X32: # %bb.0: # %entry
|
|
|
|
; X32-NEXT: subl $12, %esp
|
|
|
|
; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
|
|
|
|
; X32-NEXT: calll foo20
|
|
|
|
; X32-NEXT: movsd %xmm0, (%esp)
|
|
|
|
; X32-NEXT: fldl (%esp)
|
|
|
|
; X32-NEXT: addl $12, %esp
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: t20:
|
|
|
|
; X64: # %bb.0: # %entry
|
|
|
|
; X64-NEXT: jmp foo20 # TAILCALL
|
|
|
|
;
|
2015-01-28 21:38:48 +08:00
|
|
|
; X32ABI-LABEL: t20:
|
2018-04-21 00:46:58 +08:00
|
|
|
; X32ABI: # %bb.0: # %entry
|
|
|
|
; X32ABI-NEXT: jmp foo20 # TAILCALL
|
|
|
|
entry:
|
2010-04-30 09:12:32 +08:00
|
|
|
%0 = tail call fastcc double @foo20(double %x) nounwind
|
|
|
|
ret double %0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare fastcc double @foo20(double) nounwind
|