Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright 2008 Michael Ellerman, IBM Corporation.
0004  */
0005 
0006 #include <asm/feature-fixups.h>
0007 #include <asm/ppc_asm.h>
0008 #include <asm/synch.h>
0009 #include <asm/asm-compat.h>
0010 #include <asm/ppc-opcode.h>
0011 
0012     .text
0013 
0014 #define globl(x)        \
0015     .globl x;   \
0016 x:
0017 
0018 globl(ftr_fixup_test1)
0019     or  1,1,1
0020     or  2,2,2   /* fixup will nop out this instruction */
0021     or  3,3,3
0022 
0023 globl(end_ftr_fixup_test1)
0024 
0025 globl(ftr_fixup_test1_orig)
0026     or  1,1,1
0027     or  2,2,2
0028     or  3,3,3
0029 
0030 globl(ftr_fixup_test1_expected)
0031     or  1,1,1
0032     nop
0033     or  3,3,3
0034 
0035 globl(ftr_fixup_test2)
0036     or  1,1,1
0037     or  2,2,2   /* fixup will replace this with ftr_fixup_test2_alt */
0038     or  3,3,3
0039 
0040 globl(end_ftr_fixup_test2)
0041 
0042 globl(ftr_fixup_test2_orig)
0043     or  1,1,1
0044     or  2,2,2
0045     or  3,3,3
0046 
0047 globl(ftr_fixup_test2_alt)
0048     or  31,31,31
0049 
0050 globl(ftr_fixup_test2_expected)
0051     or  1,1,1
0052     or  31,31,31
0053     or  3,3,3
0054 
0055 globl(ftr_fixup_test3)
0056     or  1,1,1
0057     or  2,2,2   /* fixup will fail to replace this */
0058     or  3,3,3
0059 
0060 globl(end_ftr_fixup_test3)
0061 
0062 globl(ftr_fixup_test3_orig)
0063     or  1,1,1
0064     or  2,2,2
0065     or  3,3,3
0066 
0067 globl(ftr_fixup_test3_alt)
0068     or  31,31,31
0069     or  31,31,31
0070 
0071 globl(ftr_fixup_test4)
0072     or  1,1,1
0073     or  2,2,2
0074     or  2,2,2
0075     or  2,2,2
0076     or  2,2,2
0077     or  3,3,3
0078 
0079 globl(end_ftr_fixup_test4)
0080 
0081 globl(ftr_fixup_test4_expected)
0082     or  1,1,1
0083     or  31,31,31
0084     or  31,31,31
0085     nop
0086     nop
0087     or  3,3,3
0088 
0089 globl(ftr_fixup_test4_orig)
0090     or  1,1,1
0091     or  2,2,2
0092     or  2,2,2
0093     or  2,2,2
0094     or  2,2,2
0095     or  3,3,3
0096 
0097 globl(ftr_fixup_test4_alt)
0098     or  31,31,31
0099     or  31,31,31
0100 
0101 
0102 globl(ftr_fixup_test5)
0103     or  1,1,1
0104 BEGIN_FTR_SECTION
0105     or  2,2,2
0106     or  2,2,2
0107     or  2,2,2
0108     or  2,2,2
0109     or  2,2,2
0110     or  2,2,2
0111     or  2,2,2
0112 FTR_SECTION_ELSE
0113 2:  b   3f
0114 3:  or  5,5,5
0115     beq 3b
0116     b   1f
0117     or  6,6,6
0118     b   2b
0119 1:  bdnz    3b
0120 ALT_FTR_SECTION_END(0, 1)
0121     or  1,1,1
0122 
0123 globl(end_ftr_fixup_test5)
0124 
0125 globl(ftr_fixup_test5_expected)
0126     or  1,1,1
0127 2:  b   3f
0128 3:  or  5,5,5
0129     beq 3b
0130     b   1f
0131     or  6,6,6
0132     b   2b
0133 1:  bdnz    3b
0134     or  1,1,1
0135 
0136 globl(ftr_fixup_test6)
0137 1:  or  1,1,1
0138 BEGIN_FTR_SECTION
0139     or  5,5,5
0140 2:  PPC_LCMPI   r3,0
0141     beq 4f
0142     blt 2b
0143     b   1b
0144     b   4f
0145 FTR_SECTION_ELSE
0146 2:  or  2,2,2
0147     PPC_LCMPI   r3,1
0148     beq 3f
0149     blt 2b
0150     b   3f
0151     b   1b
0152 ALT_FTR_SECTION_END(0, 1)
0153 3:  or  1,1,1
0154     or  2,2,2
0155 4:  or  3,3,3
0156 
0157 globl(end_ftr_fixup_test6)
0158 
0159 globl(ftr_fixup_test6_expected)
0160 1:  or  1,1,1
0161 2:  or  2,2,2
0162     PPC_LCMPI   r3,1
0163     beq 3f
0164     blt 2b
0165     b   3f
0166     b   1b
0167 3:  or  1,1,1
0168     or  2,2,2
0169     or  3,3,3
0170 
0171 globl(ftr_fixup_test7)
0172     or  1,1,1
0173 BEGIN_FTR_SECTION
0174     or  2,2,2
0175     or  2,2,2
0176     or  2,2,2
0177     or  2,2,2
0178     or  2,2,2
0179     or  2,2,2
0180     or  2,2,2
0181 FTR_SECTION_ELSE
0182 2:  b   3f
0183 3:  or  5,5,5
0184     beq 3b
0185     b   1f
0186     or  6,6,6
0187     b   2b
0188     bdnz    3b
0189 1:
0190 ALT_FTR_SECTION_END(0, 1)
0191     or  1,1,1
0192     or  1,1,1
0193 
0194 globl(end_ftr_fixup_test7)
0195     nop
0196 
0197 globl(ftr_fixup_test7_expected)
0198     or  1,1,1
0199 2:  b   3f
0200 3:  or  5,5,5
0201     beq 3b
0202     b   1f
0203     or  6,6,6
0204     b   2b
0205     bdnz    3b
0206 1:  or  1,1,1
0207 
0208 #if 0
0209 /* Test that if we have a larger else case the assembler spots it and
0210  * reports an error. #if 0'ed so as not to break the build normally.
0211  */
0212 ftr_fixup_test_too_big:
0213     or  1,1,1
0214 BEGIN_FTR_SECTION
0215     or  2,2,2
0216     or  2,2,2
0217     or  2,2,2
0218 FTR_SECTION_ELSE
0219     or  3,3,3
0220     or  3,3,3
0221     or  3,3,3
0222     or  3,3,3
0223 ALT_FTR_SECTION_END(0, 1)
0224     or  1,1,1
0225 #endif
0226 
0227 #define MAKE_MACRO_TEST(TYPE)                       \
0228 globl(ftr_fixup_test_ ##TYPE##_macros)                  \
0229     or  1,1,1;                          \
0230     /* Basic test, this section should all be nop'ed */     \
0231 BEGIN_##TYPE##_SECTION                          \
0232     or  2,2,2;                          \
0233     or  2,2,2;                          \
0234     or  2,2,2;                          \
0235 END_##TYPE##_SECTION(0, 1)                      \
0236     or  1,1,1;                          \
0237     or  1,1,1;                          \
0238     /* Basic test, this section should NOT be nop'ed */     \
0239 BEGIN_##TYPE##_SECTION                          \
0240     or  2,2,2;                          \
0241     or  2,2,2;                          \
0242     or  2,2,2;                          \
0243 END_##TYPE##_SECTION(0, 0)                      \
0244     or  1,1,1;                          \
0245     or  1,1,1;                          \
0246     /* Nesting test, inner section should be nop'ed */      \
0247 BEGIN_##TYPE##_SECTION                          \
0248     or  2,2,2;                          \
0249     or  2,2,2;                          \
0250 BEGIN_##TYPE##_SECTION_NESTED(80)                   \
0251     or  3,3,3;                          \
0252     or  3,3,3;                          \
0253 END_##TYPE##_SECTION_NESTED(0, 1, 80)                   \
0254     or  2,2,2;                          \
0255     or  2,2,2;                          \
0256 END_##TYPE##_SECTION(0, 0)                      \
0257     or  1,1,1;                          \
0258     or  1,1,1;                          \
0259     /* Nesting test, whole section should be nop'ed */      \
0260 BEGIN_##TYPE##_SECTION                          \
0261     or  2,2,2;                          \
0262     or  2,2,2;                          \
0263 BEGIN_##TYPE##_SECTION_NESTED(80)                   \
0264     or  3,3,3;                          \
0265     or  3,3,3;                          \
0266 END_##TYPE##_SECTION_NESTED(0, 0, 80)                   \
0267     or  2,2,2;                          \
0268     or  2,2,2;                          \
0269 END_##TYPE##_SECTION(0, 1)                      \
0270     or  1,1,1;                          \
0271     or  1,1,1;                          \
0272     /* Nesting test, none should be nop'ed */           \
0273 BEGIN_##TYPE##_SECTION                          \
0274     or  2,2,2;                          \
0275     or  2,2,2;                          \
0276 BEGIN_##TYPE##_SECTION_NESTED(80)                   \
0277     or  3,3,3;                          \
0278     or  3,3,3;                          \
0279 END_##TYPE##_SECTION_NESTED(0, 0, 80)                   \
0280     or  2,2,2;                          \
0281     or  2,2,2;                          \
0282 END_##TYPE##_SECTION(0, 0)                      \
0283     or  1,1,1;                          \
0284     or  1,1,1;                          \
0285     /* Basic alt section test, default case should be taken */  \
0286 BEGIN_##TYPE##_SECTION                          \
0287     or  3,3,3;                          \
0288     or  3,3,3;                          \
0289     or  3,3,3;                          \
0290 ##TYPE##_SECTION_ELSE                           \
0291     or  5,5,5;                          \
0292     or  5,5,5;                          \
0293 ALT_##TYPE##_SECTION_END(0, 0)                      \
0294     or  1,1,1;                          \
0295     or  1,1,1;                          \
0296     /* Basic alt section test, else case should be taken */     \
0297 BEGIN_##TYPE##_SECTION                          \
0298     or  3,3,3;                          \
0299     or  3,3,3;                          \
0300     or  3,3,3;                          \
0301 ##TYPE##_SECTION_ELSE                           \
0302     or  31,31,31;                       \
0303     or  31,31,31;                       \
0304     or  31,31,31;                       \
0305 ALT_##TYPE##_SECTION_END(0, 1)                      \
0306     or  1,1,1;                          \
0307     or  1,1,1;                          \
0308     /* Alt with smaller else case, should be padded with nops */    \
0309 BEGIN_##TYPE##_SECTION                          \
0310     or  3,3,3;                          \
0311     or  3,3,3;                          \
0312     or  3,3,3;                          \
0313 ##TYPE##_SECTION_ELSE                           \
0314     or  31,31,31;                       \
0315 ALT_##TYPE##_SECTION_END(0, 1)                      \
0316     or  1,1,1;                          \
0317     or  1,1,1;                          \
0318     /* Alt section with nested section in default case */       \
0319     /* Default case should be taken, with nop'ed inner section */   \
0320 BEGIN_##TYPE##_SECTION                          \
0321     or  3,3,3;                          \
0322 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0323     or  3,3,3;                          \
0324     or  3,3,3;                          \
0325 END_##TYPE##_SECTION_NESTED(0, 1, 95)                   \
0326     or  3,3,3;                          \
0327 ##TYPE##_SECTION_ELSE                           \
0328     or  2,2,2;                          \
0329     or  2,2,2;                          \
0330 ALT_##TYPE##_SECTION_END(0, 0)                      \
0331     or  1,1,1;                          \
0332     or  1,1,1;                          \
0333     /* Alt section with nested section in else, default taken */    \
0334 BEGIN_##TYPE##_SECTION                          \
0335     or  3,3,3;                          \
0336     or  3,3,3;                          \
0337     or  3,3,3;                          \
0338 ##TYPE##_SECTION_ELSE                           \
0339     or  5,5,5;                          \
0340 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0341     or  3,3,3;                          \
0342 END_##TYPE##_SECTION_NESTED(0, 1, 95)                   \
0343     or  5,5,5;                          \
0344 ALT_##TYPE##_SECTION_END(0, 0)                      \
0345     or  1,1,1;                          \
0346     or  1,1,1;                          \
0347     /* Alt section with nested section in else, else taken & nop */ \
0348 BEGIN_##TYPE##_SECTION                          \
0349     or  3,3,3;                          \
0350     or  3,3,3;                          \
0351     or  3,3,3;                          \
0352 ##TYPE##_SECTION_ELSE                           \
0353     or  5,5,5;                          \
0354 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0355     or  3,3,3;                          \
0356 END_##TYPE##_SECTION_NESTED(0, 1, 95)                   \
0357     or  5,5,5;                          \
0358 ALT_##TYPE##_SECTION_END(0, 1)                      \
0359     or  1,1,1;                          \
0360     or  1,1,1;                          \
0361     /* Feature section with nested alt section, default taken */    \
0362 BEGIN_##TYPE##_SECTION                          \
0363     or  2,2,2;                          \
0364 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0365     or  1,1,1;                          \
0366 ##TYPE##_SECTION_ELSE_NESTED(95)                    \
0367     or  5,5,5;                          \
0368 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95)               \
0369     or  2,2,2;                          \
0370 END_##TYPE##_SECTION(0, 0)                      \
0371     or  1,1,1;                          \
0372     or  1,1,1;                          \
0373     /* Feature section with nested alt section, else taken */   \
0374 BEGIN_##TYPE##_SECTION                          \
0375     or  2,2,2;                          \
0376 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0377     or  1,1,1;                          \
0378 ##TYPE##_SECTION_ELSE_NESTED(95)                    \
0379     or  5,5,5;                          \
0380 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)               \
0381     or  2,2,2;                          \
0382 END_##TYPE##_SECTION(0, 0)                      \
0383     or  1,1,1;                          \
0384     or  1,1,1;                          \
0385     /* Feature section with nested alt section, all nop'ed */   \
0386 BEGIN_##TYPE##_SECTION                          \
0387     or  2,2,2;                          \
0388 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0389     or  1,1,1;                          \
0390 ##TYPE##_SECTION_ELSE_NESTED(95)                    \
0391     or  5,5,5;                          \
0392 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95)               \
0393     or  2,2,2;                          \
0394 END_##TYPE##_SECTION(0, 1)                      \
0395     or  1,1,1;                          \
0396     or  1,1,1;                          \
0397     /* Nested alt sections, default with inner default taken */ \
0398 BEGIN_##TYPE##_SECTION                          \
0399     or  2,2,2;                          \
0400 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0401     or  1,1,1;                          \
0402 ##TYPE##_SECTION_ELSE_NESTED(95)                    \
0403     or  5,5,5;                          \
0404 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95)               \
0405     or  2,2,2;                          \
0406 ##TYPE##_SECTION_ELSE                           \
0407     or  31,31,31;                       \
0408 BEGIN_##TYPE##_SECTION_NESTED(94)                   \
0409     or  5,5,5;                          \
0410 ##TYPE##_SECTION_ELSE_NESTED(94)                    \
0411     or  1,1,1;                          \
0412 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94)               \
0413     or  31,31,31;                       \
0414 ALT_##TYPE##_SECTION_END(0, 0)                      \
0415     or  1,1,1;                          \
0416     or  1,1,1;                          \
0417     /* Nested alt sections, default with inner else taken */    \
0418 BEGIN_##TYPE##_SECTION                          \
0419     or  2,2,2;                          \
0420 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0421     or  1,1,1;                          \
0422 ##TYPE##_SECTION_ELSE_NESTED(95)                    \
0423     or  5,5,5;                          \
0424 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)               \
0425     or  2,2,2;                          \
0426 ##TYPE##_SECTION_ELSE                           \
0427     or  31,31,31;                       \
0428 BEGIN_##TYPE##_SECTION_NESTED(94)                   \
0429     or  5,5,5;                          \
0430 ##TYPE##_SECTION_ELSE_NESTED(94)                    \
0431     or  1,1,1;                          \
0432 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94)               \
0433     or  31,31,31;                       \
0434 ALT_##TYPE##_SECTION_END(0, 0)                      \
0435     or  1,1,1;                          \
0436     or  1,1,1;                          \
0437     /* Nested alt sections, else with inner default taken */    \
0438 BEGIN_##TYPE##_SECTION                          \
0439     or  2,2,2;                          \
0440 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0441     or  1,1,1;                          \
0442 ##TYPE##_SECTION_ELSE_NESTED(95)                    \
0443     or  5,5,5;                          \
0444 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)               \
0445     or  2,2,2;                          \
0446 ##TYPE##_SECTION_ELSE                           \
0447     or  31,31,31;                       \
0448 BEGIN_##TYPE##_SECTION_NESTED(94)                   \
0449     or  5,5,5;                          \
0450 ##TYPE##_SECTION_ELSE_NESTED(94)                    \
0451     or  1,1,1;                          \
0452 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94)               \
0453     or  31,31,31;                       \
0454 ALT_##TYPE##_SECTION_END(0, 1)                      \
0455     or  1,1,1;                          \
0456     or  1,1,1;                          \
0457     /* Nested alt sections, else with inner else taken */       \
0458 BEGIN_##TYPE##_SECTION                          \
0459     or  2,2,2;                          \
0460 BEGIN_##TYPE##_SECTION_NESTED(95)                   \
0461     or  1,1,1;                          \
0462 ##TYPE##_SECTION_ELSE_NESTED(95)                    \
0463     or  5,5,5;                          \
0464 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95)               \
0465     or  2,2,2;                          \
0466 ##TYPE##_SECTION_ELSE                           \
0467     or  31,31,31;                       \
0468 BEGIN_##TYPE##_SECTION_NESTED(94)                   \
0469     or  5,5,5;                          \
0470 ##TYPE##_SECTION_ELSE_NESTED(94)                    \
0471     or  1,1,1;                          \
0472 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94)               \
0473     or  31,31,31;                       \
0474 ALT_##TYPE##_SECTION_END(0, 1)                      \
0475     or  1,1,1;                          \
0476     or  1,1,1;                          \
0477     /* Nested alt sections, else can have large else case */    \
0478 BEGIN_##TYPE##_SECTION                          \
0479     or  2,2,2;                          \
0480     or  2,2,2;                          \
0481     or  2,2,2;                          \
0482     or  2,2,2;                          \
0483 ##TYPE##_SECTION_ELSE                           \
0484 BEGIN_##TYPE##_SECTION_NESTED(94)                   \
0485     or  5,5,5;                          \
0486     or  5,5,5;                          \
0487     or  5,5,5;                          \
0488     or  5,5,5;                          \
0489 ##TYPE##_SECTION_ELSE_NESTED(94)                    \
0490     or  1,1,1;                          \
0491     or  1,1,1;                          \
0492     or  1,1,1;                          \
0493     or  1,1,1;                          \
0494 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94)               \
0495 ALT_##TYPE##_SECTION_END(0, 1)                      \
0496     or  1,1,1;                          \
0497     or  1,1,1;
0498 
0499 #define MAKE_MACRO_TEST_EXPECTED(TYPE)                  \
0500 globl(ftr_fixup_test_ ##TYPE##_macros_expected)             \
0501     or  1,1,1;                          \
0502     /* Basic test, this section should all be nop'ed */     \
0503 /* BEGIN_##TYPE##_SECTION */                        \
0504     nop;                                \
0505     nop;                                \
0506     nop;                                \
0507 /* END_##TYPE##_SECTION(0, 1) */                    \
0508     or  1,1,1;                          \
0509     or  1,1,1;                          \
0510     /* Basic test, this section should NOT be nop'ed */     \
0511 /* BEGIN_##TYPE##_SECTION */                        \
0512     or  2,2,2;                          \
0513     or  2,2,2;                          \
0514     or  2,2,2;                          \
0515 /* END_##TYPE##_SECTION(0, 0) */                    \
0516     or  1,1,1;                          \
0517     or  1,1,1;                          \
0518     /* Nesting test, inner section should be nop'ed */      \
0519 /* BEGIN_##TYPE##_SECTION */                        \
0520     or  2,2,2;                          \
0521     or  2,2,2;                          \
0522 /* BEGIN_##TYPE##_SECTION_NESTED(80) */                 \
0523     nop;                                \
0524     nop;                                \
0525 /* END_##TYPE##_SECTION_NESTED(0, 1, 80) */             \
0526     or  2,2,2;                          \
0527     or  2,2,2;                          \
0528 /* END_##TYPE##_SECTION(0, 0) */                    \
0529     or  1,1,1;                          \
0530     or  1,1,1;                          \
0531     /* Nesting test, whole section should be nop'ed */      \
0532     /* NB. inner section is not nop'ed, but then entire outer is */ \
0533 /* BEGIN_##TYPE##_SECTION */                        \
0534     nop;                                \
0535     nop;                                \
0536 /* BEGIN_##TYPE##_SECTION_NESTED(80) */                 \
0537     nop;                                \
0538     nop;                                \
0539 /* END_##TYPE##_SECTION_NESTED(0, 0, 80) */             \
0540     nop;                                \
0541     nop;                                \
0542 /* END_##TYPE##_SECTION(0, 1) */                    \
0543     or  1,1,1;                          \
0544     or  1,1,1;                          \
0545     /* Nesting test, none should be nop'ed */           \
0546 /* BEGIN_##TYPE##_SECTION */                        \
0547     or  2,2,2;                          \
0548     or  2,2,2;                          \
0549 /* BEGIN_##TYPE##_SECTION_NESTED(80) */                 \
0550     or  3,3,3;                          \
0551     or  3,3,3;                          \
0552 /* END_##TYPE##_SECTION_NESTED(0, 0, 80) */             \
0553     or  2,2,2;                          \
0554     or  2,2,2;                          \
0555 /* END_##TYPE##_SECTION(0, 0) */                    \
0556     or  1,1,1;                          \
0557     or  1,1,1;                          \
0558     /* Basic alt section test, default case should be taken */  \
0559 /* BEGIN_##TYPE##_SECTION */                        \
0560     or  3,3,3;                          \
0561     or  3,3,3;                          \
0562     or  3,3,3;                          \
0563 /* ##TYPE##_SECTION_ELSE */                     \
0564     /* or   5,5,5; */                       \
0565     /* or   5,5,5; */                       \
0566 /* ALT_##TYPE##_SECTION_END(0, 0) */                    \
0567     or  1,1,1;                          \
0568     or  1,1,1;                          \
0569     /* Basic alt section test, else case should be taken */     \
0570 /* BEGIN_##TYPE##_SECTION */                        \
0571     /* or   3,3,3; */                       \
0572     /* or   3,3,3; */                       \
0573     /* or   3,3,3; */                       \
0574 /* ##TYPE##_SECTION_ELSE */                     \
0575     or  31,31,31;                       \
0576     or  31,31,31;                       \
0577     or  31,31,31;                       \
0578 /* ALT_##TYPE##_SECTION_END(0, 1) */                    \
0579     or  1,1,1;                          \
0580     or  1,1,1;                          \
0581     /* Alt with smaller else case, should be padded with nops */    \
0582 /* BEGIN_##TYPE##_SECTION */                        \
0583     /* or   3,3,3; */                       \
0584     /* or   3,3,3; */                       \
0585     /* or   3,3,3; */                       \
0586 /* ##TYPE##_SECTION_ELSE */                     \
0587     or  31,31,31;                       \
0588     nop;                                \
0589     nop;                                \
0590 /* ALT_##TYPE##_SECTION_END(0, 1) */                    \
0591     or  1,1,1;                          \
0592     or  1,1,1;                          \
0593     /* Alt section with nested section in default case */       \
0594     /* Default case should be taken, with nop'ed inner section */   \
0595 /* BEGIN_##TYPE##_SECTION */                        \
0596     or  3,3,3;                          \
0597 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0598     nop;                                \
0599     nop;                                \
0600 /* END_##TYPE##_SECTION_NESTED(0, 1, 95) */             \
0601     or  3,3,3;                          \
0602 /* ##TYPE##_SECTION_ELSE */                     \
0603     /* or   2,2,2; */                       \
0604     /* or   2,2,2; */                       \
0605 /* ALT_##TYPE##_SECTION_END(0, 0) */                    \
0606     or  1,1,1;                          \
0607     or  1,1,1;                          \
0608     /* Alt section with nested section in else, default taken */    \
0609 /* BEGIN_##TYPE##_SECTION */                        \
0610     or  3,3,3;                          \
0611     or  3,3,3;                          \
0612     or  3,3,3;                          \
0613 /* ##TYPE##_SECTION_ELSE */                     \
0614     /* or   5,5,5; */                       \
0615 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0616     /* or   3,3,3; */                       \
0617 /* END_##TYPE##_SECTION_NESTED(0, 1, 95) */             \
0618     /* or   5,5,5; */                       \
0619 /* ALT_##TYPE##_SECTION_END(0, 0) */                    \
0620     or  1,1,1;                          \
0621     or  1,1,1;                          \
0622     /* Alt section with nested section in else, else taken & nop */ \
0623 /* BEGIN_##TYPE##_SECTION */                        \
0624     /* or   3,3,3; */                       \
0625     /* or   3,3,3; */                       \
0626     /* or   3,3,3; */                       \
0627 /* ##TYPE##_SECTION_ELSE */                     \
0628     or  5,5,5;                          \
0629 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0630     nop;                                \
0631 /* END_##TYPE##_SECTION_NESTED(0, 1, 95) */             \
0632     or  5,5,5;                          \
0633 /* ALT_##TYPE##_SECTION_END(0, 1) */                    \
0634     or  1,1,1;                          \
0635     or  1,1,1;                          \
0636     /* Feature section with nested alt section, default taken */    \
0637 /* BEGIN_##TYPE##_SECTION */                        \
0638     or  2,2,2;                          \
0639 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0640     or  1,1,1;                          \
0641 /* ##TYPE##_SECTION_ELSE_NESTED(95) */                  \
0642     /* or   5,5,5; */                       \
0643 /* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) */             \
0644     or  2,2,2;                          \
0645 /* END_##TYPE##_SECTION(0, 0) */                    \
0646     or  1,1,1;                          \
0647     or  1,1,1;                          \
0648     /* Feature section with nested alt section, else taken */   \
0649 /* BEGIN_##TYPE##_SECTION */                        \
0650     or  2,2,2;                          \
0651 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0652     /* or   1,1,1; */                       \
0653 /* ##TYPE##_SECTION_ELSE_NESTED(95) */                  \
0654     or  5,5,5;                          \
0655 /* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */             \
0656     or  2,2,2;                          \
0657 /* END_##TYPE##_SECTION(0, 0) */                    \
0658     or  1,1,1;                          \
0659     or  1,1,1;                          \
0660     /* Feature section with nested alt section, all nop'ed */   \
0661 /* BEGIN_##TYPE##_SECTION */                        \
0662     nop;                                \
0663 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0664     nop;                                \
0665 /* ##TYPE##_SECTION_ELSE_NESTED(95) */                  \
0666     /* or   5,5,5; */                       \
0667 /* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) */             \
0668     nop;                                \
0669 /* END_##TYPE##_SECTION(0, 1) */                    \
0670     or  1,1,1;                          \
0671     or  1,1,1;                          \
0672     /* Nested alt sections, default with inner default taken */ \
0673 /* BEGIN_##TYPE##_SECTION */                        \
0674     or  2,2,2;                          \
0675 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0676     or  1,1,1;                          \
0677 /* ##TYPE##_SECTION_ELSE_NESTED(95) */                  \
0678     /* or   5,5,5; */                       \
0679 /* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) */             \
0680     or  2,2,2;                          \
0681 /* ##TYPE##_SECTION_ELSE */                     \
0682     /* or   31,31,31; */                        \
0683 /* BEGIN_##TYPE##_SECTION_NESTED(94) */                 \
0684     /* or   5,5,5; */                       \
0685 /* ##TYPE##_SECTION_ELSE_NESTED(94) */                  \
0686     /* or   1,1,1; */                       \
0687 /* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) */             \
0688     /* or   31,31,31; */                        \
0689 /* ALT_##TYPE##_SECTION_END(0, 0) */                    \
0690     or  1,1,1;                          \
0691     or  1,1,1;                          \
0692     /* Nested alt sections, default with inner else taken */    \
0693 /* BEGIN_##TYPE##_SECTION */                        \
0694     or  2,2,2;                          \
0695 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0696     /* or   1,1,1; */                       \
0697 /* ##TYPE##_SECTION_ELSE_NESTED(95) */                  \
0698     or  5,5,5;                          \
0699 /* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */             \
0700     or  2,2,2;                          \
0701 /* ##TYPE##_SECTION_ELSE */                     \
0702     /* or   31,31,31; */                        \
0703 /* BEGIN_##TYPE##_SECTION_NESTED(94) */                 \
0704     /* or   5,5,5; */                       \
0705 /* ##TYPE##_SECTION_ELSE_NESTED(94) */                  \
0706     /* or   1,1,1; */                       \
0707 /* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) */             \
0708     /* or   31,31,31; */                        \
0709 /* ALT_##TYPE##_SECTION_END(0, 0) */                    \
0710     or  1,1,1;                          \
0711     or  1,1,1;                          \
0712     /* Nested alt sections, else with inner default taken */    \
0713 /* BEGIN_##TYPE##_SECTION */                        \
0714     /* or   2,2,2; */                       \
0715 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0716     /* or   1,1,1; */                       \
0717 /* ##TYPE##_SECTION_ELSE_NESTED(95) */                  \
0718     /* or   5,5,5; */                       \
0719 /* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */             \
0720     /* or   2,2,2; */                       \
0721 /* ##TYPE##_SECTION_ELSE */                     \
0722     or  31,31,31;                       \
0723 /* BEGIN_##TYPE##_SECTION_NESTED(94) */                 \
0724     or  5,5,5;                          \
0725 /* ##TYPE##_SECTION_ELSE_NESTED(94) */                  \
0726     /* or   1,1,1; */                       \
0727 /* ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) */             \
0728     or  31,31,31;                       \
0729 /* ALT_##TYPE##_SECTION_END(0, 1) */                    \
0730     or  1,1,1;                          \
0731     or  1,1,1;                          \
0732     /* Nested alt sections, else with inner else taken */       \
0733 /* BEGIN_##TYPE##_SECTION */                        \
0734     /* or   2,2,2; */                       \
0735 /* BEGIN_##TYPE##_SECTION_NESTED(95) */                 \
0736     /* or   1,1,1; */                       \
0737 /* ##TYPE##_SECTION_ELSE_NESTED(95) */                  \
0738     /* or   5,5,5; */                       \
0739 /* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) */             \
0740     /* or   2,2,2; */                       \
0741 /* ##TYPE##_SECTION_ELSE */                     \
0742     or  31,31,31;                       \
0743 /* BEGIN_##TYPE##_SECTION_NESTED(94) */                 \
0744     /* or   5,5,5; */                       \
0745 /* ##TYPE##_SECTION_ELSE_NESTED(94) */                  \
0746     or  1,1,1;                          \
0747 /* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94) */             \
0748     or  31,31,31;                       \
0749 /* ALT_##TYPE##_SECTION_END(0, 1) */                    \
0750     or  1,1,1;                          \
0751     or  1,1,1;                          \
0752     /* Nested alt sections, else can have large else case */    \
0753 /* BEGIN_##TYPE##_SECTION */                        \
0754     /* or   2,2,2; */                       \
0755     /* or   2,2,2; */                       \
0756     /* or   2,2,2; */                       \
0757     /* or   2,2,2; */                       \
0758 /* ##TYPE##_SECTION_ELSE */                     \
0759 /* BEGIN_##TYPE##_SECTION_NESTED(94) */                 \
0760     /* or   5,5,5; */                       \
0761     /* or   5,5,5; */                       \
0762     /* or   5,5,5; */                       \
0763     /* or   5,5,5; */                       \
0764 /* ##TYPE##_SECTION_ELSE_NESTED(94) */                  \
0765     or  1,1,1;                          \
0766     or  1,1,1;                          \
0767     or  1,1,1;                          \
0768     or  1,1,1;                          \
0769 /* ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94) */             \
0770 /* ALT_##TYPE##_SECTION_END(0, 1) */                    \
0771     or  1,1,1;                          \
0772     or  1,1,1;
0773 
0774 MAKE_MACRO_TEST(FTR);
0775 MAKE_MACRO_TEST_EXPECTED(FTR);
0776 
0777 #ifdef CONFIG_PPC64
0778 MAKE_MACRO_TEST(FW_FTR);
0779 MAKE_MACRO_TEST_EXPECTED(FW_FTR);
0780 #endif
0781 
0782 globl(lwsync_fixup_test)
0783 1:  or  1,1,1
0784     LWSYNC
0785 globl(end_lwsync_fixup_test)
0786 
0787 globl(lwsync_fixup_test_expected_LWSYNC)
0788 1:  or  1,1,1
0789     lwsync
0790 
0791 globl(lwsync_fixup_test_expected_SYNC)
0792 1:  or  1,1,1
0793     sync
0794 
0795 globl(ftr_fixup_prefix1)
0796     or  1,1,1
0797     .long OP_PREFIX << 26
0798     .long 0x0000000
0799     or  2,2,2
0800 globl(end_ftr_fixup_prefix1)
0801 
0802 globl(ftr_fixup_prefix1_orig)
0803     or  1,1,1
0804     .long OP_PREFIX << 26
0805     .long 0x0000000
0806     or  2,2,2
0807 
0808 globl(ftr_fixup_prefix1_expected)
0809     or  1,1,1
0810     nop
0811     nop
0812     or  2,2,2
0813 
0814 globl(ftr_fixup_prefix2)
0815     or  1,1,1
0816     .long OP_PREFIX << 26
0817     .long 0x0000000
0818     or  2,2,2
0819 globl(end_ftr_fixup_prefix2)
0820 
0821 globl(ftr_fixup_prefix2_orig)
0822     or  1,1,1
0823     .long OP_PREFIX << 26
0824     .long 0x0000000
0825     or  2,2,2
0826 
0827 globl(ftr_fixup_prefix2_alt)
0828     .long OP_PREFIX << 26
0829     .long 0x0000001
0830 
0831 globl(ftr_fixup_prefix2_expected)
0832     or  1,1,1
0833     .long OP_PREFIX << 26
0834     .long 0x0000001
0835     or  2,2,2
0836 
0837 globl(ftr_fixup_prefix3)
0838     or  1,1,1
0839     .long OP_PREFIX << 26
0840     .long 0x0000000
0841     or  2,2,2
0842     or  3,3,3
0843 globl(end_ftr_fixup_prefix3)
0844 
0845 globl(ftr_fixup_prefix3_orig)
0846     or  1,1,1
0847     .long OP_PREFIX << 26
0848     .long 0x0000000
0849     or  2,2,2
0850     or  3,3,3
0851 
0852 globl(ftr_fixup_prefix3_alt)
0853     .long OP_PREFIX << 26
0854     .long 0x0000001
0855     nop
0856 
0857 globl(ftr_fixup_prefix3_expected)
0858     or  1,1,1
0859     .long OP_PREFIX << 26
0860     .long 0x0000001
0861     nop
0862     or  3,3,3