1*1424dfb3Schristos;;; Test 68HC11 linker relaxation (group relax)
2*1424dfb3Schristos;;;
3*1424dfb3Schristos	.sect .text
4*1424dfb3Schristos	.globl _start
5*1424dfb3Schristos_start:
6*1424dfb3Schristos;;;
7*1424dfb3Schristos;;; The following group of instructions are adjusted.
8*1424dfb3Schristos;;;
9*1424dfb3Schristos	.relax	L1x
10*1424dfb3Schristos	ldx	#table
11*1424dfb3Schristos	bset	0,x #4
12*1424dfb3SchristosL1x:
13*1424dfb3Schristos	.relax	L1y
14*1424dfb3Schristos	ldy	#table
15*1424dfb3Schristos	bset	0,y #4
16*1424dfb3SchristosL1y:
17*1424dfb3Schristos	.relax	L2x
18*1424dfb3Schristos	ldx	#table+3
19*1424dfb3Schristos	bset	0,x #4
20*1424dfb3Schristos	bset	1,x #8
21*1424dfb3SchristosL2x:
22*1424dfb3Schristos	.relax	L2y
23*1424dfb3Schristos	ldy	#table+3
24*1424dfb3Schristos	bset	0,y #4
25*1424dfb3Schristos	bset	1,y #8
26*1424dfb3SchristosL2y:
27*1424dfb3Schristos	.relax	L3x
28*1424dfb3Schristos	ldx	#table+6
29*1424dfb3Schristos	bset	0,x #4
30*1424dfb3Schristos	bset	1,x #8
31*1424dfb3Schristos	bset	2,x #12
32*1424dfb3Schristos	bset	3,x #12
33*1424dfb3Schristos	bset	4,x #12
34*1424dfb3Schristos	bset	5,x #12
35*1424dfb3SchristosL3x:
36*1424dfb3Schristos	.relax	L3y
37*1424dfb3Schristos	ldy	#table+6
38*1424dfb3Schristos	bset	0,y #4
39*1424dfb3Schristos	bset	1,y #8
40*1424dfb3Schristos	bset	2,y #12
41*1424dfb3Schristos	bset	3,y #12
42*1424dfb3Schristos	bset	4,y #12
43*1424dfb3Schristos	bset	5,y #12
44*1424dfb3SchristosL3y:
45*1424dfb3Schristos	;; Next branch is always relative.  It must be adjusted while
46*1424dfb3Schristos	;; above instructions are relaxed.
47*1424dfb3Schristos	bra	_start
48*1424dfb3Schristos;;;
49*1424dfb3Schristos;;; This group has the first two bset insn relaxable while the
50*1424dfb3Schristos;;; others are not.  The ldx/ldy must not be removed.
51*1424dfb3Schristos;;;
52*1424dfb3Schristos	.relax	L4x
53*1424dfb3Schristos	ldx	#table+0xfe
54*1424dfb3Schristos	bset	0,x #4
55*1424dfb3Schristos	bset	1,x #8
56*1424dfb3Schristos	bset	2,x #12
57*1424dfb3Schristos	bset	3,x #12
58*1424dfb3Schristos	bset	4,x #12
59*1424dfb3Schristos	bset	5,x #12
60*1424dfb3SchristosL4x:
61*1424dfb3Schristos	.relax	L4y
62*1424dfb3Schristos	ldy	#table+0xfe
63*1424dfb3Schristos	bset	0,y #4
64*1424dfb3Schristos	bset	1,y #8
65*1424dfb3Schristos	bset	2,y #12
66*1424dfb3Schristos	bset	3,y #12
67*1424dfb3Schristos	bset	4,y #12
68*1424dfb3Schristos	bset	5,y #12
69*1424dfb3SchristosL4y:
70*1424dfb3Schristos;;;
71*1424dfb3Schristos;;; Relax group for bclr
72*1424dfb3Schristos;;;
73*1424dfb3Schristos	.relax	L5x
74*1424dfb3Schristos	ldx	#table+10
75*1424dfb3Schristos	bclr	0,x #4
76*1424dfb3Schristos	bclr	1,x #8
77*1424dfb3SchristosL5x:
78*1424dfb3Schristos	.relax	L5y
79*1424dfb3Schristos	ldy	#table+16
80*1424dfb3Schristos	bclr	10,y #4
81*1424dfb3Schristos	bclr	11,y #8
82*1424dfb3SchristosL5y:
83*1424dfb3Schristos;;;
84*1424dfb3Schristos;;; Relax group for brset (with backward branch)
85*1424dfb3Schristos;;;
86*1424dfb3Schristos	.relax	L6x
87*1424dfb3Schristos	ldx	#table+8
88*1424dfb3Schristos	brset	0,x #4 L5y
89*1424dfb3SchristosL6x:
90*1424dfb3Schristos	.relax	L7x
91*1424dfb3Schristos	ldy	#table+8
92*1424dfb3Schristos	brset	0,y #4 L6x
93*1424dfb3SchristosL7x:
94*1424dfb3Schristos;;;
95*1424dfb3Schristos;;; Relax group for brset (with forward branch)
96*1424dfb3Schristos;;;
97*1424dfb3Schristos	.relax	L8x
98*1424dfb3Schristos	ldx	#table+8
99*1424dfb3Schristos	brset	0,x #4 brend
100*1424dfb3SchristosL8x:
101*1424dfb3Schristos	.relax	L8y
102*1424dfb3Schristos	ldy	#table+8
103*1424dfb3Schristos	brset	0,y #4 brend
104*1424dfb3SchristosL8y:
105*1424dfb3Schristos;;;
106*1424dfb3Schristos;;; Relax group for brclr (with backward branch)
107*1424dfb3Schristos;;;
108*1424dfb3Schristos	.relax	L9x
109*1424dfb3Schristos	ldx	#table+8
110*1424dfb3Schristos	brclr	0,x #4 L8y
111*1424dfb3SchristosL9x:
112*1424dfb3Schristos	.relax	L9y
113*1424dfb3Schristos	ldy	#table+8
114*1424dfb3Schristos	brclr	0,y #4 L9x
115*1424dfb3SchristosL9y:
116*1424dfb3Schristos;;;
117*1424dfb3Schristos;;; Relax group for brclr (with forward branch)
118*1424dfb3Schristos;;;
119*1424dfb3Schristos	.relax	L10x
120*1424dfb3Schristos	ldx	#table+8
121*1424dfb3Schristos	brclr	0,x #4 brend
122*1424dfb3SchristosL10x:
123*1424dfb3Schristos	.relax	L10y
124*1424dfb3Schristos	ldy	#table+8
125*1424dfb3Schristos	brclr	0,y #4 brend
126*1424dfb3SchristosL10y:
127*1424dfb3Schristos	nop
128*1424dfb3Schristosbrend:
129*1424dfb3Schristos;;;
130*1424dfb3Schristos;;; The following are wrong use of .relax groups.
131*1424dfb3Schristos;;;
132*1424dfb3Schristos	.relax	w1
133*1424dfb3Schristosw1:
134*1424dfb3Schristos	.relax	w2
135*1424dfb3Schristos	bset	0,x #4
136*1424dfb3Schristosw2:
137*1424dfb3Schristos	.relax w3
138*1424dfb3Schristos	ldx	#table
139*1424dfb3Schristosw3:
140*1424dfb3Schristos	.relax w4
141*1424dfb3Schristos	ldy	#table+8
142*1424dfb3Schristosw4:
143*1424dfb3Schristos	.relax w5
144*1424dfb3Schristos	rts
145*1424dfb3Schristosw5:
146*1424dfb3Schristos;;;
147*1424dfb3Schristos;;; Next insn is not in a .relax group
148*1424dfb3Schristos	ldx	#table
149*1424dfb3Schristos	bset	0,x #5
150*1424dfb3Schristos	bra	_start
151*1424dfb3Schristos	rts
152*1424dfb3Schristos
153*1424dfb3Schristos	.sect .page0
154*1424dfb3Schristos	.globl table
155*1424dfb3Schristostable:	.long 0
156*1424dfb3Schristostable4:	.long 0
157*1424dfb3Schristostable8:	.long 0
158*1424dfb3Schristos	.skip	10
159*1424dfb3Schristosend_table:
160*1424dfb3Schristos	.long 0
161*1424dfb3Schristos
162