pcrel-call-linkage-simple.ll
2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names < %s \
; RUN: | FileCheck %s --check-prefix=CHECK-S
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj < %s | \
; RUN: llvm-objdump -dr - | FileCheck %s --check-prefix=CHECK-O
; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names < %s \
; RUN: | FileCheck %s --check-prefix=CHECK-S
; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj < %s | \
; RUN: llvm-objdump -dr - | FileCheck %s --check-prefix=CHECK-O
; CHECK-S-LABEL: caller
; CHECK-S: b callee@notoc
; CHECK-O-LABEL: caller
; CHECK-O: b
; CHECK-O-NEXT: R_PPC64_REL24_NOTOC callee
define dso_local signext i32 @caller() local_unnamed_addr {
entry:
%call = tail call signext i32 bitcast (i32 (...)* @callee to i32 ()*)()
ret i32 %call
}
declare signext i32 @callee(...) local_unnamed_addr
; Some calls can be considered Extrnal Symbols.
; CHECK-S-LABEL: ExternalSymbol
; CHECK-S: b memcpy@notoc
; CHECK-O-LABEL: ExternalSymbol
; CHECK-O: b
; CHECK-O-NEXT: R_PPC64_REL24_NOTOC memcpy
define dso_local void @ExternalSymbol(i8* nocapture %out, i8* nocapture readonly %in, i64 %num) local_unnamed_addr {
entry:
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %out, i8* align 1 %in, i64 %num, i1 false)
ret void
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)
; CHECK-S-LABEL: callerNoTail
; CHECK-S: bl callee@notoc
; CHECK-S-NOT: nop
; CHECK-S: bl callee@notoc
; CHECK-S-NOT: nop
; CHECK-S: blr
; CHECK-O-LABEL: callerNoTail
; CHECK-O: bl
; CHECK-O-NEXT: R_PPC64_REL24_NOTOC callee
; CHECK-O-NOT: nop
; CHECK-O: bl
; CHECK-O-NEXT: R_PPC64_REL24_NOTOC callee
; CHECK-O-NOT: nop
; CHECK-O: blr
define dso_local signext i32 @callerNoTail() local_unnamed_addr {
entry:
%call1 = tail call signext i32 bitcast (i32 (...)* @callee to i32 ()*)()
%call2 = tail call signext i32 bitcast (i32 (...)* @callee to i32 ()*)()
%add = add i32 %call1, %call2
ret i32 %add
}