1# REQUIRES: ppc 2# RUN: echo 'SECTIONS { \ 3# RUN: .text_start 0x10010300 : { *(.text_start) } \ 4# RUN: }' > %t.script 5 6# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s --defsym T1=1 -o %t1.o 7# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s --defsym T2=1 -o %t2.o 8# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s --defsym T3=1 -o %t3.o 9# RUN: ld.lld --shared %t1.o -o %t1.so 10# RUN: ld.lld -T %t.script %t1.so %t2.o -o %t2 11# RUN: ld.lld -T %t.script %t1.so %t3.o -o %t3 12# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t2 | FileCheck %s --check-prefix=T2 13# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t3 | FileCheck %s --check-prefix=T3 14 15# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s --defsym T1=1 -o %t1.o 16# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s --defsym T2=1 -o %t2.o 17# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s --defsym T3=1 -o %t3.o 18# RUN: ld.lld --shared %t1.o -o %t1.so 19# RUN: ld.lld -T %t.script %t1.so %t2.o -o %t2 20# RUN: ld.lld -T %t.script %t1.so %t3.o -o %t3 21# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t2 | FileCheck %s --check-prefix=T2 22# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t3 | FileCheck %s --check-prefix=T3 23 24.ifdef T1 25.globl callee 26callee: 27 blr 28.endif 29 30# T2-LABEL: <p9codegen>: 31# T2-NEXT: 10010300: addis 2, 12, 1 32# T2-NEXT: 10010304: addi 2, 2, -32384 33# T2-NEXT: 10010308: addis 4, 2, -1 34# T2-NEXT: 1001030c: lwa 3, 32428(4) 35# T2-NEXT: 10010310: bl 0x10010330 36# T2-NEXT: 10010314: ld 2, 24(1) 37# T2-NEXT: 10010318: blr 38 39# T2-LABEL: <p10codegen>: 40# T2-NEXT: 1001031c: plwa 3, 16(0), 1 41# T2-NEXT: 10010324: bl 0x10010350 42# T2-NEXT: 10010328: blr 43 44# T2-LABEL: <__plt_callee>: 45# T2-NEXT: 10010330: std 2, 24(1) 46# T2-NEXT: 10010334: addis 12, 2, 0 47# T2-NEXT: 10010338: ld 12, -32744(12) 48# T2-NEXT: 1001033c: mtctr 12 49# T2-NEXT: 10010340: bctr 50 51# T2-LABEL: <__plt_pcrel_callee>: 52# T2-NEXT: 10010350: pld 12, 328(0), 1 53# T2-NEXT: 10010358: mtctr 12 54# T2-NEXT: 1001035c: bctr 55.ifdef T2 56.section .text_start, "ax", %progbits 57p9codegen: 58.Lfunc_gep0: 59 addis 2, 12, .TOC.-.Lfunc_gep0@ha 60 addi 2, 2, .TOC.-.Lfunc_gep0@l 61.Lfunc_lep0: 62 .localentry p9codegen, .Lfunc_lep0-.Lfunc_gep0 63 addis 4, 2, Global@toc@ha 64 lwa 3, Global@toc@l(4) 65 bl callee 66 nop 67 blr 68p10codegen: 69 .localentry main, 1 70 plwa 3, Global@PCREL(0), 1 71 bl callee@notoc 72 blr 73.globl Global 74Global: 75 .long 10 76 .size Global, 4 77.endif 78 79# T3-LABEL: <p10codegen>: 80# T3-NEXT: 10010300: plwa 3, 44(0), 1 81# T3-NEXT: 10010308: bl 0x10010330 82# T3-NEXT: 1001030c: blr 83 84# T3-LABEL: <p9codegen>: 85# T3-NEXT: 10010310: addis 2, 12, 1 86# T3-NEXT: 10010314: addi 2, 2, -32408 87# T3-NEXT: 10010318: addis 4, 2, -1 88# T3-NEXT: 1001031c: lwa 3, 32436(4) 89# T3-NEXT: 10010320: bl 0x10010340 90# T3-NEXT: 10010324: ld 2, 24(1) 91# T3-NEXT: 10010328: blr 92 93# T3-LABEL: <__plt_pcrel_callee>: 94# T3-NEXT: 10010330: pld 12, 352(0), 1 95# T3-NEXT: 10010338: mtctr 12 96# T3-NEXT: 1001033c: bctr 97 98# T3-LABEL: <__plt_callee>: 99# T3-NEXT: 10010340: std 2, 24(1) 100# T3-NEXT: 10010344: addis 12, 2, 0 101# T3-NEXT: 10010348: ld 12, -32744(12) 102# T3-NEXT: 1001034c: mtctr 12 103# T3-NEXT: 10010350: bctr 104.ifdef T3 105.section .text_start, "ax", %progbits 106p10codegen: 107 .localentry main, 1 108 plwa 3, Global@PCREL(0), 1 109 bl callee@notoc 110 blr 111p9codegen: 112.Lfunc_gep0: 113 addis 2, 12, .TOC.-.Lfunc_gep0@ha 114 addi 2, 2, .TOC.-.Lfunc_gep0@l 115.Lfunc_lep0: 116 .localentry p9codegen, .Lfunc_lep0-.Lfunc_gep0 117 addis 4, 2, Global@toc@ha 118 lwa 3, Global@toc@l(4) 119 bl callee 120 nop 121 blr 122.globl Global 123Global: 124 .long 10 125 .size Global, 4 126.endif 127