summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-powerpc/tocopt.s
blob: cb5cc3e459f74b12a5f3c3cde88a98ea64189e08 (plain)
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
 .section .toc,"aw"
x4t:
 .quad x4
x5t:
 .quad x5
x6t:
 .quad x6

 .section .sdata,"aw"
x1:
 .byte 1
x2:
 .byte 2
x3:
 .byte 3
x4:
 .byte 4
x5:
 .byte 5
x6:
 .byte 6

 .globl _start
 .text
_start:
# no need for got entry, optimise to nop,addi
# note that due to unexpected toc/got insns the full optimisation is
# not done.  see tocopt5 for test without unexpected insns.
 addis 9,2,x1@got@ha
 ld 9,x1@got@l(9)
# must keep got entry, optimise to nop,addi,ld
 addis 4,2,x2@got@ha
 addi 5,4,x2@got@l
 ld 6,0(5)
# must keep got entry, optimise to nop,li,ldx
 lis 29,x3@got@ha
 addi 29,29,x3@got@l
 ldx 3,2,29

# no need for toc entry, optimise to nop,addi
 addis 9,2,x4t@toc@ha
 ld 9,x4t@toc@l(9)
# must keep toc entry, optimise to nop,addi,ld
# if we had a reloc tying the ld to x5/x5t then we could throw away
# the toc entry and optimise to nop,nop,addi
 addis 4,2,x5t@toc@ha
 addi 5,4,x5t@toc@l
 ld 6,0(5)
# must keep toc entry, optimise to nop,li,ldx
 lis 29,x6t@toc@ha
 addi 29,29,x6t@toc@l
 ldx 3,2,29