1
; RUN: llc < %s -march=ppc64 -mcpu=pwr7 | FileCheck %s
2
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
3
target triple = "powerpc64-unknown-linux-gnu"
5
define void @foo() nounwind readnone noinline {
9
define weak void @foo_weak() nounwind {
13
; Calls to local function does not require the TOC restore 'nop'
14
define void @test_direct() nounwind readnone {
15
; CHECK-LABEL: test_direct:
16
tail call void @foo() nounwind
22
; Calls to weak function requires a TOC restore 'nop' because they
23
; may be overridden in a different module.
24
define void @test_weak() nounwind readnone {
25
; CHECK-LABEL: test_weak:
26
tail call void @foo_weak() nounwind
32
; Indirect calls requires a full stub creation
33
define void @test_indirect(void ()* nocapture %fp) nounwind {
34
; CHECK-LABEL: test_indirect:
35
tail call void %fp() nounwind
36
; CHECK: ld [[FP:[0-9]+]], 0(3)
39
; CHECK-NEXT: mtctr [[FP]]
41
; CHECK-NEXT: ld 2, 40(1)
45
; Absolute values must use the regular indirect call sequence
46
; The main purpose of this test is to ensure that BLA is not
47
; used on 64-bit SVR4 (as e.g. on Darwin).
48
define void @test_abs() nounwind {
49
; CHECK-LABEL: test_abs:
50
tail call void inttoptr (i64 1024 to void ()*)() nounwind
51
; CHECK: ld [[FP:[0-9]+]], 1024(0)
52
; CHECK: ld 11, 1040(0)
53
; CHECK: ld 2, 1032(0)
54
; CHECK-NEXT: mtctr [[FP]]
56
; CHECK-NEXT: ld 2, 40(1)
60
declare double @sin(double) nounwind
62
; External functions call should also have a 'nop'
63
define double @test_external(double %x) nounwind {
64
; CHECK-LABEL: test_external:
65
%call = tail call double @sin(double %x) nounwind
71
; The 'ld 2, 40(1)' really must always come directly after the bctrl to make
72
; the unwinding code in libgcc happy.
73
@g = external global void ()*
75
define void @test_indir_toc_reload(i64 %x) {
76
%1 = load void ()*, void ()** @g
81
; CHECK-LABEL: @test_indir_toc_reload
83
; CHECK-NEXT: ld 2, 40(1)