xref: /aosp_15_r20/external/llvm/test/CodeGen/PowerPC/ppc64-nonfunc-calls.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mcpu=pwr7 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Workertarget datalayout = "E-m:e-i64:64-n32:64"
3*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64-unknown-linux-gnu"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker%struct.cd = type { i64, i64, i64 }
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker@something = global [33 x i8] c"this is not really code, but...\0A\00", align 1
8*9880d681SAndroid Build Coastguard Worker@tls_something = thread_local global %struct.cd zeroinitializer, align 8
9*9880d681SAndroid Build Coastguard Worker@extern_something = external global %struct.cd
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
12*9880d681SAndroid Build Coastguard Workerdefine void @foo() #0 {
13*9880d681SAndroid Build Coastguard Workerentry:
14*9880d681SAndroid Build Coastguard Worker  tail call void bitcast ([33 x i8]* @something to void ()*)() #0
15*9880d681SAndroid Build Coastguard Worker  ret void
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @foo
18*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addis [[REG1:[0-9]+]], 2, something@toc@ha
19*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: std 2, 40(1)
20*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addi [[REG3:[0-9]+]], [[REG1]], something@toc@l
21*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld [[REG2:[0-9]+]], 0([[REG3]])
22*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld 11, 16([[REG3]])
23*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld 2, 8([[REG3]])
24*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: mtctr [[REG2]]
25*9880d681SAndroid Build Coastguard Worker; CHECK: bctrl
26*9880d681SAndroid Build Coastguard Worker; CHECK: ld 2, 40(1)
27*9880d681SAndroid Build Coastguard Worker; CHECK: blr
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
31*9880d681SAndroid Build Coastguard Workerdefine void @bar() #0 {
32*9880d681SAndroid Build Coastguard Workerentry:
33*9880d681SAndroid Build Coastguard Worker  tail call void bitcast (%struct.cd* @tls_something to void ()*)() #0
34*9880d681SAndroid Build Coastguard Worker  ret void
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @bar
37*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addis [[REG1:[0-9]+]], 13, tls_something@tprel@ha
38*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: std 2, 40(1)
39*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addi [[REG3:[0-9]+]], [[REG1]], tls_something@tprel@l
40*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld [[REG2:[0-9]+]], 0([[REG3]])
41*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld 11, 16([[REG3]])
42*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld 2, 8([[REG3]])
43*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: mtctr [[REG2]]
44*9880d681SAndroid Build Coastguard Worker; CHECK: bctrl
45*9880d681SAndroid Build Coastguard Worker; CHECK: ld 2, 40(1)
46*9880d681SAndroid Build Coastguard Worker; CHECK: blr
47*9880d681SAndroid Build Coastguard Worker}
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
50*9880d681SAndroid Build Coastguard Workerdefine void @ext() #0 {
51*9880d681SAndroid Build Coastguard Workerentry:
52*9880d681SAndroid Build Coastguard Worker  tail call void bitcast (%struct.cd* @extern_something to void ()*)() #0
53*9880d681SAndroid Build Coastguard Worker  ret void
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @ext
56*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: addis [[REG1:[0-9]+]], 2, [[NAME:[._A-Za-z0-9]+]]@toc@ha
57*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: std 2, 40(1)
58*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld [[REG3:[0-9]+]], [[NAME]]@toc@l(3)
59*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld [[REG2:[0-9]+]], 0([[REG3]])
60*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld 11, 16([[REG3]])
61*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ld 2, 8([[REG3]])
62*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: mtctr [[REG2]]
63*9880d681SAndroid Build Coastguard Worker; CHECK: bctrl
64*9880d681SAndroid Build Coastguard Worker; CHECK: ld 2, 40(1)
65*9880d681SAndroid Build Coastguard Worker; CHECK: blr
66*9880d681SAndroid Build Coastguard Worker}
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind }
69*9880d681SAndroid Build Coastguard Worker
70