~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to arch/powerpc/lib/feature-fixups-test.S

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-tz023xykf0i6eosh
Tags: upstream-3.2.0
ImportĀ upstreamĀ versionĀ 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2008 Michael Ellerman, IBM Corporation.
 
3
 *
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License
 
7
 * as published by the Free Software Foundation; either version
 
8
 * 2 of the License, or (at your option) any later version.
 
9
 */
 
10
 
 
11
#include <asm/feature-fixups.h>
 
12
#include <asm/ppc_asm.h>
 
13
#include <asm/synch.h>
 
14
 
 
15
        .text
 
16
 
 
17
#define globl(x)                \
 
18
        .globl x;       \
 
19
x:
 
20
 
 
21
globl(ftr_fixup_test1)
 
22
        or      1,1,1
 
23
        or      2,2,2   /* fixup will nop out this instruction */
 
24
        or      3,3,3
 
25
 
 
26
globl(end_ftr_fixup_test1)
 
27
 
 
28
globl(ftr_fixup_test1_orig)
 
29
        or      1,1,1
 
30
        or      2,2,2
 
31
        or      3,3,3
 
32
 
 
33
globl(ftr_fixup_test1_expected)
 
34
        or      1,1,1
 
35
        nop
 
36
        or      3,3,3
 
37
 
 
38
globl(ftr_fixup_test2)
 
39
        or      1,1,1
 
40
        or      2,2,2   /* fixup will replace this with ftr_fixup_test2_alt */
 
41
        or      3,3,3
 
42
 
 
43
globl(end_ftr_fixup_test2)
 
44
 
 
45
globl(ftr_fixup_test2_orig)
 
46
        or      1,1,1
 
47
        or      2,2,2
 
48
        or      3,3,3
 
49
 
 
50
globl(ftr_fixup_test2_alt)
 
51
        or      31,31,31
 
52
 
 
53
globl(ftr_fixup_test2_expected)
 
54
        or      1,1,1
 
55
        or      31,31,31
 
56
        or      3,3,3
 
57
 
 
58
globl(ftr_fixup_test3)
 
59
        or      1,1,1
 
60
        or      2,2,2   /* fixup will fail to replace this */
 
61
        or      3,3,3
 
62
 
 
63
globl(end_ftr_fixup_test3)
 
64
 
 
65
globl(ftr_fixup_test3_orig)
 
66
        or      1,1,1
 
67
        or      2,2,2
 
68
        or      3,3,3
 
69
 
 
70
globl(ftr_fixup_test3_alt)
 
71
        or      31,31,31
 
72
        or      31,31,31
 
73
 
 
74
globl(ftr_fixup_test4)
 
75
        or      1,1,1
 
76
        or      2,2,2
 
77
        or      2,2,2
 
78
        or      2,2,2
 
79
        or      2,2,2
 
80
        or      3,3,3
 
81
 
 
82
globl(end_ftr_fixup_test4)
 
83
 
 
84
globl(ftr_fixup_test4_expected)
 
85
        or      1,1,1
 
86
        or      31,31,31
 
87
        or      31,31,31
 
88
        nop
 
89
        nop
 
90
        or      3,3,3
 
91
 
 
92
globl(ftr_fixup_test4_orig)
 
93
        or      1,1,1
 
94
        or      2,2,2
 
95
        or      2,2,2
 
96
        or      2,2,2
 
97
        or      2,2,2
 
98
        or      3,3,3
 
99
 
 
100
globl(ftr_fixup_test4_alt)
 
101
        or      31,31,31
 
102
        or      31,31,31
 
103
 
 
104
 
 
105
globl(ftr_fixup_test5)
 
106
        or      1,1,1
 
107
BEGIN_FTR_SECTION
 
108
        or      2,2,2
 
109
        or      2,2,2
 
110
        or      2,2,2
 
111
        or      2,2,2
 
112
        or      2,2,2
 
113
        or      2,2,2
 
114
        or      2,2,2
 
115
FTR_SECTION_ELSE
 
116
2:      b       3f
 
117
3:      or      5,5,5
 
118
        beq     3b
 
119
        b       1f
 
120
        or      6,6,6
 
121
        b       2b
 
122
1:      bdnz    3b
 
123
ALT_FTR_SECTION_END(0, 1)
 
124
        or      1,1,1
 
125
 
 
126
globl(end_ftr_fixup_test5)
 
127
 
 
128
globl(ftr_fixup_test5_expected)
 
129
        or      1,1,1
 
130
2:      b       3f
 
131
3:      or      5,5,5
 
132
        beq     3b
 
133
        b       1f
 
134
        or      6,6,6
 
135
        b       2b
 
136
1:      bdnz    3b
 
137
        or      1,1,1
 
138
 
 
139
globl(ftr_fixup_test6)
 
140
1:      or      1,1,1
 
141
BEGIN_FTR_SECTION
 
142
        or      5,5,5
 
143
2:      PPC_LCMPI       r3,0
 
144
        beq     4f
 
145
        blt     2b
 
146
        b       1b
 
147
        b       4f
 
148
FTR_SECTION_ELSE
 
149
2:      or      2,2,2
 
150
        PPC_LCMPI       r3,1
 
151
        beq     3f
 
152
        blt     2b
 
153
        b       3f
 
154
        b       1b
 
155
ALT_FTR_SECTION_END(0, 1)
 
156
3:      or      1,1,1
 
157
        or      2,2,2
 
158
4:      or      3,3,3
 
159
 
 
160
globl(end_ftr_fixup_test6)
 
161
 
 
162
globl(ftr_fixup_test6_expected)
 
163
1:      or      1,1,1
 
164
2:      or      2,2,2
 
165
        PPC_LCMPI       r3,1
 
166
        beq     3f
 
167
        blt     2b
 
168
        b       3f
 
169
        b       1b
 
170
2:      or      1,1,1
 
171
        or      2,2,2
 
172
3:      or      3,3,3
 
173
 
 
174
 
 
175
#if 0
 
176
/* Test that if we have a larger else case the assembler spots it and
 
177
 * reports an error. #if 0'ed so as not to break the build normally.
 
178
 */
 
179
ftr_fixup_test7:
 
180
        or      1,1,1
 
181
BEGIN_FTR_SECTION
 
182
        or      2,2,2
 
183
        or      2,2,2
 
184
        or      2,2,2
 
185
FTR_SECTION_ELSE
 
186
        or      3,3,3
 
187
        or      3,3,3
 
188
        or      3,3,3
 
189
        or      3,3,3
 
190
ALT_FTR_SECTION_END(0, 1)
 
191
        or      1,1,1
 
192
#endif
 
193
 
 
194
#define MAKE_MACRO_TEST(TYPE)                                           \
 
195
globl(ftr_fixup_test_ ##TYPE##_macros)                                  \
 
196
        or      1,1,1;                                                  \
 
197
        /* Basic test, this section should all be nop'ed */             \
 
198
BEGIN_##TYPE##_SECTION                                                  \
 
199
        or      2,2,2;                                                  \
 
200
        or      2,2,2;                                                  \
 
201
        or      2,2,2;                                                  \
 
202
END_##TYPE##_SECTION(0, 1)                                              \
 
203
        or      1,1,1;                                                  \
 
204
        or      1,1,1;                                                  \
 
205
        /* Basic test, this section should NOT be nop'ed */             \
 
206
BEGIN_##TYPE##_SECTION                                                  \
 
207
        or      2,2,2;                                                  \
 
208
        or      2,2,2;                                                  \
 
209
        or      2,2,2;                                                  \
 
210
END_##TYPE##_SECTION(0, 0)                                              \
 
211
        or      1,1,1;                                                  \
 
212
        or      1,1,1;                                                  \
 
213
        /* Nesting test, inner section should be nop'ed */              \
 
214
BEGIN_##TYPE##_SECTION                                                  \
 
215
        or      2,2,2;                                                  \
 
216
        or      2,2,2;                                                  \
 
217
BEGIN_##TYPE##_SECTION_NESTED(80)                                       \
 
218
        or      3,3,3;                                                  \
 
219
        or      3,3,3;                                                  \
 
220
END_##TYPE##_SECTION_NESTED(0, 1, 80)                                   \
 
221
        or      2,2,2;                                                  \
 
222
        or      2,2,2;                                                  \
 
223
END_##TYPE##_SECTION(0, 0)                                              \
 
224
        or      1,1,1;                                                  \
 
225
        or      1,1,1;                                                  \
 
226
        /* Nesting test, whole section should be nop'ed */              \
 
227
BEGIN_##TYPE##_SECTION                                                  \
 
228
        or      2,2,2;                                                  \
 
229
        or      2,2,2;                                                  \
 
230
BEGIN_##TYPE##_SECTION_NESTED(80)                                       \
 
231
        or      3,3,3;                                                  \
 
232
        or      3,3,3;                                                  \
 
233
END_##TYPE##_SECTION_NESTED(0, 0, 80)                                   \
 
234
        or      2,2,2;                                                  \
 
235
        or      2,2,2;                                                  \
 
236
END_##TYPE##_SECTION(0, 1)                                              \
 
237
        or      1,1,1;                                                  \
 
238
        or      1,1,1;                                                  \
 
239
        /* Nesting test, none should be nop'ed */                       \
 
240
BEGIN_##TYPE##_SECTION                                                  \
 
241
        or      2,2,2;                                                  \
 
242
        or      2,2,2;                                                  \
 
243
BEGIN_##TYPE##_SECTION_NESTED(80)                                       \
 
244
        or      3,3,3;                                                  \
 
245
        or      3,3,3;                                                  \
 
246
END_##TYPE##_SECTION_NESTED(0, 0, 80)                                   \
 
247
        or      2,2,2;                                                  \
 
248
        or      2,2,2;                                                  \
 
249
END_##TYPE##_SECTION(0, 0)                                              \
 
250
        or      1,1,1;                                                  \
 
251
        or      1,1,1;                                                  \
 
252
        /* Basic alt section test, default case should be taken */      \
 
253
BEGIN_##TYPE##_SECTION                                                  \
 
254
        or      3,3,3;                                                  \
 
255
        or      3,3,3;                                                  \
 
256
        or      3,3,3;                                                  \
 
257
##TYPE##_SECTION_ELSE                                                   \
 
258
        or      5,5,5;                                                  \
 
259
        or      5,5,5;                                                  \
 
260
ALT_##TYPE##_SECTION_END(0, 0)                                          \
 
261
        or      1,1,1;                                                  \
 
262
        or      1,1,1;                                                  \
 
263
        /* Basic alt section test, else case should be taken */         \
 
264
BEGIN_##TYPE##_SECTION                                                  \
 
265
        or      3,3,3;                                                  \
 
266
        or      3,3,3;                                                  \
 
267
        or      3,3,3;                                                  \
 
268
##TYPE##_SECTION_ELSE                                                   \
 
269
        or      31,31,31;                                               \
 
270
        or      31,31,31;                                               \
 
271
        or      31,31,31;                                               \
 
272
ALT_##TYPE##_SECTION_END(0, 1)                                          \
 
273
        or      1,1,1;                                                  \
 
274
        or      1,1,1;                                                  \
 
275
        /* Alt with smaller else case, should be padded with nops */    \
 
276
BEGIN_##TYPE##_SECTION                                                  \
 
277
        or      3,3,3;                                                  \
 
278
        or      3,3,3;                                                  \
 
279
        or      3,3,3;                                                  \
 
280
##TYPE##_SECTION_ELSE                                                   \
 
281
        or      31,31,31;                                               \
 
282
ALT_##TYPE##_SECTION_END(0, 1)                                          \
 
283
        or      1,1,1;                                                  \
 
284
        or      1,1,1;                                                  \
 
285
        /* Alt section with nested section in default case */           \
 
286
        /* Default case should be taken, with nop'ed inner section */   \
 
287
BEGIN_##TYPE##_SECTION                                                  \
 
288
        or      3,3,3;                                                  \
 
289
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
290
        or      3,3,3;                                                  \
 
291
        or      3,3,3;                                                  \
 
292
END_##TYPE##_SECTION_NESTED(0, 1, 95)                                   \
 
293
        or      3,3,3;                                                  \
 
294
##TYPE##_SECTION_ELSE                                                   \
 
295
        or      2,2,2;                                                  \
 
296
        or      2,2,2;                                                  \
 
297
ALT_##TYPE##_SECTION_END(0, 0)                                          \
 
298
        or      1,1,1;                                                  \
 
299
        or      1,1,1;                                                  \
 
300
        /* Alt section with nested section in else, default taken */    \
 
301
BEGIN_##TYPE##_SECTION                                                  \
 
302
        or      3,3,3;                                                  \
 
303
        or      3,3,3;                                                  \
 
304
        or      3,3,3;                                                  \
 
305
##TYPE##_SECTION_ELSE                                                   \
 
306
        or      5,5,5;                                                  \
 
307
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
308
        or      3,3,3;                                                  \
 
309
END_##TYPE##_SECTION_NESTED(0, 1, 95)                                   \
 
310
        or      5,5,5;                                                  \
 
311
ALT_##TYPE##_SECTION_END(0, 0)                                          \
 
312
        or      1,1,1;                                                  \
 
313
        or      1,1,1;                                                  \
 
314
        /* Alt section with nested section in else, else taken & nop */ \
 
315
BEGIN_##TYPE##_SECTION                                                  \
 
316
        or      3,3,3;                                                  \
 
317
        or      3,3,3;                                                  \
 
318
        or      3,3,3;                                                  \
 
319
##TYPE##_SECTION_ELSE                                                   \
 
320
        or      5,5,5;                                                  \
 
321
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
322
        or      3,3,3;                                                  \
 
323
END_##TYPE##_SECTION_NESTED(0, 1, 95)                                   \
 
324
        or      5,5,5;                                                  \
 
325
ALT_##TYPE##_SECTION_END(0, 1)                                          \
 
326
        or      1,1,1;                                                  \
 
327
        or      1,1,1;                                                  \
 
328
        /* Feature section with nested alt section, default taken */    \
 
329
BEGIN_##TYPE##_SECTION                                                  \
 
330
        or      2,2,2;                                                  \
 
331
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
332
        or      1,1,1;                                                  \
 
333
##TYPE##_SECTION_ELSE_NESTED(95)                                        \
 
334
        or      5,5,5;                                                  \
 
335
ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95)                               \
 
336
        or      2,2,2;                                                  \
 
337
END_##TYPE##_SECTION(0, 0)                                              \
 
338
        or      1,1,1;                                                  \
 
339
        or      1,1,1;                                                  \
 
340
        /* Feature section with nested alt section, else taken */       \
 
341
BEGIN_##TYPE##_SECTION                                                  \
 
342
        or      2,2,2;                                                  \
 
343
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
344
        or      1,1,1;                                                  \
 
345
##TYPE##_SECTION_ELSE_NESTED(95)                                        \
 
346
        or      5,5,5;                                                  \
 
347
ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)                               \
 
348
        or      2,2,2;                                                  \
 
349
END_##TYPE##_SECTION(0, 0)                                              \
 
350
        or      1,1,1;                                                  \
 
351
        or      1,1,1;                                                  \
 
352
        /* Feature section with nested alt section, all nop'ed */       \
 
353
BEGIN_##TYPE##_SECTION                                                  \
 
354
        or      2,2,2;                                                  \
 
355
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
356
        or      1,1,1;                                                  \
 
357
##TYPE##_SECTION_ELSE_NESTED(95)                                        \
 
358
        or      5,5,5;                                                  \
 
359
ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95)                               \
 
360
        or      2,2,2;                                                  \
 
361
END_##TYPE##_SECTION(0, 1)                                              \
 
362
        or      1,1,1;                                                  \
 
363
        or      1,1,1;                                                  \
 
364
        /* Nested alt sections, default with inner default taken */     \
 
365
BEGIN_##TYPE##_SECTION                                                  \
 
366
        or      2,2,2;                                                  \
 
367
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
368
        or      1,1,1;                                                  \
 
369
##TYPE##_SECTION_ELSE_NESTED(95)                                        \
 
370
        or      5,5,5;                                                  \
 
371
ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95)                               \
 
372
        or      2,2,2;                                                  \
 
373
##TYPE##_SECTION_ELSE                                                   \
 
374
        or      31,31,31;                                               \
 
375
BEGIN_##TYPE##_SECTION_NESTED(94)                                       \
 
376
        or      5,5,5;                                                  \
 
377
##TYPE##_SECTION_ELSE_NESTED(94)                                        \
 
378
        or      1,1,1;                                                  \
 
379
ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94)                               \
 
380
        or      31,31,31;                                               \
 
381
ALT_##TYPE##_SECTION_END(0, 0)                                          \
 
382
        or      1,1,1;                                                  \
 
383
        or      1,1,1;                                                  \
 
384
        /* Nested alt sections, default with inner else taken */        \
 
385
BEGIN_##TYPE##_SECTION                                                  \
 
386
        or      2,2,2;                                                  \
 
387
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
388
        or      1,1,1;                                                  \
 
389
##TYPE##_SECTION_ELSE_NESTED(95)                                        \
 
390
        or      5,5,5;                                                  \
 
391
ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)                               \
 
392
        or      2,2,2;                                                  \
 
393
##TYPE##_SECTION_ELSE                                                   \
 
394
        or      31,31,31;                                               \
 
395
BEGIN_##TYPE##_SECTION_NESTED(94)                                       \
 
396
        or      5,5,5;                                                  \
 
397
##TYPE##_SECTION_ELSE_NESTED(94)                                        \
 
398
        or      1,1,1;                                                  \
 
399
ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94)                               \
 
400
        or      31,31,31;                                               \
 
401
ALT_##TYPE##_SECTION_END(0, 0)                                          \
 
402
        or      1,1,1;                                                  \
 
403
        or      1,1,1;                                                  \
 
404
        /* Nested alt sections, else with inner default taken */        \
 
405
BEGIN_##TYPE##_SECTION                                                  \
 
406
        or      2,2,2;                                                  \
 
407
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
408
        or      1,1,1;                                                  \
 
409
##TYPE##_SECTION_ELSE_NESTED(95)                                        \
 
410
        or      5,5,5;                                                  \
 
411
ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)                               \
 
412
        or      2,2,2;                                                  \
 
413
##TYPE##_SECTION_ELSE                                                   \
 
414
        or      31,31,31;                                               \
 
415
BEGIN_##TYPE##_SECTION_NESTED(94)                                       \
 
416
        or      5,5,5;                                                  \
 
417
##TYPE##_SECTION_ELSE_NESTED(94)                                        \
 
418
        or      1,1,1;                                                  \
 
419
ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94)                               \
 
420
        or      31,31,31;                                               \
 
421
ALT_##TYPE##_SECTION_END(0, 1)                                          \
 
422
        or      1,1,1;                                                  \
 
423
        or      1,1,1;                                                  \
 
424
        /* Nested alt sections, else with inner else taken */           \
 
425
BEGIN_##TYPE##_SECTION                                                  \
 
426
        or      2,2,2;                                                  \
 
427
BEGIN_##TYPE##_SECTION_NESTED(95)                                       \
 
428
        or      1,1,1;                                                  \
 
429
##TYPE##_SECTION_ELSE_NESTED(95)                                        \
 
430
        or      5,5,5;                                                  \
 
431
ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)                               \
 
432
        or      2,2,2;                                                  \
 
433
##TYPE##_SECTION_ELSE                                                   \
 
434
        or      31,31,31;                                               \
 
435
BEGIN_##TYPE##_SECTION_NESTED(94)                                       \
 
436
        or      5,5,5;                                                  \
 
437
##TYPE##_SECTION_ELSE_NESTED(94)                                        \
 
438
        or      1,1,1;                                                  \
 
439
ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94)                               \
 
440
        or      31,31,31;                                               \
 
441
ALT_##TYPE##_SECTION_END(0, 1)                                          \
 
442
        or      1,1,1;                                                  \
 
443
        or      1,1,1;                                                  \
 
444
        /* Nested alt sections, else can have large else case */        \
 
445
BEGIN_##TYPE##_SECTION                                                  \
 
446
        or      2,2,2;                                                  \
 
447
        or      2,2,2;                                                  \
 
448
        or      2,2,2;                                                  \
 
449
        or      2,2,2;                                                  \
 
450
##TYPE##_SECTION_ELSE                                                   \
 
451
BEGIN_##TYPE##_SECTION_NESTED(94)                                       \
 
452
        or      5,5,5;                                                  \
 
453
        or      5,5,5;                                                  \
 
454
        or      5,5,5;                                                  \
 
455
        or      5,5,5;                                                  \
 
456
##TYPE##_SECTION_ELSE_NESTED(94)                                        \
 
457
        or      1,1,1;                                                  \
 
458
        or      1,1,1;                                                  \
 
459
        or      1,1,1;                                                  \
 
460
        or      1,1,1;                                                  \
 
461
ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94)                               \
 
462
ALT_##TYPE##_SECTION_END(0, 1)                                          \
 
463
        or      1,1,1;                                                  \
 
464
        or      1,1,1;
 
465
 
 
466
#define MAKE_MACRO_TEST_EXPECTED(TYPE)                                  \
 
467
globl(ftr_fixup_test_ ##TYPE##_macros_expected)                         \
 
468
        or      1,1,1;                                                  \
 
469
        /* Basic test, this section should all be nop'ed */             \
 
470
/* BEGIN_##TYPE##_SECTION */                                            \
 
471
        nop;                                                            \
 
472
        nop;                                                            \
 
473
        nop;                                                            \
 
474
/* END_##TYPE##_SECTION(0, 1) */                                        \
 
475
        or      1,1,1;                                                  \
 
476
        or      1,1,1;                                                  \
 
477
        /* Basic test, this section should NOT be nop'ed */             \
 
478
/* BEGIN_##TYPE##_SECTION */                                            \
 
479
        or      2,2,2;                                                  \
 
480
        or      2,2,2;                                                  \
 
481
        or      2,2,2;                                                  \
 
482
/* END_##TYPE##_SECTION(0, 0) */                                        \
 
483
        or      1,1,1;                                                  \
 
484
        or      1,1,1;                                                  \
 
485
        /* Nesting test, inner section should be nop'ed */              \
 
486
/* BEGIN_##TYPE##_SECTION */                                            \
 
487
        or      2,2,2;                                                  \
 
488
        or      2,2,2;                                                  \
 
489
/* BEGIN_##TYPE##_SECTION_NESTED(80) */                                 \
 
490
        nop;                                                            \
 
491
        nop;                                                            \
 
492
/* END_##TYPE##_SECTION_NESTED(0, 1, 80) */                             \
 
493
        or      2,2,2;                                                  \
 
494
        or      2,2,2;                                                  \
 
495
/* END_##TYPE##_SECTION(0, 0) */                                        \
 
496
        or      1,1,1;                                                  \
 
497
        or      1,1,1;                                                  \
 
498
        /* Nesting test, whole section should be nop'ed */              \
 
499
        /* NB. inner section is not nop'ed, but then entire outer is */ \
 
500
/* BEGIN_##TYPE##_SECTION */                                            \
 
501
        nop;                                                            \
 
502
        nop;                                                            \
 
503
/* BEGIN_##TYPE##_SECTION_NESTED(80) */                                 \
 
504
        nop;                                                            \
 
505
        nop;                                                            \
 
506
/* END_##TYPE##_SECTION_NESTED(0, 0, 80) */                             \
 
507
        nop;                                                            \
 
508
        nop;                                                            \
 
509
/* END_##TYPE##_SECTION(0, 1) */                                        \
 
510
        or      1,1,1;                                                  \
 
511
        or      1,1,1;                                                  \
 
512
        /* Nesting test, none should be nop'ed */                       \
 
513
/* BEGIN_##TYPE##_SECTION */                                            \
 
514
        or      2,2,2;                                                  \
 
515
        or      2,2,2;                                                  \
 
516
/* BEGIN_##TYPE##_SECTION_NESTED(80) */                                 \
 
517
        or      3,3,3;                                                  \
 
518
        or      3,3,3;                                                  \
 
519
/* END_##TYPE##_SECTION_NESTED(0, 0, 80) */                             \
 
520
        or      2,2,2;                                                  \
 
521
        or      2,2,2;                                                  \
 
522
/* END_##TYPE##_SECTION(0, 0) */                                        \
 
523
        or      1,1,1;                                                  \
 
524
        or      1,1,1;                                                  \
 
525
        /* Basic alt section test, default case should be taken */      \
 
526
/* BEGIN_##TYPE##_SECTION */                                            \
 
527
        or      3,3,3;                                                  \
 
528
        or      3,3,3;                                                  \
 
529
        or      3,3,3;                                                  \
 
530
/* ##TYPE##_SECTION_ELSE */                                             \
 
531
        /* or   5,5,5; */                                               \
 
532
        /* or   5,5,5; */                                               \
 
533
/* ALT_##TYPE##_SECTION_END(0, 0) */                                    \
 
534
        or      1,1,1;                                                  \
 
535
        or      1,1,1;                                                  \
 
536
        /* Basic alt section test, else case should be taken */         \
 
537
/* BEGIN_##TYPE##_SECTION */                                            \
 
538
        /* or   3,3,3; */                                               \
 
539
        /* or   3,3,3; */                                               \
 
540
        /* or   3,3,3; */                                               \
 
541
/* ##TYPE##_SECTION_ELSE */                                             \
 
542
        or      31,31,31;                                               \
 
543
        or      31,31,31;                                               \
 
544
        or      31,31,31;                                               \
 
545
/* ALT_##TYPE##_SECTION_END(0, 1) */                                    \
 
546
        or      1,1,1;                                                  \
 
547
        or      1,1,1;                                                  \
 
548
        /* Alt with smaller else case, should be padded with nops */    \
 
549
/* BEGIN_##TYPE##_SECTION */                                            \
 
550
        /* or   3,3,3; */                                               \
 
551
        /* or   3,3,3; */                                               \
 
552
        /* or   3,3,3; */                                               \
 
553
/* ##TYPE##_SECTION_ELSE */                                             \
 
554
        or      31,31,31;                                               \
 
555
        nop;                                                            \
 
556
        nop;                                                            \
 
557
/* ALT_##TYPE##_SECTION_END(0, 1) */                                    \
 
558
        or      1,1,1;                                                  \
 
559
        or      1,1,1;                                                  \
 
560
        /* Alt section with nested section in default case */           \
 
561
        /* Default case should be taken, with nop'ed inner section */   \
 
562
/* BEGIN_##TYPE##_SECTION */                                            \
 
563
        or      3,3,3;                                                  \
 
564
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
565
        nop;                                                            \
 
566
        nop;                                                            \
 
567
/* END_##TYPE##_SECTION_NESTED(0, 1, 95) */                             \
 
568
        or      3,3,3;                                                  \
 
569
/* ##TYPE##_SECTION_ELSE */                                             \
 
570
        /* or   2,2,2; */                                               \
 
571
        /* or   2,2,2; */                                               \
 
572
/* ALT_##TYPE##_SECTION_END(0, 0) */                                    \
 
573
        or      1,1,1;                                                  \
 
574
        or      1,1,1;                                                  \
 
575
        /* Alt section with nested section in else, default taken */    \
 
576
/* BEGIN_##TYPE##_SECTION */                                            \
 
577
        or      3,3,3;                                                  \
 
578
        or      3,3,3;                                                  \
 
579
        or      3,3,3;                                                  \
 
580
/* ##TYPE##_SECTION_ELSE */                                             \
 
581
        /* or   5,5,5; */                                               \
 
582
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
583
        /* or   3,3,3; */                                               \
 
584
/* END_##TYPE##_SECTION_NESTED(0, 1, 95) */                             \
 
585
        /* or   5,5,5; */                                               \
 
586
/* ALT_##TYPE##_SECTION_END(0, 0) */                                    \
 
587
        or      1,1,1;                                                  \
 
588
        or      1,1,1;                                                  \
 
589
        /* Alt section with nested section in else, else taken & nop */ \
 
590
/* BEGIN_##TYPE##_SECTION */                                            \
 
591
        /* or   3,3,3; */                                               \
 
592
        /* or   3,3,3; */                                               \
 
593
        /* or   3,3,3; */                                               \
 
594
/* ##TYPE##_SECTION_ELSE */                                             \
 
595
        or      5,5,5;                                                  \
 
596
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
597
        nop;                                                            \
 
598
/* END_##TYPE##_SECTION_NESTED(0, 1, 95) */                             \
 
599
        or      5,5,5;                                                  \
 
600
/* ALT_##TYPE##_SECTION_END(0, 1) */                                    \
 
601
        or      1,1,1;                                                  \
 
602
        or      1,1,1;                                                  \
 
603
        /* Feature section with nested alt section, default taken */    \
 
604
/* BEGIN_##TYPE##_SECTION */                                            \
 
605
        or      2,2,2;                                                  \
 
606
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
607
        or      1,1,1;                                                  \
 
608
/* ##TYPE##_SECTION_ELSE_NESTED(95) */                                  \
 
609
        /* or   5,5,5; */                                               \
 
610
/* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) */                         \
 
611
        or      2,2,2;                                                  \
 
612
/* END_##TYPE##_SECTION(0, 0) */                                        \
 
613
        or      1,1,1;                                                  \
 
614
        or      1,1,1;                                                  \
 
615
        /* Feature section with nested alt section, else taken */       \
 
616
/* BEGIN_##TYPE##_SECTION */                                            \
 
617
        or      2,2,2;                                                  \
 
618
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
619
        /* or   1,1,1; */                                               \
 
620
/* ##TYPE##_SECTION_ELSE_NESTED(95) */                                  \
 
621
        or      5,5,5;                                                  \
 
622
/* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */                         \
 
623
        or      2,2,2;                                                  \
 
624
/* END_##TYPE##_SECTION(0, 0) */                                        \
 
625
        or      1,1,1;                                                  \
 
626
        or      1,1,1;                                                  \
 
627
        /* Feature section with nested alt section, all nop'ed */       \
 
628
/* BEGIN_##TYPE##_SECTION */                                            \
 
629
        nop;                                                            \
 
630
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
631
        nop;                                                            \
 
632
/* ##TYPE##_SECTION_ELSE_NESTED(95) */                                  \
 
633
        /* or   5,5,5; */                                               \
 
634
/* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) */                         \
 
635
        nop;                                                            \
 
636
/* END_##TYPE##_SECTION(0, 1) */                                        \
 
637
        or      1,1,1;                                                  \
 
638
        or      1,1,1;                                                  \
 
639
        /* Nested alt sections, default with inner default taken */     \
 
640
/* BEGIN_##TYPE##_SECTION */                                            \
 
641
        or      2,2,2;                                                  \
 
642
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
643
        or      1,1,1;                                                  \
 
644
/* ##TYPE##_SECTION_ELSE_NESTED(95) */                                  \
 
645
        /* or   5,5,5; */                                               \
 
646
/* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) */                         \
 
647
        or      2,2,2;                                                  \
 
648
/* ##TYPE##_SECTION_ELSE */                                             \
 
649
        /* or   31,31,31; */                                            \
 
650
/* BEGIN_##TYPE##_SECTION_NESTED(94) */                                 \
 
651
        /* or   5,5,5; */                                               \
 
652
/* ##TYPE##_SECTION_ELSE_NESTED(94) */                                  \
 
653
        /* or   1,1,1; */                                               \
 
654
/* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) */                         \
 
655
        /* or   31,31,31; */                                            \
 
656
/* ALT_##TYPE##_SECTION_END(0, 0) */                                    \
 
657
        or      1,1,1;                                                  \
 
658
        or      1,1,1;                                                  \
 
659
        /* Nested alt sections, default with inner else taken */        \
 
660
/* BEGIN_##TYPE##_SECTION */                                            \
 
661
        or      2,2,2;                                                  \
 
662
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
663
        /* or   1,1,1; */                                               \
 
664
/* ##TYPE##_SECTION_ELSE_NESTED(95) */                                  \
 
665
        or      5,5,5;                                                  \
 
666
/* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */                         \
 
667
        or      2,2,2;                                                  \
 
668
/* ##TYPE##_SECTION_ELSE */                                             \
 
669
        /* or   31,31,31; */                                            \
 
670
/* BEGIN_##TYPE##_SECTION_NESTED(94) */                                 \
 
671
        /* or   5,5,5; */                                               \
 
672
/* ##TYPE##_SECTION_ELSE_NESTED(94) */                                  \
 
673
        /* or   1,1,1; */                                               \
 
674
/* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) */                         \
 
675
        /* or   31,31,31; */                                            \
 
676
/* ALT_##TYPE##_SECTION_END(0, 0) */                                    \
 
677
        or      1,1,1;                                                  \
 
678
        or      1,1,1;                                                  \
 
679
        /* Nested alt sections, else with inner default taken */        \
 
680
/* BEGIN_##TYPE##_SECTION */                                            \
 
681
        /* or   2,2,2; */                                               \
 
682
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
683
        /* or   1,1,1; */                                               \
 
684
/* ##TYPE##_SECTION_ELSE_NESTED(95) */                                  \
 
685
        /* or   5,5,5; */                                               \
 
686
/* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */                         \
 
687
        /* or   2,2,2; */                                               \
 
688
/* ##TYPE##_SECTION_ELSE */                                             \
 
689
        or      31,31,31;                                               \
 
690
/* BEGIN_##TYPE##_SECTION_NESTED(94) */                                 \
 
691
        or      5,5,5;                                                  \
 
692
/* ##TYPE##_SECTION_ELSE_NESTED(94) */                                  \
 
693
        /* or   1,1,1; */                                               \
 
694
/* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) */                         \
 
695
        or      31,31,31;                                               \
 
696
/* ALT_##TYPE##_SECTION_END(0, 1) */                                    \
 
697
        or      1,1,1;                                                  \
 
698
        or      1,1,1;                                                  \
 
699
        /* Nested alt sections, else with inner else taken */           \
 
700
/* BEGIN_##TYPE##_SECTION */                                            \
 
701
        /* or   2,2,2; */                                               \
 
702
/* BEGIN_##TYPE##_SECTION_NESTED(95) */                                 \
 
703
        /* or   1,1,1; */                                               \
 
704
/* ##TYPE##_SECTION_ELSE_NESTED(95) */                                  \
 
705
        /* or   5,5,5; */                                               \
 
706
/* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */                         \
 
707
        /* or   2,2,2; */                                               \
 
708
/* ##TYPE##_SECTION_ELSE */                                             \
 
709
        or      31,31,31;                                               \
 
710
/* BEGIN_##TYPE##_SECTION_NESTED(94) */                                 \
 
711
        /* or   5,5,5; */                                               \
 
712
/* ##TYPE##_SECTION_ELSE_NESTED(94) */                                  \
 
713
        or      1,1,1;                                                  \
 
714
/* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94) */                         \
 
715
        or      31,31,31;                                               \
 
716
/* ALT_##TYPE##_SECTION_END(0, 1) */                                    \
 
717
        or      1,1,1;                                                  \
 
718
        or      1,1,1;                                                  \
 
719
        /* Nested alt sections, else can have large else case */        \
 
720
/* BEGIN_##TYPE##_SECTION */                                            \
 
721
        /* or   2,2,2; */                                               \
 
722
        /* or   2,2,2; */                                               \
 
723
        /* or   2,2,2; */                                               \
 
724
        /* or   2,2,2; */                                               \
 
725
/* ##TYPE##_SECTION_ELSE */                                             \
 
726
/* BEGIN_##TYPE##_SECTION_NESTED(94) */                                 \
 
727
        /* or   5,5,5; */                                               \
 
728
        /* or   5,5,5; */                                               \
 
729
        /* or   5,5,5; */                                               \
 
730
        /* or   5,5,5; */                                               \
 
731
/* ##TYPE##_SECTION_ELSE_NESTED(94) */                                  \
 
732
        or      1,1,1;                                                  \
 
733
        or      1,1,1;                                                  \
 
734
        or      1,1,1;                                                  \
 
735
        or      1,1,1;                                                  \
 
736
/* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94) */                         \
 
737
/* ALT_##TYPE##_SECTION_END(0, 1) */                                    \
 
738
        or      1,1,1;                                                  \
 
739
        or      1,1,1;
 
740
 
 
741
MAKE_MACRO_TEST(FTR);
 
742
MAKE_MACRO_TEST_EXPECTED(FTR);
 
743
 
 
744
#ifdef CONFIG_PPC64
 
745
MAKE_MACRO_TEST(FW_FTR);
 
746
MAKE_MACRO_TEST_EXPECTED(FW_FTR);
 
747
#endif
 
748
 
 
749
globl(lwsync_fixup_test)
 
750
1:      or      1,1,1
 
751
        LWSYNC
 
752
globl(end_lwsync_fixup_test)
 
753
 
 
754
globl(lwsync_fixup_test_expected_LWSYNC)
 
755
1:      or      1,1,1
 
756
        lwsync
 
757
 
 
758
globl(lwsync_fixup_test_expected_SYNC)
 
759
1:      or      1,1,1
 
760
        sync
 
761