Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / ppc64-got-off.s
blobd3dff226250286ff4e02b0050defa5c2df8c182f
1 # REQUIRES: ppc
3 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
4 # RUN: ld.lld -shared --no-toc-optimize %t.o -o %t
5 # RUN: llvm-objdump -d %t | FileCheck %s
7 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
8 # RUN: ld.lld -shared --no-toc-optimize %t.o -o %t
9 # RUN: llvm-objdump -d %t | FileCheck %s
11 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
12 # RUN: ld.lld -shared %t.o -o %t
13 # RUN: llvm-objdump -d %t | FileCheck --check-prefix=OPT %s
15 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
16 # RUN: ld.lld -shared %t.o -o %t
17 # RUN: llvm-objdump -d %t | FileCheck --check-prefix=OPT %s
19 .abiversion 2
20 .section ".text"
22 .p2align 2
23 .global func
24 .type func, @function
25 func:
26 .Lfunc_gep:
27 addis 2, 12, .TOC.-.Lfunc_gep@ha
28 addi 2, 2, .TOC.-.Lfunc_gep@l
29 .Lfunc_lep:
30 .localentry func, .-func
31 addis 3, 2, a@got@ha
32 ld 3, a@got@l(3)
33 ld 4, a@got(2)
34 lis 5, a@got@h
35 ori 5, 5, a@got@l
36 li 6, 0
37 ori 6, 6, a@got
38 blr
40 # CHECK-LABEL: func
41 # CHECK: addis 3, 2, 0
42 # CHECK-NEXT: ld 3, -32760(3)
43 # CHECK-NEXT: ld 4, -32760(2)
44 # CHECK-NEXT: lis 5, -1
45 # CHECK-NEXT: ori 5, 5, 32776
46 # CHECK-NEXT: li 6, 0
47 # CHECK-NEXT: ori 6, 6, 32776
49 # OPT-LABEL: func
50 # OPT: nop
51 # OPT-NEXT: ld 3, -32760(2)
52 # OPT-NEXT: ld 4, -32760(2)
53 # OPT-NEXT: lis 5, -1
54 # OPT-NEXT: ori 5, 5, 32776
55 # OPT-NEXT: li 6, 0
56 # OPT-NEXT: ori 6, 6, 32776
58 # Since the got entry for a is .got[1] and the TOC base points to
59 # .got + 0x8000, the offset for a@got is -0x7FF8 --> -32760
61 .section ".data"
62 .global a
63 .type a, @object
64 .size a, 4
65 .p2align 2
67 .long 0x1000