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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
|
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
# RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
# RUN: ld.lld -shared -soname=t2.so %t2.o -o %t2.so
## Place all sections in the same segment so that .text and .TOC. are on the same page.
# RUN: echo 'PHDRS { all PT_LOAD; }' > %t.script
#
# RUN: ld.lld %t2.so %t.o -T %t.script -o %t
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s
#
# RUN: ld.lld %t2.so %t.o -T %t.script --no-toc-optimize -o %t
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=NoOpt %s
# InputRelocs: Relocation section '.rela.text'
# InputRelocs: R_PPC64_TOC16_HA
# InputRelocs: R_PPC64_TOC16_LO
# InputRelocs: R_PPC64_TOC16_LO_DS
.text
.abiversion 2
.global bytes
.p2align 4
.type bytes,@function
bytes:
.Lbytes_gep:
addis 2, 12, .TOC.-.Lbytes_gep@ha
addi 2, 2, .TOC.-.Lbytes_gep@l
.Lbytes_lep:
.localentry bytes, .Lbytes_lep-.Lbytes_gep
addis 3, 2, byteLd@toc@ha
lbz 3, byteLd@toc@l(3)
addis 4, 2, byteSt@toc@ha
stb 3, byteSt@toc@l(4)
blr
# Dis-LABEL: <bytes>:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
# Dis-NEXT: lbz 3, -32752(2)
# Dis-NEXT: nop
# Dis-NEXT: stb 3, -32751(2)
# Dis-NEXT: blr
# NoOpt-LABEL: <bytes>:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: lbz 3, -32752(3)
# NoOpt-NEXT: addis 4, 2, 0
# NoOpt-NEXT: stb 3, -32751(4)
# NoOpt-NEXT: blr
.global halfs
.p2align 4
.type halfs,@function
halfs:
.Lhalfs_gep:
addis 2, 12, .TOC.-.Lhalfs_gep@ha
addi 2, 2, .TOC.-.Lhalfs_gep@l
.Lhalfs_lep:
.localentry halfs, .Lhalfs_lep-.Lhalfs_gep
addis 3, 2, halfLd@toc@ha
lhz 3, halfLd@toc@l(3)
addis 4, 2, halfLd@toc@ha
lha 4, halfLd@toc@l(4)
addis 5, 2, halfSt@toc@ha
sth 4, halfSt@toc@l(5)
blr
# Dis-LABEL: <halfs>:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
# Dis-NEXT: lhz 3, -32750(2)
# Dis-NEXT: nop
# Dis-NEXT: lha 4, -32750(2)
# Dis-NEXT: nop
# Dis-NEXT: sth 4, -32748(2)
# Dis-NEXT: blr
# NoOpt-LABEL: <halfs>:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: lhz 3, -32750(3)
# NoOpt-NEXT: addis 4, 2, 0
# NoOpt-NEXT: lha 4, -32750(4)
# NoOpt-NEXT: addis 5, 2, 0
# NoOpt-NEXT: sth 4, -32748(5)
# NoOpt-NEXT: blr
.global words
.p2align 4
.type words,@function
words:
.Lwords_gep:
addis 2, 12, .TOC.-.Lwords_gep@ha
addi 2, 2, .TOC.-.Lwords_gep@l
.Lwords_lep:
.localentry words, .Lwords_lep-.Lwords_gep
addis 3, 2, wordLd@toc@ha
lwz 3, wordLd@toc@l(3)
addis 4, 2, wordLd@toc@ha
lwa 4, wordLd@toc@l(4)
addis 5, 2, wordSt@toc@ha
stw 4, wordSt@toc@l(5)
blr
# Dis-LABEL: words
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
# Dis-NEXT: lwz 3, -32744(2)
# Dis-NEXT: nop
# Dis-NEXT: lwa 4, -32744(2)
# Dis-NEXT: nop
# Dis-NEXT: stw 4, -32740(2)
# Dis-NEXT: blr
# NoOpt-LABEL: words
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: lwz 3, -32744(3)
# NoOpt-NEXT: addis 4, 2, 0
# NoOpt-NEXT: lwa 4, -32744(4)
# NoOpt-NEXT: addis 5, 2, 0
# NoOpt-NEXT: stw 4, -32740(5)
# NoOpt-NEXT: blr
.global doublewords
.p2align 4
.type doublewords,@function
doublewords:
.Ldoublewords_gep:
addis 2, 12, .TOC.-.Ldoublewords_gep@ha
addi 2, 2, .TOC.-.Ldoublewords_gep@l
.Ldoublewords_lep:
.localentry doublewords, .Ldoublewords_lep-.Ldoublewords_gep
addis 3, 2, dwordLd@toc@ha
ld 3, dwordLd@toc@l(3)
addis 4, 2, dwordSt@toc@ha
std 3, dwordSt@toc@l(4)
blr
# Dis-LABEL: doublewords
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
# Dis-NEXT: ld 3, -32736(2)
# Dis-NEXT: nop
# Dis-NEXT: std 3, -32728(2)
# Dis-NEXT: blr
# NoOpt-LABEL: doublewords
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: ld 3, -32736(3)
# NoOpt-NEXT: addis 4, 2, 0
# NoOpt-NEXT: std 3, -32728(4)
# NoOpt-NEXT: blr
.global vec_dq
.p2align 4
.type vec_dq,@function
vec_dq:
.Lvec_dq_gep:
addis 2, 12, .TOC.-.Lvec_dq_gep@ha
addi 2, 2, .TOC.-.Lvec_dq_gep@l
.Lvec_dq_lep:
.localentry vec_dq, .Lvec_dq_lep-.Lvec_dq_gep
addis 3, 2, vecLd@toc@ha
lxv 3, vecLd@toc@l(3)
addis 3, 2, vecSt@toc@ha
stxv 3, vecSt@toc@l(3)
blr
# Dis-LABEL: <vec_dq>:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
# Dis-NEXT: lxv 3, -32720(2)
# Dis-NEXT: nop
# Dis-NEXT: stxv 3, -32704(2)
# Dis-NEXT: blr
# NoOpt-LABEL: <vec_dq>:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: lxv 3, -32720(3)
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: stxv 3, -32704(3)
# NoOpt-NEXT: blr
.global vec_ds
.p2align 4
.type vec_ds,@function
vec_ds:
.Lvec_ds_gep:
addis 2, 12, .TOC.-.Lvec_ds_gep@ha
addi 2, 2, .TOC.-.Lvec_ds_gep@l
.Lvec_ds_lep:
.localentry vec_ds, .Lvec_dq_lep-.Lvec_dq_gep
addis 3, 2, vecLd@toc@ha
lxsd 3, vecLd@toc@l(3)
addis 3, 2, vecSt@toc@ha
stxsd 3, vecSt@toc@l(3)
addis 3, 2, vecLd@toc@ha
lxssp 3, vecLd@toc@l(3)
addis 3, 2, vecSt@toc@ha
stxssp 3, vecSt@toc@l(3)
blr
# Dis-LABEL: <vec_ds>:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
# Dis-NEXT: lxsd 3, -32720(2)
# Dis-NEXT: nop
# Dis-NEXT: stxsd 3, -32704(2)
# Dis-NEXT: nop
# Dis-NEXT: lxssp 3, -32720(2)
# Dis-NEXT: nop
# Dis-NEXT: stxssp 3, -32704(2)
# Dis-NEXT: blr
# NoOpt-LABEL: <vec_ds>:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: lxsd 3, -32720(3)
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: stxsd 3, -32704(3)
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: lxssp 3, -32720(3)
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: stxssp 3, -32704(3)
# NoOpt-NEXT: blr
.global byteLd
.lcomm byteLd, 1, 1
.global byteSt
.lcomm byteSt, 1, 1
.global halfLd
.lcomm halfLd, 2, 2
.global halfSt
.lcomm halfSt, 2, 2
.global wordLd
.lcomm wordLd, 4, 4
.global wordSt
.lcomm wordSt, 4, 4
.global dwordLd
.lcomm dwordLd, 8, 8
.global dwordSt
.lcomm dwordSt, 8, 8
.global vecLd
.lcomm vecLd, 16, 16
.global vecSt
.lcomm vecSt, 16, 16
|