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