1# REQUIRES: ppc 2# XFAIL: * 3 4# RUN: llvm-readelf -relocations --wide %p/Inputs/ppc64le-quadword-ldst.o | FileCheck --check-prefix=QuadInputRelocs %s 5 6# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o 7# RUN: ld.lld -shared %t2.o -o %t2.so 8 9# RUN: ld.lld %t2.so %p/Inputs/ppc64le-quadword-ldst.o -o %t 10# RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s 11 12# RUN: ld.lld --no-toc-optimize %t2.so %p/Inputs/ppc64le-quadword-ldst.o -o %t 13# RUN: llvm-objdump -d %t | FileCheck --check-prefix=NoOpt %s 14 15# QuadInputRelocs: Relocation section '.rela.text' 16# QuadInputRelocs: R_PPC64_TOC16_LO_DS 0000000000000000 quadLd 17# QuadInputRelocs: R_PPC64_TOC16_LO_DS 0000000000000010 quadSt 18 19# The powerpc backend doesn't support the quadword load/store instructions yet. 20# So they are tested by linking against an object file assembled with 21# `as -mpower9 -o ppc64le-quadword-ldst.o in.s` and checking the encoding of 22# the unknown instructions in the dissasembly. Source used as input: 23#quads: 24#.Lbegin_quads: 25#.Lgep_quads: 26# addis 2, 12, .TOC.-.Lgep_quads@ha 27# addi 2, 2, .TOC.-.Lgep_quads@l 28#.Llep_quads: 29#.localentry quads, .Llep_quads-.Lgep_quads 30# addis 3, 2, quadLd@toc@ha 31# lq 4, quadLd@toc@l(3) 32# addis 3, 2, quadSt@toc@ha 33# stq 4, quadSt@toc@l(3) 34# blr 35# 36# .p2align 4 37# .global quadLd 38# .lcomm quadLd, 16 39# 40# .global quadSt 41# .lcomm quadSt, 16 42 43 44# e0 82 7f 70 decodes to | 111000 | 00100 | 00010 | 16-bit imm | 45# | 56 | 4 | 2 | 32624 | 46# which is `lq r4, 32624(r2)` 47# f8 82 7f 82 decodes to | 111110 | 00100 | 00010 | 14-bit imm | 10 | 48# | 62 | 4 | 2 | 8160 | 2 | 49# The immediate represents a word offset so this dissasembles to: 50# `stq r4, 32640(r2)` 51# Dis-LABEL: quads: 52# Dis-NEXT: addis 53# Dis-NEXT: addi 54# Dis-NEXT: nop 55# Dis-NEXT: 70 7f 82 e0 <unknown> 56# Dis-NEXT: nop 57# Dis-NEXT: 82 7f 82 f8 <unknown> 58# Dis-NEXT: blr 59 60# e0 83 7f 70 decodes to | 111000 | 00100 | 00011 | 16-bit imm | 61# | 56 | 4 | 3 | 32624 | 62# `lq r4, 32624(r3)` 63# f8 83 7f 82 decodes to | 111110 | 00100 | 00010 | 14-bit imm | 10 | 64# | 62 | 4 | 2 | 8160 | 2 | 65# `stq r4, 32640(r3)` 66# NoOpt-LABEL: quads: 67# NoOpt-NEXT: addis 68# NoOpt-NEXT: addi 69# NoOpt-NEXT: addis 3, 2, 0 70# NoOpt-NEXT: 70 7f 83 e0 <unknown> 71# NoOpt-NEXT: addis 3, 2, 0 72# NoOpt-NEXT: 82 7f 83 f8 <unknown> 73# NoOpt-NEXT: blr 74