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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
;
; Test that branches work: 8- and 16-bit all insns, relaxing to
; 32-bit, forward and backward. No need to check the border
; cases for *all* insns.
;
.text
start_original:
nop
startm32: ; start start2 start3
nop
.space 32750-(256-21*2+20)-(21*2+10*2+21*4)-12,0
startm16:
nop
; The size of a bunch of short branches is start2-start = 42,
; so make the threshold be dependent of the size of that block,
; for the next block; half of them will be relaxed.
.space 256-21*2-20,0
start:
nop
ba start
bcc start
bcs start
beq start
bwf start
bext start
bext start ; leftover, used to be never-implemented "bir"
bge start
bgt start
bhi start
bhs start
ble start
blo start
bls start
blt start
bmi start
bne start
bpl start
bvc start
bvs start
start2:
nop
ba startm16
bcc startm16
bcs startm16
beq startm16
bwf startm16
bext startm16
bext startm16
bge startm16
bgt startm16
bhi startm16
bhs startm16
ble startm16
blo startm16
bls startm16
blt startm16
bmi startm16
bne startm16
bpl startm16
bvc startm16
bvs startm16
start3:
; Ok, once more to make sure *all* 16-bit variants get ok for
; backward references.
nop
ba startm16
bcc startm16
bcs startm16
beq startm16
bwf startm16
bext startm16
bext startm16
bge startm16
bgt startm16
bhi startm16
bhs startm16
ble startm16
blo startm16
bls startm16
blt startm16
bmi startm16
bne startm16
bpl startm16
bvc startm16
bvs startm16
;
; Now check that dynamically relaxing some of these branches
; from 16-bit to 32-bit works.
;
start4:
nop
ba startm32
bcc startm32
bcs startm32
beq startm32
bwf startm32
bext startm32
bext startm32
bge startm32
bgt startm32
bhi startm32
bhs startm32
ble startm32
blo startm32
bls startm32
blt startm32
bmi startm32
bne startm32
bpl startm32
bvc startm32
bvs startm32
;
; Again, so all insns get to be tested for 32-bit relaxing.
;
start5:
nop
ba startm32
bcc startm32
bcs startm32
beq startm32
bwf startm32
bext startm32
bext startm32
bge startm32
bgt startm32
bhi startm32
bhs startm32
ble startm32
blo startm32
bls startm32
blt startm32
bmi startm32
bne startm32
bpl startm32
bvc startm32
bvs startm32
;
; Now test forward references. Symmetrically as above.
;
; All to 32-bit:
start6:
nop
ba endp32
bcc endp32
bcs endp32
beq endp32
bwf endp32
bext endp32
bext endp32
bge endp32
bgt endp32
bhi endp32
bhs endp32
ble endp32
blo endp32
bls endp32
blt endp32
bmi endp32
bne endp32
bpl endp32
bvc endp32
bvs endp32
;
; Some get relaxed:
;
start7:
nop
ba endp32
bcc endp32
bcs endp32
beq endp32
bwf endp32
bext endp32
bext endp32
bge endp32
bgt endp32
bhi endp32
bhs endp32
ble endp32
blo endp32
bls endp32
blt endp32
bmi endp32
bne endp32
bpl endp32
bvc endp32
bvs endp32
;
; All to 16-bit:
;
start8:
nop
ba endp16
bcc endp16
bcs endp16
beq endp16
bwf endp16
bext endp16
bext endp16
bge endp16
bgt endp16
bhi endp16
bhs endp16
ble endp16
blo endp16
bls endp16
blt endp16
bmi endp16
bne endp16
bpl endp16
bvc endp16
bvs endp16
;
; Some relaxing:
;
start9:
nop
ba endp16
bcc endp16
bcs endp16
beq endp16
bwf endp16
bext endp16
bext endp16
bge endp16
bgt endp16
bhi endp16
bhs endp16
ble endp16
blo endp16
bls endp16
blt endp16
bmi endp16
bne endp16
bpl endp16
bvc endp16
bvs endp16
;
; And all the short ones, forward.
;
start10:
ba end
bcc end
bcs end
beq end
bwf end
bext end
bext end
bge end
bgt end
bhi end
bhs end
ble end
blo end
bls end
blt end
bmi end
bne end
bpl end
bvc end
bvs end
nop
end:
nop
.space 256-21*2-20,0
endp16:
nop
.space 32750-(256-21*2+20)-(21*2+10*2+21*4)-12,0
endp32:
nop
|