blob: 640c94fe8cfbb539b064856dad0c98df9031852f [file] [log] [blame]
Zaara Syeda82dd99e2018-04-27 15:41:191// REQUIRES: ppc
Zaara Syedaf61b0732018-05-04 15:09:492
Zaara Syeda82dd99e2018-04-27 15:41:193// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
4// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-func-global-entry.s -o %t2.o
5// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-func-local-entry.s -o %t3.o
6// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.o %t3.o -o %t
7// RUN: llvm-objdump -d %t | FileCheck %s
Zaara Syedaf61b0732018-05-04 15:09:498
9// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
10// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-func-global-entry.s -o %t2.o
11// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-func-local-entry.s -o %t3.o
12// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.o %t3.o -o %t
13// RUN: llvm-objdump -d %t | FileCheck %s
14
Zaara Syeda82dd99e2018-04-27 15:41:1915 .text
16 .abiversion 2
17 .globl _start # -- Begin function _start
18 .p2align 4
19 .type _start,@function
20_start: # @_start
21.Lfunc_begin0:
22.Lfunc_gep0:
23 addis 2, 12, .TOC.-.Lfunc_gep0@ha
24 addi 2, 2, .TOC.-.Lfunc_gep0@l
25.Lfunc_lep0:
26 .localentry _start, .Lfunc_lep0-.Lfunc_gep0
27# %bb.0: # %entry
28 mflr 0
29 std 0, 16(1)
30 stdu 1, -48(1)
31 li 3, 1
32 li 4, 1
33 std 30, 32(1) # 8-byte Folded Spill
34 bl foo_external_same
35 nop
36 mr 30, 3
37 li 3, 2
38 li 4, 2
39 bl foo_external_diff
40 nop
41 addis 4, 2, .LC0@toc@ha
42 add 3, 3, 30
43 ld 30, 32(1) # 8-byte Folded Reload
44 ld 4, .LC0@toc@l(4)
45 lwz 4, 0(4)
46 add 3, 3, 4
47 extsw 3, 3
48 addi 1, 1, 48
49 ld 0, 16(1)
50 li 0, 1
51 sc
52 .long 0
53 .quad 0
54.Lfunc_end0:
55 .size _start, .Lfunc_end0-.Lfunc_begin0
56 # -- End function
57 .section .toc,"aw",@progbits
58.LC0:
59 .tc glob[TC],glob
60 .type glob,@object # @glob
61 .data
62 .globl glob
63 .p2align 2
64glob:
65 .long 10 # 0xa
66 .size glob, 4
67
68# Check that foo_external_diff has a global entry point and we branch to
69# foo_external_diff+8. Also check that foo_external_same has no global entry
70# point and we branch to start of foo_external_same.
71
72// CHECK: _start:
Zaara Syedaf61b0732018-05-04 15:09:4973// CHECK: 10010020: {{.*}} bl .+144
74// CHECK: 10010034: {{.*}} bl .+84
Zaara Syeda82dd99e2018-04-27 15:41:1975// CHECK: foo_external_diff:
Zaara Syedaf61b0732018-05-04 15:09:4976// CHECK-NEXT: 10010080: {{.*}} addis 2, 12, 2
77// CHECK-NEXT: 10010084: {{.*}} addi 2, 2, 32640
Zaara Syeda85197a02018-05-24 15:59:4178// CHECK-NEXT: 10010088: {{.*}} addis 5, 2, 0
Zaara Syeda82dd99e2018-04-27 15:41:1979// CHECK: foo_external_same:
Zaara Syedaf61b0732018-05-04 15:09:4980// CHECK-NEXT: 100100b0: {{.*}} add 3, 4, 3