feature-fixups-test.S 19 KB

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