1// REQUIRES: ppc 2 3// 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 %t.o %t2.o %t3.o -o %t 7// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s 8 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 %t.o %t2.o %t3.o -o %t 13// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s 14 15 .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-LABEL: <_start>: 73// CHECK: 100101f0: bl 0x10010280 74// CHECK: 10010204: bl 0x10010258 75// CHECK-LABEL: <foo_external_diff>: 76// CHECK-NEXT: 10010250: addis 2, 12, 2 77// CHECK-NEXT: 10010254: addi 2, 2, -32696 78// CHECK-NEXT: 10010258: addis 5, 2, 1 79// CHECK-LABEL: <foo_external_same>: 80// CHECK-NEXT: 10010280: add 3, 4, 3 81