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