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