1	.text
2	.globl _start
3_start:
4# original PCREL_OPT definition, with second insn immediately after first
5	pld 9,sym@got@pcrel
6		.reloc .-8,R_PPC64_PCREL_OPT,0
7	lbz 3,0(9)
8
9# but we now allow an offset to the second insn
10	pld 22,sym@got@pcrel
11		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
12	nop
130:	lhz 4,0(22)
14
15# in fact, it can even be before the "first" insn
160: 	lha 3,0(9)
17	pld 9,sym@got@pcrel
18		.reloc .-8,R_PPC64_PCREL_OPT,0b-(.-8)
19	bne 0b
20
21# and of course, other local labels work
22	pld 9,sym@got@pcrel
23		.reloc .-8,R_PPC64_PCREL_OPT,.L1-(.-8)
24.L1:	lwz 3,0(9)
25
26	pld 9,sym@got@pcrel
27		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
280:	lwa 3,0(9)
29
30	pld 9,sym@got@pcrel
31		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
320:	ld 3,0(9)
33
34	pld 9,sym@got@pcrel
35		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
360:	lq 14,0(9)
37
38	pld 9,sym@got@pcrel
39		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
400:	lfs 1,0(9)
41
42	pld 9,sym@got@pcrel
43		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
440:	lfd 1,0(9)
45
46	pld 9,sym@got@pcrel
47		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
480:	lxsd 30,0(9)
49
50	pld 9,sym@got@pcrel
51		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
520:	lxssp 31,0(9)
53
54	pld 9,sym@got@pcrel
55		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
560:	lxv 63,0(9)
57
58	pld 9,sym@got@pcrel
59		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
600:	lxv 0,0(9)
61
62	pld 9,sym@got@pcrel
63		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
640:	stb 3,0(9)
65
66	pld 9,sym@got@pcrel
67		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
680:	sth 3,0(9)
69
70	pld 9,sym@got@pcrel
71		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
720:	stw 3,0(9)
73
74	pld 9,sym@got@pcrel
75		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
760:	std 3,0(9)
77
78	pld 9,sym@got@pcrel
79		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
800:	stq 14,0(9)
81
82	pld 9,sym@got@pcrel
83		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
840:	stfd 1,0(9)
85
86	pld 9,sym@got@pcrel
87		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
880:	stfs 2,0(9)
89
90	pld 9,sym@got@pcrel
91		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
920:	stxsd 30,0(9)
93
94	pld 9,sym@got@pcrel
95		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
960:	stxssp 31,0(9)
97
98	pld 9,sym@got@pcrel
99		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
1000:	stxv 63,0(9)
101
102	pld 9,sym@got@pcrel
103		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
1040:	stxv 0,0(9)
105
106#offsets are allowed too
107	pld 9,sym@got@pcrel
1080:
109	lbz 3,0x1234(9)
110	.reloc 0b-8,R_PPC64_PCREL_OPT,(.-4)-(0b-8)
111
112#and prefix insns as the second insn
113	pld 9,sym@got@pcrel
1140:
115	plq 4,0x12345678(9)
116	.reloc 0b-8,R_PPC64_PCREL_OPT,(.-8)-(0b-8)
117
118# This should not optimize
119	.extern i
120	.type i,@object
121	pld 9,i@got@pcrel
122		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
1230:	ld 0,0(9)
124
125# and this should edit from GOT indirect to GOT relative
126# ie. change the pld to paddi, leaving the lbz as is.
127	pld 7,sym@got@pcrel
128	lbz 6,0(7)
129
130	pld 9,sym@got@pcrel
131		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
1320:	lxvp 62,0(9)
133
134	pld 9,sym@got@pcrel
135		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
1360:	lxvp 0,0(9)
137
138	pld 9,sym@got@pcrel
139		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
1400:	stxvp 62,0(9)
141
142	pld 9,sym@got@pcrel
143		.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
1440:	stxvp 0,0(9)
145
146	.data
147sym:	.space 32
148