rotr.s 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802
  1. # Hitachi H8 testcase 'rotr'
  2. # mach(): h8300s h8sx
  3. # as(h8300): --defsym sim_cpu=0
  4. # as(h8300h): --defsym sim_cpu=1
  5. # as(h8300s): --defsym sim_cpu=2
  6. # as(h8sx): --defsym sim_cpu=3
  7. # ld(h8300h): -m h8300helf
  8. # ld(h8300s): -m h8300self
  9. # ld(h8sx): -m h8300sxelf
  10. .include "testutils.inc"
  11. start
  12. .data
  13. byte_dest: .byte 0xa5
  14. .align 2
  15. word_dest: .word 0xa5a5
  16. .align 4
  17. long_dest: .long 0xa5a5a5a5
  18. .text
  19. rotr_b_reg8_1:
  20. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  21. set_ccr_zero
  22. rotr.b r0l ; shift right arithmetic by one
  23. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  24. test_zero_clear
  25. test_ovf_clear
  26. test_neg_set
  27. test_h_gr16 0xa5d2 r0 ; 1010 0101 -> 1101 0010
  28. .if (sim_cpu)
  29. test_h_gr32 0xa5a5a5d2 er0
  30. .endif
  31. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  32. test_gr_a5a5 2
  33. test_gr_a5a5 3
  34. test_gr_a5a5 4
  35. test_gr_a5a5 5
  36. test_gr_a5a5 6
  37. test_gr_a5a5 7
  38. .if (sim_cpu == h8sx)
  39. rotr_b_ind_1:
  40. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  41. set_ccr_zero
  42. mov #byte_dest, er0
  43. rotr.b @er0 ; shift right arithmetic by one, indirect
  44. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  45. test_zero_clear
  46. test_ovf_clear
  47. test_neg_set
  48. test_h_gr32 byte_dest er0
  49. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  50. test_gr_a5a5 2
  51. test_gr_a5a5 3
  52. test_gr_a5a5 4
  53. test_gr_a5a5 5
  54. test_gr_a5a5 6
  55. test_gr_a5a5 7
  56. ; 1010 0101 -> 1101 0010
  57. cmp.b #0xd2, @byte_dest
  58. beq .Lbind1
  59. fail
  60. .Lbind1:
  61. mov.b #0xa5, @byte_dest
  62. rotr_b_postinc_1:
  63. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  64. set_ccr_zero
  65. mov #byte_dest, er0
  66. rotr.b @er0+ ; shift right arithmetic by one, postinc
  67. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  68. test_zero_clear
  69. test_ovf_clear
  70. test_neg_set
  71. test_h_gr32 byte_dest+1 er0
  72. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  73. test_gr_a5a5 2
  74. test_gr_a5a5 3
  75. test_gr_a5a5 4
  76. test_gr_a5a5 5
  77. test_gr_a5a5 6
  78. test_gr_a5a5 7
  79. ; 1010 0101 -> 1101 0010
  80. cmp.b #0xd2, @byte_dest
  81. beq .Lbpostinc1
  82. fail
  83. .Lbpostinc1:
  84. mov.b #0xa5, @byte_dest
  85. rotr_b_postdec_1:
  86. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  87. set_ccr_zero
  88. mov #byte_dest, er0
  89. rotr.b @er0- ; shift right arithmetic by one, postdec
  90. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  91. test_zero_clear
  92. test_ovf_clear
  93. test_neg_set
  94. test_h_gr32 byte_dest-1 er0
  95. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  96. test_gr_a5a5 2
  97. test_gr_a5a5 3
  98. test_gr_a5a5 4
  99. test_gr_a5a5 5
  100. test_gr_a5a5 6
  101. test_gr_a5a5 7
  102. ; 1010 0101 -> 1101 0010
  103. cmp.b #0xd2, @byte_dest
  104. beq .Lbpostdec1
  105. fail
  106. .Lbpostdec1:
  107. mov.b #0xa5, @byte_dest
  108. rotr_b_preinc_1:
  109. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  110. set_ccr_zero
  111. mov #byte_dest-1, er0
  112. rotr.b @+er0 ; shift right arithmetic by one, preinc
  113. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  114. test_zero_clear
  115. test_ovf_clear
  116. test_neg_set
  117. test_h_gr32 byte_dest er0
  118. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  119. test_gr_a5a5 2
  120. test_gr_a5a5 3
  121. test_gr_a5a5 4
  122. test_gr_a5a5 5
  123. test_gr_a5a5 6
  124. test_gr_a5a5 7
  125. ; 1010 0101 -> 1101 0010
  126. cmp.b #0xd2, @byte_dest
  127. beq .Lbpreinc1
  128. fail
  129. .Lbpreinc1:
  130. mov.b #0xa5, @byte_dest
  131. rotr_b_predec_1:
  132. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  133. set_ccr_zero
  134. mov #byte_dest+1, er0
  135. rotr.b @-er0 ; shift right arithmetic by one, predec
  136. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  137. test_zero_clear
  138. test_ovf_clear
  139. test_neg_set
  140. test_h_gr32 byte_dest er0
  141. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  142. test_gr_a5a5 2
  143. test_gr_a5a5 3
  144. test_gr_a5a5 4
  145. test_gr_a5a5 5
  146. test_gr_a5a5 6
  147. test_gr_a5a5 7
  148. ; 1010 0101 -> 1101 0010
  149. cmp.b #0xd2, @byte_dest
  150. beq .Lbpredec1
  151. fail
  152. .Lbpredec1:
  153. mov.b #0xa5, @byte_dest
  154. rotr_b_disp2_1:
  155. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  156. set_ccr_zero
  157. mov #byte_dest-2, er0
  158. rotr.b @(2:2, er0) ; shift right arithmetic by one, disp2
  159. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  160. test_zero_clear
  161. test_ovf_clear
  162. test_neg_set
  163. test_h_gr32 byte_dest-2 er0
  164. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  165. test_gr_a5a5 2
  166. test_gr_a5a5 3
  167. test_gr_a5a5 4
  168. test_gr_a5a5 5
  169. test_gr_a5a5 6
  170. test_gr_a5a5 7
  171. ; 1010 0101 -> 1101 0010
  172. cmp.b #0xd2, @byte_dest
  173. beq .Lbdisp21
  174. fail
  175. .Lbdisp21:
  176. mov.b #0xa5, @byte_dest
  177. rotr_b_disp16_1:
  178. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  179. set_ccr_zero
  180. mov #byte_dest-44, er0
  181. rotr.b @(44:16, er0) ; shift right arithmetic by one, disp16
  182. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  183. test_zero_clear
  184. test_ovf_clear
  185. test_neg_set
  186. test_h_gr32 byte_dest-44 er0
  187. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  188. test_gr_a5a5 2
  189. test_gr_a5a5 3
  190. test_gr_a5a5 4
  191. test_gr_a5a5 5
  192. test_gr_a5a5 6
  193. test_gr_a5a5 7
  194. ; 1010 0101 -> 1101 0010
  195. cmp.b #0xd2, @byte_dest
  196. beq .Lbdisp161
  197. fail
  198. .Lbdisp161:
  199. mov.b #0xa5, @byte_dest
  200. rotr_b_disp32_1:
  201. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  202. set_ccr_zero
  203. mov #byte_dest-666, er0
  204. rotr.b @(666:32, er0) ; shift right arithmetic by one, disp32
  205. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  206. test_zero_clear
  207. test_ovf_clear
  208. test_neg_set
  209. test_h_gr32 byte_dest-666 er0
  210. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  211. test_gr_a5a5 2
  212. test_gr_a5a5 3
  213. test_gr_a5a5 4
  214. test_gr_a5a5 5
  215. test_gr_a5a5 6
  216. test_gr_a5a5 7
  217. ; 1010 0101 -> 1101 0010
  218. cmp.b #0xd2, @byte_dest
  219. beq .Lbdisp321
  220. fail
  221. .Lbdisp321:
  222. mov.b #0xa5, @byte_dest
  223. rotr_b_abs16_1:
  224. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  225. set_ccr_zero
  226. rotr.b @byte_dest:16 ; shift right arithmetic by one, abs16
  227. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  228. test_zero_clear
  229. test_ovf_clear
  230. test_neg_set
  231. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  232. test_gr_a5a5 2
  233. test_gr_a5a5 2
  234. test_gr_a5a5 3
  235. test_gr_a5a5 4
  236. test_gr_a5a5 5
  237. test_gr_a5a5 6
  238. test_gr_a5a5 7
  239. ; 1010 0101 -> 1101 0010
  240. cmp.b #0xd2, @byte_dest
  241. beq .Lbabs161
  242. fail
  243. .Lbabs161:
  244. mov.b #0xa5, @byte_dest
  245. rotr_b_abs32_1:
  246. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  247. set_ccr_zero
  248. rotr.b @byte_dest:32 ; shift right arithmetic by one, abs32
  249. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  250. test_zero_clear
  251. test_ovf_clear
  252. test_neg_set
  253. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  254. test_gr_a5a5 2
  255. test_gr_a5a5 2
  256. test_gr_a5a5 3
  257. test_gr_a5a5 4
  258. test_gr_a5a5 5
  259. test_gr_a5a5 6
  260. test_gr_a5a5 7
  261. ; 1010 0101 -> 1101 0010
  262. cmp.b #0xd2, @byte_dest
  263. beq .Lbabs321
  264. fail
  265. .Lbabs321:
  266. mov.b #0xa5, @byte_dest
  267. .endif
  268. rotr_b_reg8_2:
  269. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  270. set_ccr_zero
  271. rotr.b #2, r0l ; shift right arithmetic by two
  272. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  273. test_zero_clear
  274. test_ovf_clear
  275. test_neg_clear
  276. test_h_gr16 0xa569 r0 ; 1010 0101 -> 0110 1001
  277. .if (sim_cpu)
  278. test_h_gr32 0xa5a5a569 er0
  279. .endif
  280. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  281. test_gr_a5a5 2
  282. test_gr_a5a5 3
  283. test_gr_a5a5 4
  284. test_gr_a5a5 5
  285. test_gr_a5a5 6
  286. test_gr_a5a5 7
  287. .if (sim_cpu == h8sx)
  288. rotr_b_ind_2:
  289. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  290. set_ccr_zero
  291. mov #byte_dest, er0
  292. rotr.b #2, @er0 ; shift right arithmetic by two, indirect
  293. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  294. test_zero_clear
  295. test_ovf_clear
  296. test_neg_clear
  297. test_h_gr32 byte_dest er0
  298. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  299. test_gr_a5a5 2
  300. test_gr_a5a5 3
  301. test_gr_a5a5 4
  302. test_gr_a5a5 5
  303. test_gr_a5a5 6
  304. test_gr_a5a5 7
  305. ; 1010 0101 -> 0110 1001
  306. cmp.b #0x69, @byte_dest
  307. beq .Lbind2
  308. fail
  309. .Lbind2:
  310. mov.b #0xa5, @byte_dest
  311. rotr_b_postinc_2:
  312. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  313. set_ccr_zero
  314. mov #byte_dest, er0
  315. rotr.b #2, @er0+ ; shift right arithmetic by two, postinc
  316. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  317. test_zero_clear
  318. test_ovf_clear
  319. test_neg_clear
  320. test_h_gr32 byte_dest+1 er0
  321. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  322. test_gr_a5a5 2
  323. test_gr_a5a5 3
  324. test_gr_a5a5 4
  325. test_gr_a5a5 5
  326. test_gr_a5a5 6
  327. test_gr_a5a5 7
  328. ; 1010 0101 -> 0110 1001
  329. cmp.b #0x69, @byte_dest
  330. beq .Lbpostinc2
  331. fail
  332. .Lbpostinc2:
  333. mov.b #0xa5, @byte_dest
  334. rotr_b_postdec_2:
  335. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  336. set_ccr_zero
  337. mov #byte_dest, er0
  338. rotr.b #2, @er0- ; shift right arithmetic by two, postdec
  339. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  340. test_zero_clear
  341. test_ovf_clear
  342. test_neg_clear
  343. test_h_gr32 byte_dest-1 er0
  344. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  345. test_gr_a5a5 2
  346. test_gr_a5a5 3
  347. test_gr_a5a5 4
  348. test_gr_a5a5 5
  349. test_gr_a5a5 6
  350. test_gr_a5a5 7
  351. ; 1010 0101 -> 0110 1001
  352. cmp.b #0x69, @byte_dest
  353. beq .Lbpostdec2
  354. fail
  355. .Lbpostdec2:
  356. mov.b #0xa5, @byte_dest
  357. rotr_b_preinc_2:
  358. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  359. set_ccr_zero
  360. mov #byte_dest-1, er0
  361. rotr.b #2, @+er0 ; shift right arithmetic by two, preinc
  362. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  363. test_zero_clear
  364. test_ovf_clear
  365. test_neg_clear
  366. test_h_gr32 byte_dest er0
  367. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  368. test_gr_a5a5 2
  369. test_gr_a5a5 3
  370. test_gr_a5a5 4
  371. test_gr_a5a5 5
  372. test_gr_a5a5 6
  373. test_gr_a5a5 7
  374. ; 1010 0101 -> 0110 1001
  375. cmp.b #0x69, @byte_dest
  376. beq .Lbpreinc2
  377. fail
  378. .Lbpreinc2:
  379. mov.b #0xa5, @byte_dest
  380. rotr_b_predec_2:
  381. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  382. set_ccr_zero
  383. mov #byte_dest+1, er0
  384. rotr.b #2, @-er0 ; shift right arithmetic by two, predec
  385. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  386. test_zero_clear
  387. test_ovf_clear
  388. test_neg_clear
  389. test_h_gr32 byte_dest er0
  390. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  391. test_gr_a5a5 2
  392. test_gr_a5a5 3
  393. test_gr_a5a5 4
  394. test_gr_a5a5 5
  395. test_gr_a5a5 6
  396. test_gr_a5a5 7
  397. ; 1010 0101 -> 0110 1001
  398. cmp.b #0x69, @byte_dest
  399. beq .Lbpredec2
  400. fail
  401. .Lbpredec2:
  402. mov.b #0xa5, @byte_dest
  403. rotr_b_disp2_2:
  404. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  405. set_ccr_zero
  406. mov #byte_dest-2, er0
  407. rotr.b #2, @(2:2, er0) ; shift right arithmetic by two, disp2
  408. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  409. test_zero_clear
  410. test_ovf_clear
  411. test_neg_clear
  412. test_h_gr32 byte_dest-2 er0
  413. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  414. test_gr_a5a5 2
  415. test_gr_a5a5 3
  416. test_gr_a5a5 4
  417. test_gr_a5a5 5
  418. test_gr_a5a5 6
  419. test_gr_a5a5 7
  420. ; 1010 0101 -> 0110 1001
  421. cmp.b #0x69, @byte_dest
  422. beq .Lbdisp22
  423. fail
  424. .Lbdisp22:
  425. mov.b #0xa5, @byte_dest
  426. rotr_b_disp16_2:
  427. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  428. set_ccr_zero
  429. mov #byte_dest-44, er0
  430. rotr.b #2, @(44:16, er0) ; shift right arithmetic by two, disp16
  431. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  432. test_zero_clear
  433. test_ovf_clear
  434. test_neg_clear
  435. test_h_gr32 byte_dest-44 er0
  436. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  437. test_gr_a5a5 2
  438. test_gr_a5a5 3
  439. test_gr_a5a5 4
  440. test_gr_a5a5 5
  441. test_gr_a5a5 6
  442. test_gr_a5a5 7
  443. ; 1010 0101 -> 0110 1001
  444. cmp.b #0x69, @byte_dest
  445. beq .Lbdisp162
  446. fail
  447. .Lbdisp162:
  448. mov.b #0xa5, @byte_dest
  449. rotr_b_disp32_2:
  450. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  451. set_ccr_zero
  452. mov #byte_dest-666, er0
  453. rotr.b #2, @(666:32, er0) ; shift right arithmetic by two, disp32
  454. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  455. test_zero_clear
  456. test_ovf_clear
  457. test_neg_clear
  458. test_h_gr32 byte_dest-666 er0
  459. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  460. test_gr_a5a5 2
  461. test_gr_a5a5 3
  462. test_gr_a5a5 4
  463. test_gr_a5a5 5
  464. test_gr_a5a5 6
  465. test_gr_a5a5 7
  466. ; 1010 0101 -> 0110 1001
  467. cmp.b #0x69, @byte_dest
  468. beq .Lbdisp322
  469. fail
  470. .Lbdisp322:
  471. mov.b #0xa5, @byte_dest
  472. rotr_b_abs16_2:
  473. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  474. set_ccr_zero
  475. rotr.b #2, @byte_dest:16 ; shift right arithmetic by two, abs16
  476. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  477. test_zero_clear
  478. test_ovf_clear
  479. test_neg_clear
  480. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  481. test_gr_a5a5 2
  482. test_gr_a5a5 2
  483. test_gr_a5a5 3
  484. test_gr_a5a5 4
  485. test_gr_a5a5 5
  486. test_gr_a5a5 6
  487. test_gr_a5a5 7
  488. ; 1010 0101 -> 0110 1001
  489. cmp.b #0x69, @byte_dest
  490. beq .Lbabs162
  491. fail
  492. .Lbabs162:
  493. mov.b #0xa5, @byte_dest
  494. rotr_b_abs32_2:
  495. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  496. set_ccr_zero
  497. rotr.b #2, @byte_dest:32 ; shift right arithmetic by two, abs32
  498. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  499. test_zero_clear
  500. test_ovf_clear
  501. test_neg_clear
  502. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  503. test_gr_a5a5 2
  504. test_gr_a5a5 2
  505. test_gr_a5a5 3
  506. test_gr_a5a5 4
  507. test_gr_a5a5 5
  508. test_gr_a5a5 6
  509. test_gr_a5a5 7
  510. ; 1010 0101 -> 0110 1001
  511. cmp.b #0x69, @byte_dest
  512. beq .Lbabs322
  513. fail
  514. .Lbabs322:
  515. mov.b #0xa5, @byte_dest
  516. .endif
  517. .if (sim_cpu) ; Not available in h8300 mode
  518. rotr_w_reg16_1:
  519. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  520. set_ccr_zero
  521. rotr.w r0 ; shift right arithmetic by one
  522. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  523. test_zero_clear
  524. test_ovf_clear
  525. test_neg_set
  526. test_h_gr16 0xd2d2 r0 ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  527. test_h_gr32 0xa5a5d2d2 er0
  528. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  529. test_gr_a5a5 2
  530. test_gr_a5a5 3
  531. test_gr_a5a5 4
  532. test_gr_a5a5 5
  533. test_gr_a5a5 6
  534. test_gr_a5a5 7
  535. .if (sim_cpu == h8sx)
  536. rotr_w_ind_1:
  537. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  538. set_ccr_zero
  539. mov #word_dest, er0
  540. rotr.w @er0 ; shift right arithmetic by one, indirect
  541. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  542. test_zero_clear
  543. test_ovf_clear
  544. test_neg_set
  545. test_h_gr32 word_dest er0
  546. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  547. test_gr_a5a5 2
  548. test_gr_a5a5 3
  549. test_gr_a5a5 4
  550. test_gr_a5a5 5
  551. test_gr_a5a5 6
  552. test_gr_a5a5 7
  553. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  554. cmp.w #0xd2d2, @word_dest
  555. beq .Lwind1
  556. fail
  557. .Lwind1:
  558. mov.w #0xa5a5, @word_dest
  559. rotr_w_postinc_1:
  560. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  561. set_ccr_zero
  562. mov #word_dest, er0
  563. rotr.w @er0+ ; shift right arithmetic by one, postinc
  564. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  565. test_zero_clear
  566. test_ovf_clear
  567. test_neg_set
  568. test_h_gr32 word_dest+2 er0
  569. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  570. test_gr_a5a5 2
  571. test_gr_a5a5 3
  572. test_gr_a5a5 4
  573. test_gr_a5a5 5
  574. test_gr_a5a5 6
  575. test_gr_a5a5 7
  576. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  577. cmp.w #0xd2d2, @word_dest
  578. beq .Lwpostinc1
  579. fail
  580. .Lwpostinc1:
  581. mov.w #0xa5a5, @word_dest
  582. rotr_w_postdec_1:
  583. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  584. set_ccr_zero
  585. mov #word_dest, er0
  586. rotr.w @er0- ; shift right arithmetic by one, postdec
  587. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  588. test_zero_clear
  589. test_ovf_clear
  590. test_neg_set
  591. test_h_gr32 word_dest-2 er0
  592. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  593. test_gr_a5a5 2
  594. test_gr_a5a5 3
  595. test_gr_a5a5 4
  596. test_gr_a5a5 5
  597. test_gr_a5a5 6
  598. test_gr_a5a5 7
  599. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  600. cmp.w #0xd2d2, @word_dest
  601. beq .Lwpostdec1
  602. fail
  603. .Lwpostdec1:
  604. mov.w #0xa5a5, @word_dest
  605. rotr_w_preinc_1:
  606. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  607. set_ccr_zero
  608. mov #word_dest-2, er0
  609. rotr.w @+er0 ; shift right arithmetic by one, preinc
  610. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  611. test_zero_clear
  612. test_ovf_clear
  613. test_neg_set
  614. test_h_gr32 word_dest er0
  615. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  616. test_gr_a5a5 2
  617. test_gr_a5a5 3
  618. test_gr_a5a5 4
  619. test_gr_a5a5 5
  620. test_gr_a5a5 6
  621. test_gr_a5a5 7
  622. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  623. cmp.w #0xd2d2, @word_dest
  624. beq .Lwpreinc1
  625. fail
  626. .Lwpreinc1:
  627. mov.w #0xa5a5, @word_dest
  628. rotr_w_predec_1:
  629. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  630. set_ccr_zero
  631. mov #word_dest+2, er0
  632. rotr.w @-er0 ; shift right arithmetic by one, predec
  633. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  634. test_zero_clear
  635. test_ovf_clear
  636. test_neg_set
  637. test_h_gr32 word_dest er0
  638. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  639. test_gr_a5a5 2
  640. test_gr_a5a5 3
  641. test_gr_a5a5 4
  642. test_gr_a5a5 5
  643. test_gr_a5a5 6
  644. test_gr_a5a5 7
  645. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  646. cmp.w #0xd2d2, @word_dest
  647. beq .Lwpredec1
  648. fail
  649. .Lwpredec1:
  650. mov.w #0xa5a5, @word_dest
  651. rotr_w_disp2_1:
  652. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  653. set_ccr_zero
  654. mov #word_dest-4, er0
  655. rotr.w @(4:2, er0) ; shift right arithmetic by one, disp2
  656. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  657. test_zero_clear
  658. test_ovf_clear
  659. test_neg_set
  660. test_h_gr32 word_dest-4 er0
  661. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  662. test_gr_a5a5 2
  663. test_gr_a5a5 3
  664. test_gr_a5a5 4
  665. test_gr_a5a5 5
  666. test_gr_a5a5 6
  667. test_gr_a5a5 7
  668. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  669. cmp.w #0xd2d2, @word_dest
  670. beq .Lwdisp21
  671. fail
  672. .Lwdisp21:
  673. mov.w #0xa5a5, @word_dest
  674. rotr_w_disp16_1:
  675. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  676. set_ccr_zero
  677. mov #word_dest-44, er0
  678. rotr.w @(44:16, er0) ; shift right arithmetic by one, disp16
  679. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  680. test_zero_clear
  681. test_ovf_clear
  682. test_neg_set
  683. test_h_gr32 word_dest-44 er0
  684. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  685. test_gr_a5a5 2
  686. test_gr_a5a5 3
  687. test_gr_a5a5 4
  688. test_gr_a5a5 5
  689. test_gr_a5a5 6
  690. test_gr_a5a5 7
  691. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  692. cmp.w #0xd2d2, @word_dest
  693. beq .Lwdisp161
  694. fail
  695. .Lwdisp161:
  696. mov.w #0xa5a5, @word_dest
  697. rotr_w_disp32_1:
  698. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  699. set_ccr_zero
  700. mov #word_dest-666, er0
  701. rotr.w @(666:32, er0) ; shift right arithmetic by one, disp32
  702. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  703. test_zero_clear
  704. test_ovf_clear
  705. test_neg_set
  706. test_h_gr32 word_dest-666 er0
  707. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  708. test_gr_a5a5 2
  709. test_gr_a5a5 3
  710. test_gr_a5a5 4
  711. test_gr_a5a5 5
  712. test_gr_a5a5 6
  713. test_gr_a5a5 7
  714. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  715. cmp.w #0xd2d2, @word_dest
  716. beq .Lwdisp321
  717. fail
  718. .Lwdisp321:
  719. mov.w #0xa5a5, @word_dest
  720. rotr_w_abs16_1:
  721. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  722. set_ccr_zero
  723. rotr.w @word_dest:16 ; shift right arithmetic by one, abs16
  724. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  725. test_zero_clear
  726. test_ovf_clear
  727. test_neg_set
  728. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  729. test_gr_a5a5 1
  730. test_gr_a5a5 2
  731. test_gr_a5a5 3
  732. test_gr_a5a5 4
  733. test_gr_a5a5 5
  734. test_gr_a5a5 6
  735. test_gr_a5a5 7
  736. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  737. cmp.w #0xd2d2, @word_dest
  738. beq .Lwabs161
  739. fail
  740. .Lwabs161:
  741. mov.w #0xa5a5, @word_dest
  742. rotr_w_abs32_1:
  743. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  744. set_ccr_zero
  745. rotr.w @word_dest:32 ; shift right arithmetic by one, abs32
  746. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  747. test_zero_clear
  748. test_ovf_clear
  749. test_neg_set
  750. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  751. test_gr_a5a5 1
  752. test_gr_a5a5 2
  753. test_gr_a5a5 3
  754. test_gr_a5a5 4
  755. test_gr_a5a5 5
  756. test_gr_a5a5 6
  757. test_gr_a5a5 7
  758. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  759. cmp.w #0xd2d2, @word_dest
  760. beq .Lwabs321
  761. fail
  762. .Lwabs321:
  763. mov.w #0xa5a5, @word_dest
  764. .endif
  765. rotr_w_reg16_2:
  766. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  767. set_ccr_zero
  768. rotr.w #2, r0 ; shift right arithmetic by two
  769. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  770. test_zero_clear
  771. test_ovf_clear
  772. test_neg_clear
  773. test_h_gr16 0x6969 r0 ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  774. test_h_gr32 0xa5a56969 er0
  775. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  776. test_gr_a5a5 2
  777. test_gr_a5a5 3
  778. test_gr_a5a5 4
  779. test_gr_a5a5 5
  780. test_gr_a5a5 6
  781. test_gr_a5a5 7
  782. .if (sim_cpu == h8sx)
  783. rotr_w_ind_2:
  784. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  785. set_ccr_zero
  786. mov #word_dest, er0
  787. rotr.w #2, @er0 ; shift right arithmetic by two, indirect
  788. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  789. test_zero_clear
  790. test_ovf_clear
  791. test_neg_clear
  792. test_h_gr32 word_dest er0
  793. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  794. test_gr_a5a5 2
  795. test_gr_a5a5 3
  796. test_gr_a5a5 4
  797. test_gr_a5a5 5
  798. test_gr_a5a5 6
  799. test_gr_a5a5 7
  800. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  801. cmp.w #0x6969, @word_dest
  802. beq .Lwind2
  803. fail
  804. .Lwind2:
  805. mov.w #0xa5a5, @word_dest
  806. rotr_w_postinc_2:
  807. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  808. set_ccr_zero
  809. mov #word_dest, er0
  810. rotr.w #2, @er0+ ; shift right arithmetic by two, postinc
  811. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  812. test_zero_clear
  813. test_ovf_clear
  814. test_neg_clear
  815. test_h_gr32 word_dest+2 er0
  816. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  817. test_gr_a5a5 2
  818. test_gr_a5a5 3
  819. test_gr_a5a5 4
  820. test_gr_a5a5 5
  821. test_gr_a5a5 6
  822. test_gr_a5a5 7
  823. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  824. cmp.w #0x6969, @word_dest
  825. beq .Lwpostinc2
  826. fail
  827. .Lwpostinc2:
  828. mov.w #0xa5a5, @word_dest
  829. rotr_w_postdec_2:
  830. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  831. set_ccr_zero
  832. mov #word_dest, er0
  833. rotr.w #2, @er0- ; shift right arithmetic by two, postdec
  834. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  835. test_zero_clear
  836. test_ovf_clear
  837. test_neg_clear
  838. test_h_gr32 word_dest-2 er0
  839. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  840. test_gr_a5a5 2
  841. test_gr_a5a5 3
  842. test_gr_a5a5 4
  843. test_gr_a5a5 5
  844. test_gr_a5a5 6
  845. test_gr_a5a5 7
  846. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  847. cmp.w #0x6969, @word_dest
  848. beq .Lwpostdec2
  849. fail
  850. .Lwpostdec2:
  851. mov.w #0xa5a5, @word_dest
  852. rotr_w_preinc_2:
  853. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  854. set_ccr_zero
  855. mov #word_dest-2, er0
  856. rotr.w #2, @+er0 ; shift right arithmetic by two, preinc
  857. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  858. test_zero_clear
  859. test_ovf_clear
  860. test_neg_clear
  861. test_h_gr32 word_dest er0
  862. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  863. test_gr_a5a5 2
  864. test_gr_a5a5 3
  865. test_gr_a5a5 4
  866. test_gr_a5a5 5
  867. test_gr_a5a5 6
  868. test_gr_a5a5 7
  869. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  870. cmp.w #0x6969, @word_dest
  871. beq .Lwpreinc2
  872. fail
  873. .Lwpreinc2:
  874. mov.w #0xa5a5, @word_dest
  875. rotr_w_predec_2:
  876. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  877. set_ccr_zero
  878. mov #word_dest+2, er0
  879. rotr.w #2, @-er0 ; shift right arithmetic by two, predec
  880. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  881. test_zero_clear
  882. test_ovf_clear
  883. test_neg_clear
  884. test_h_gr32 word_dest er0
  885. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  886. test_gr_a5a5 2
  887. test_gr_a5a5 3
  888. test_gr_a5a5 4
  889. test_gr_a5a5 5
  890. test_gr_a5a5 6
  891. test_gr_a5a5 7
  892. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  893. cmp.w #0x6969, @word_dest
  894. beq .Lwpredec2
  895. fail
  896. .Lwpredec2:
  897. mov.w #0xa5a5, @word_dest
  898. rotr_w_disp2_2:
  899. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  900. set_ccr_zero
  901. mov #word_dest-4, er0
  902. rotr.w #2, @(4:2, er0) ; shift right arithmetic by two, disp2
  903. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  904. test_zero_clear
  905. test_ovf_clear
  906. test_neg_clear
  907. test_h_gr32 word_dest-4 er0
  908. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  909. test_gr_a5a5 2
  910. test_gr_a5a5 3
  911. test_gr_a5a5 4
  912. test_gr_a5a5 5
  913. test_gr_a5a5 6
  914. test_gr_a5a5 7
  915. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  916. cmp.w #0x6969, @word_dest
  917. beq .Lwdisp22
  918. fail
  919. .Lwdisp22:
  920. mov.w #0xa5a5, @word_dest
  921. rotr_w_disp16_2:
  922. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  923. set_ccr_zero
  924. mov #word_dest-44, er0
  925. rotr.w #2, @(44:16, er0) ; shift right arithmetic by two, disp16
  926. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  927. test_zero_clear
  928. test_ovf_clear
  929. test_neg_clear
  930. test_h_gr32 word_dest-44 er0
  931. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  932. test_gr_a5a5 2
  933. test_gr_a5a5 3
  934. test_gr_a5a5 4
  935. test_gr_a5a5 5
  936. test_gr_a5a5 6
  937. test_gr_a5a5 7
  938. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  939. cmp.w #0x6969, @word_dest
  940. beq .Lwdisp162
  941. fail
  942. .Lwdisp162:
  943. mov.w #0xa5a5, @word_dest
  944. rotr_w_disp32_2:
  945. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  946. set_ccr_zero
  947. mov #word_dest-666, er0
  948. rotr.w #2, @(666:32, er0) ; shift right arithmetic by two, disp32
  949. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  950. test_zero_clear
  951. test_ovf_clear
  952. test_neg_clear
  953. test_h_gr32 word_dest-666 er0
  954. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  955. test_gr_a5a5 2
  956. test_gr_a5a5 3
  957. test_gr_a5a5 4
  958. test_gr_a5a5 5
  959. test_gr_a5a5 6
  960. test_gr_a5a5 7
  961. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  962. cmp.w #0x6969, @word_dest
  963. beq .Lwdisp322
  964. fail
  965. .Lwdisp322:
  966. mov.w #0xa5a5, @word_dest
  967. rotr_w_abs16_2:
  968. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  969. set_ccr_zero
  970. rotr.w #2, @word_dest:16 ; shift right arithmetic by two, abs16
  971. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  972. test_zero_clear
  973. test_ovf_clear
  974. test_neg_clear
  975. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  976. test_gr_a5a5 2
  977. test_gr_a5a5 2
  978. test_gr_a5a5 3
  979. test_gr_a5a5 4
  980. test_gr_a5a5 5
  981. test_gr_a5a5 6
  982. test_gr_a5a5 7
  983. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  984. cmp.w #0x6969, @word_dest
  985. beq .Lwabs162
  986. fail
  987. .Lwabs162:
  988. mov.w #0xa5a5, @word_dest
  989. rotr_w_abs32_2:
  990. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  991. set_ccr_zero
  992. rotr.w #2, @word_dest:32 ; shift right arithmetic by two, abs32
  993. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  994. test_zero_clear
  995. test_ovf_clear
  996. test_neg_clear
  997. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  998. test_gr_a5a5 2
  999. test_gr_a5a5 2
  1000. test_gr_a5a5 3
  1001. test_gr_a5a5 4
  1002. test_gr_a5a5 5
  1003. test_gr_a5a5 6
  1004. test_gr_a5a5 7
  1005. ; 1010 0101 1010 0101 -> 0110 1001 0110 1001
  1006. cmp.w #0x6969, @word_dest
  1007. beq .Lwabs322
  1008. fail
  1009. .Lwabs322:
  1010. mov.w #0xa5a5, @word_dest
  1011. .endif
  1012. rotr_l_reg32_1:
  1013. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1014. set_ccr_zero
  1015. rotr.l er0 ; shift right arithmetic by one, register
  1016. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1017. test_zero_clear
  1018. test_ovf_clear
  1019. test_neg_set
  1020. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1021. ; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1022. test_h_gr32 0xd2d2d2d2 er0
  1023. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1024. test_gr_a5a5 2
  1025. test_gr_a5a5 3
  1026. test_gr_a5a5 4
  1027. test_gr_a5a5 5
  1028. test_gr_a5a5 6
  1029. test_gr_a5a5 7
  1030. .if (sim_cpu == h8sx)
  1031. rotr_l_ind_1:
  1032. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1033. set_ccr_zero
  1034. mov #long_dest, er0
  1035. rotr.l @er0 ; shift right arithmetic by one, indirect
  1036. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1037. test_zero_clear
  1038. test_ovf_clear
  1039. test_neg_set
  1040. test_h_gr32 long_dest er0
  1041. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1042. test_gr_a5a5 2
  1043. test_gr_a5a5 3
  1044. test_gr_a5a5 4
  1045. test_gr_a5a5 5
  1046. test_gr_a5a5 6
  1047. test_gr_a5a5 7
  1048. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1049. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1050. cmp.l #0xd2d2d2d2, @long_dest
  1051. beq .Llind1
  1052. fail
  1053. .Llind1:
  1054. mov #0xa5a5a5a5, @long_dest
  1055. rotr_l_postinc_1:
  1056. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1057. set_ccr_zero
  1058. mov #long_dest, er0
  1059. rotr.l @er0+ ; shift right arithmetic by one, postinc
  1060. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1061. test_zero_clear
  1062. test_ovf_clear
  1063. test_neg_set
  1064. test_h_gr32 long_dest+4 er0
  1065. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1066. test_gr_a5a5 2
  1067. test_gr_a5a5 3
  1068. test_gr_a5a5 4
  1069. test_gr_a5a5 5
  1070. test_gr_a5a5 6
  1071. test_gr_a5a5 7
  1072. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1073. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1074. cmp.l #0xd2d2d2d2, @long_dest
  1075. beq .Llpostinc1
  1076. fail
  1077. .Llpostinc1:
  1078. mov #0xa5a5a5a5, @long_dest
  1079. rotr_l_postdec_1:
  1080. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1081. set_ccr_zero
  1082. mov #long_dest, er0
  1083. rotr.l @er0- ; shift right arithmetic by one, postdec
  1084. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1085. test_zero_clear
  1086. test_ovf_clear
  1087. test_neg_set
  1088. test_h_gr32 long_dest-4 er0
  1089. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1090. test_gr_a5a5 2
  1091. test_gr_a5a5 3
  1092. test_gr_a5a5 4
  1093. test_gr_a5a5 5
  1094. test_gr_a5a5 6
  1095. test_gr_a5a5 7
  1096. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1097. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1098. cmp.l #0xd2d2d2d2, @long_dest
  1099. beq .Llpostdec1
  1100. fail
  1101. .Llpostdec1:
  1102. mov #0xa5a5a5a5, @long_dest
  1103. rotr_l_preinc_1:
  1104. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1105. set_ccr_zero
  1106. mov #long_dest-4, er0
  1107. rotr.l @+er0 ; shift right arithmetic by one, preinc
  1108. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1109. test_zero_clear
  1110. test_ovf_clear
  1111. test_neg_set
  1112. test_h_gr32 long_dest er0
  1113. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1114. test_gr_a5a5 2
  1115. test_gr_a5a5 3
  1116. test_gr_a5a5 4
  1117. test_gr_a5a5 5
  1118. test_gr_a5a5 6
  1119. test_gr_a5a5 7
  1120. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1121. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1122. cmp.l #0xd2d2d2d2, @long_dest
  1123. beq .Llpreinc1
  1124. fail
  1125. .Llpreinc1:
  1126. mov #0xa5a5a5a5, @long_dest
  1127. rotr_l_predec_1:
  1128. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1129. set_ccr_zero
  1130. mov #long_dest+4, er0
  1131. rotr.l @-er0 ; shift right arithmetic by one, predec
  1132. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1133. test_zero_clear
  1134. test_ovf_clear
  1135. test_neg_set
  1136. test_h_gr32 long_dest er0
  1137. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1138. test_gr_a5a5 2
  1139. test_gr_a5a5 3
  1140. test_gr_a5a5 4
  1141. test_gr_a5a5 5
  1142. test_gr_a5a5 6
  1143. test_gr_a5a5 7
  1144. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1145. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1146. cmp.l #0xd2d2d2d2, @long_dest
  1147. beq .Llpredec1
  1148. fail
  1149. .Llpredec1:
  1150. mov #0xa5a5a5a5, @long_dest
  1151. rotr_l_disp2_1:
  1152. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1153. set_ccr_zero
  1154. mov #long_dest-8, er0
  1155. rotr.l @(8:2, er0) ; shift right arithmetic by one, disp2
  1156. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1157. test_zero_clear
  1158. test_ovf_clear
  1159. test_neg_set
  1160. test_h_gr32 long_dest-8 er0
  1161. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1162. test_gr_a5a5 2
  1163. test_gr_a5a5 3
  1164. test_gr_a5a5 4
  1165. test_gr_a5a5 5
  1166. test_gr_a5a5 6
  1167. test_gr_a5a5 7
  1168. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1169. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1170. cmp.l #0xd2d2d2d2, @long_dest
  1171. beq .Lldisp21
  1172. fail
  1173. .Lldisp21:
  1174. mov #0xa5a5a5a5, @long_dest
  1175. rotr_l_disp16_1:
  1176. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1177. set_ccr_zero
  1178. mov #long_dest-44, er0
  1179. rotr.l @(44:16, er0) ; shift right arithmetic by one, disp16
  1180. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1181. test_zero_clear
  1182. test_ovf_clear
  1183. test_neg_set
  1184. test_h_gr32 long_dest-44 er0
  1185. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1186. test_gr_a5a5 2
  1187. test_gr_a5a5 3
  1188. test_gr_a5a5 4
  1189. test_gr_a5a5 5
  1190. test_gr_a5a5 6
  1191. test_gr_a5a5 7
  1192. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1193. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1194. cmp.l #0xd2d2d2d2, @long_dest
  1195. beq .Lldisp161
  1196. fail
  1197. .Lldisp161:
  1198. mov #0xa5a5a5a5, @long_dest
  1199. rotr_l_disp32_1:
  1200. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1201. set_ccr_zero
  1202. mov #long_dest-666, er0
  1203. rotr.l @(666:32, er0) ; shift right arithmetic by one, disp32
  1204. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1205. test_zero_clear
  1206. test_ovf_clear
  1207. test_neg_set
  1208. test_h_gr32 long_dest-666 er0
  1209. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1210. test_gr_a5a5 2
  1211. test_gr_a5a5 3
  1212. test_gr_a5a5 4
  1213. test_gr_a5a5 5
  1214. test_gr_a5a5 6
  1215. test_gr_a5a5 7
  1216. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1217. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1218. cmp.l #0xd2d2d2d2, @long_dest
  1219. beq .Lldisp321
  1220. fail
  1221. .Lldisp321:
  1222. mov #0xa5a5a5a5, @long_dest
  1223. rotr_l_abs16_1:
  1224. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1225. set_ccr_zero
  1226. rotr.l @long_dest:16 ; shift right arithmetic by one, abs16
  1227. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1228. test_zero_clear
  1229. test_ovf_clear
  1230. test_neg_set
  1231. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1232. test_gr_a5a5 1
  1233. test_gr_a5a5 2
  1234. test_gr_a5a5 3
  1235. test_gr_a5a5 4
  1236. test_gr_a5a5 5
  1237. test_gr_a5a5 6
  1238. test_gr_a5a5 7
  1239. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1240. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1241. cmp.l #0xd2d2d2d2, @long_dest
  1242. beq .Llabs161
  1243. fail
  1244. .Llabs161:
  1245. mov #0xa5a5a5a5, @long_dest
  1246. rotr_l_abs32_1:
  1247. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1248. set_ccr_zero
  1249. rotr.l @long_dest:32 ; shift right arithmetic by one, abs32
  1250. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1251. test_zero_clear
  1252. test_ovf_clear
  1253. test_neg_set
  1254. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1255. test_gr_a5a5 1
  1256. test_gr_a5a5 2
  1257. test_gr_a5a5 3
  1258. test_gr_a5a5 4
  1259. test_gr_a5a5 5
  1260. test_gr_a5a5 6
  1261. test_gr_a5a5 7
  1262. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1263. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1264. cmp.l #0xd2d2d2d2, @long_dest
  1265. beq .Llabs321
  1266. fail
  1267. .Llabs321:
  1268. mov #0xa5a5a5a5, @long_dest
  1269. .endif
  1270. rotr_l_reg32_2:
  1271. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1272. set_ccr_zero
  1273. rotr.l #2, er0 ; shift right arithmetic by two, register
  1274. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1275. test_zero_clear
  1276. test_ovf_clear
  1277. test_neg_clear
  1278. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1279. ; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1280. test_h_gr32 0x69696969 er0
  1281. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1282. test_gr_a5a5 2
  1283. test_gr_a5a5 3
  1284. test_gr_a5a5 4
  1285. test_gr_a5a5 5
  1286. test_gr_a5a5 6
  1287. test_gr_a5a5 7
  1288. .if (sim_cpu == h8sx)
  1289. rotr_l_ind_2:
  1290. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1291. set_ccr_zero
  1292. mov #long_dest, er0
  1293. rotr.l #2, @er0 ; shift right arithmetic by two, indirect
  1294. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1295. test_zero_clear
  1296. test_ovf_clear
  1297. test_neg_clear
  1298. test_h_gr32 long_dest er0
  1299. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1300. test_gr_a5a5 2
  1301. test_gr_a5a5 3
  1302. test_gr_a5a5 4
  1303. test_gr_a5a5 5
  1304. test_gr_a5a5 6
  1305. test_gr_a5a5 7
  1306. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1307. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1308. cmp.l #0x69696969, @long_dest
  1309. beq .Llind2
  1310. fail
  1311. .Llind2:
  1312. mov #0xa5a5a5a5, @long_dest
  1313. rotr_l_postinc_2:
  1314. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1315. set_ccr_zero
  1316. mov #long_dest, er0
  1317. rotr.l #2, @er0+ ; shift right arithmetic by two, postinc
  1318. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1319. test_zero_clear
  1320. test_ovf_clear
  1321. test_neg_clear
  1322. test_h_gr32 long_dest+4 er0
  1323. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1324. test_gr_a5a5 2
  1325. test_gr_a5a5 3
  1326. test_gr_a5a5 4
  1327. test_gr_a5a5 5
  1328. test_gr_a5a5 6
  1329. test_gr_a5a5 7
  1330. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1331. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1332. cmp.l #0x69696969, @long_dest
  1333. beq .Llpostinc2
  1334. fail
  1335. .Llpostinc2:
  1336. mov #0xa5a5a5a5, @long_dest
  1337. rotr_l_postdec_2:
  1338. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1339. set_ccr_zero
  1340. mov #long_dest, er0
  1341. rotr.l #2, @er0- ; shift right arithmetic by two, postdec
  1342. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1343. test_zero_clear
  1344. test_ovf_clear
  1345. test_neg_clear
  1346. test_h_gr32 long_dest-4 er0
  1347. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1348. test_gr_a5a5 2
  1349. test_gr_a5a5 3
  1350. test_gr_a5a5 4
  1351. test_gr_a5a5 5
  1352. test_gr_a5a5 6
  1353. test_gr_a5a5 7
  1354. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1355. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1356. cmp.l #0x69696969, @long_dest
  1357. beq .Llpostdec2
  1358. fail
  1359. .Llpostdec2:
  1360. mov #0xa5a5a5a5, @long_dest
  1361. rotr_l_preinc_2:
  1362. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1363. set_ccr_zero
  1364. mov #long_dest-4, er0
  1365. rotr.l #2, @+er0 ; shift right arithmetic by two, preinc
  1366. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1367. test_zero_clear
  1368. test_ovf_clear
  1369. test_neg_clear
  1370. test_h_gr32 long_dest er0
  1371. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1372. test_gr_a5a5 2
  1373. test_gr_a5a5 3
  1374. test_gr_a5a5 4
  1375. test_gr_a5a5 5
  1376. test_gr_a5a5 6
  1377. test_gr_a5a5 7
  1378. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1379. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1380. cmp.l #0x69696969, @long_dest
  1381. beq .Llpreinc2
  1382. fail
  1383. .Llpreinc2:
  1384. mov #0xa5a5a5a5, @long_dest
  1385. rotr_l_predec_2:
  1386. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1387. set_ccr_zero
  1388. mov #long_dest+4, er0
  1389. rotr.l #2, @-er0 ; shift right arithmetic by two, predec
  1390. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1391. test_zero_clear
  1392. test_ovf_clear
  1393. test_neg_clear
  1394. test_h_gr32 long_dest er0
  1395. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1396. test_gr_a5a5 2
  1397. test_gr_a5a5 3
  1398. test_gr_a5a5 4
  1399. test_gr_a5a5 5
  1400. test_gr_a5a5 6
  1401. test_gr_a5a5 7
  1402. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1403. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1404. cmp.l #0x69696969, @long_dest
  1405. beq .Llpredec2
  1406. fail
  1407. .Llpredec2:
  1408. mov #0xa5a5a5a5, @long_dest
  1409. rotr_l_disp2_2:
  1410. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1411. set_ccr_zero
  1412. mov #long_dest-8, er0
  1413. rotr.l #2, @(8:2, er0) ; shift right arithmetic by two, disp2
  1414. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1415. test_zero_clear
  1416. test_ovf_clear
  1417. test_neg_clear
  1418. test_h_gr32 long_dest-8 er0
  1419. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1420. test_gr_a5a5 2
  1421. test_gr_a5a5 3
  1422. test_gr_a5a5 4
  1423. test_gr_a5a5 5
  1424. test_gr_a5a5 6
  1425. test_gr_a5a5 7
  1426. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1427. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1428. cmp.l #0x69696969, @long_dest
  1429. beq .Lldisp22
  1430. fail
  1431. .Lldisp22:
  1432. mov #0xa5a5a5a5, @long_dest
  1433. rotr_l_disp16_2:
  1434. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1435. set_ccr_zero
  1436. mov #long_dest-44, er0
  1437. rotr.l #2, @(44:16, er0) ; shift right arithmetic by two, disp16
  1438. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1439. test_zero_clear
  1440. test_ovf_clear
  1441. test_neg_clear
  1442. test_h_gr32 long_dest-44 er0
  1443. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1444. test_gr_a5a5 2
  1445. test_gr_a5a5 3
  1446. test_gr_a5a5 4
  1447. test_gr_a5a5 5
  1448. test_gr_a5a5 6
  1449. test_gr_a5a5 7
  1450. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1451. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1452. cmp.l #0x69696969, @long_dest
  1453. beq .Lldisp162
  1454. fail
  1455. .Lldisp162:
  1456. mov #0xa5a5a5a5, @long_dest
  1457. rotr_l_disp32_2:
  1458. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1459. set_ccr_zero
  1460. mov #long_dest-666, er0
  1461. rotr.l #2, @(666:32, er0) ; shift right arithmetic by two, disp32
  1462. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1463. test_zero_clear
  1464. test_ovf_clear
  1465. test_neg_clear
  1466. test_h_gr32 long_dest-666 er0
  1467. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1468. test_gr_a5a5 2
  1469. test_gr_a5a5 3
  1470. test_gr_a5a5 4
  1471. test_gr_a5a5 5
  1472. test_gr_a5a5 6
  1473. test_gr_a5a5 7
  1474. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1475. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1476. cmp.l #0x69696969, @long_dest
  1477. beq .Lldisp322
  1478. fail
  1479. .Lldisp322:
  1480. mov #0xa5a5a5a5, @long_dest
  1481. rotr_l_abs16_2:
  1482. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1483. set_ccr_zero
  1484. rotr.l #2, @long_dest:16 ; shift right arithmetic by two, abs16
  1485. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1486. test_zero_clear
  1487. test_ovf_clear
  1488. test_neg_clear
  1489. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1490. test_gr_a5a5 1
  1491. test_gr_a5a5 2
  1492. test_gr_a5a5 3
  1493. test_gr_a5a5 4
  1494. test_gr_a5a5 5
  1495. test_gr_a5a5 6
  1496. test_gr_a5a5 7
  1497. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1498. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1499. cmp.l #0x69696969, @long_dest
  1500. beq .Llabs162
  1501. fail
  1502. .Llabs162:
  1503. mov #0xa5a5a5a5, @long_dest
  1504. rotr_l_abs32_2:
  1505. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1506. set_ccr_zero
  1507. rotr.l #2, @long_dest:32 ; shift right arithmetic by two, abs32
  1508. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  1509. test_zero_clear
  1510. test_ovf_clear
  1511. test_neg_clear
  1512. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1513. test_gr_a5a5 1
  1514. test_gr_a5a5 2
  1515. test_gr_a5a5 3
  1516. test_gr_a5a5 4
  1517. test_gr_a5a5 5
  1518. test_gr_a5a5 6
  1519. test_gr_a5a5 7
  1520. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1521. ;; -> 0110 1001 0110 1001 0110 1001 0110 1001
  1522. cmp.l #0x69696969, @long_dest
  1523. beq .Llabs322
  1524. fail
  1525. .Llabs322:
  1526. mov #0xa5a5a5a5, @long_dest
  1527. .endif
  1528. .endif
  1529. pass
  1530. exit 0