xref: /llvm-project/llvm/test/CodeGen/X86/sibcall-5.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc < %s -mtriple=i386-apple-darwin9 -mattr=+sse2  | FileCheck %s --check-prefix=X32
2; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X64
3; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=-sse3 | FileCheck %s --check-prefix=X64_BAD
4
5; Sibcall optimization of expanded libcalls.
6; rdar://8707777
7
8define double @foo(double %a) nounwind readonly ssp {
9entry:
10; X32-LABEL: foo:
11; X32: jmp _sin
12
13; X64-LABEL: foo:
14; X64: jmp _sin
15  %0 = tail call double @sin(double %a) nounwind readonly
16  ret double %0
17}
18
19define float @bar(float %a) nounwind readonly ssp {
20; X32-LABEL: bar:
21; X32: jmp _sinf
22
23; X64-LABEL: bar:
24; X64: jmp _sinf
25entry:
26  %0 = tail call float @sinf(float %a) nounwind readonly
27  ret float %0
28}
29
30
31declare float @sinf(float) nounwind readonly
32
33declare double @sin(double) nounwind readonly
34
35; rdar://10930395
36%0 = type opaque
37
38@"\01L_OBJC_SELECTOR_REFERENCES_2" = external hidden global ptr, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
39
40define hidden { double, double } @foo2(ptr %self, ptr nocapture %_cmd) uwtable optsize ssp {
41; X64_BAD: foo
42; X64_BAD: call
43; X64_BAD: call
44; X64_BAD: call
45  %1 = load ptr, ptr @"\01L_OBJC_SELECTOR_REFERENCES_2", align 8, !invariant.load !0
46  %2 = tail call { double, double } @objc_msgSend(ptr %self, ptr %1) optsize
47  %3 = extractvalue { double, double } %2, 0
48  %4 = extractvalue { double, double } %2, 1
49  %5 = tail call double @floor(double %3) optsize
50  %6 = tail call double @floor(double %4) optsize
51  %insert.i.i = insertvalue { double, double } undef, double %5, 0
52  %insert5.i.i = insertvalue { double, double } %insert.i.i, double %6, 1
53  ret { double, double } %insert5.i.i
54}
55
56declare ptr @objc_msgSend(ptr, ptr, ...)
57
58declare double @floor(double) optsize
59
60!0 = !{}
61