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