feature-fixups-test.S 20 KB

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