shar.s 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000
  1. # Hitachi H8 testcase 'shar'
  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. shar_b_reg8_1:
  20. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  21. set_ccr_zero
  22. shar.b r0l ; shift right arithmetic by one
  23. ;;; .word 0x1188
  24. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  25. test_zero_clear
  26. test_ovf_clear
  27. test_neg_set
  28. test_h_gr16 0xa5d2 r0 ; 1010 0101 -> 1101 0010
  29. .if (sim_cpu)
  30. test_h_gr32 0xa5a5a5d2 er0
  31. .endif
  32. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  33. test_gr_a5a5 2
  34. test_gr_a5a5 3
  35. test_gr_a5a5 4
  36. test_gr_a5a5 5
  37. test_gr_a5a5 6
  38. test_gr_a5a5 7
  39. .if (sim_cpu == h8sx)
  40. shar_b_ind_1:
  41. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  42. set_ccr_zero
  43. mov #byte_dest, er0
  44. shar.b @er0 ; shift right arithmetic by one, indirect
  45. ;;; .word 0x7d00
  46. ;;; .word 0x1180
  47. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  48. test_zero_clear
  49. test_ovf_clear
  50. test_neg_set
  51. test_h_gr32 byte_dest er0
  52. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  53. test_gr_a5a5 2
  54. test_gr_a5a5 3
  55. test_gr_a5a5 4
  56. test_gr_a5a5 5
  57. test_gr_a5a5 6
  58. test_gr_a5a5 7
  59. ; 1010 0101 -> 1101 0010
  60. cmp.b #0xd2, @byte_dest
  61. beq .Lbind1
  62. fail
  63. .Lbind1:
  64. mov.b #0xa5, @byte_dest
  65. shar_b_postinc_1:
  66. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  67. set_ccr_zero
  68. mov #byte_dest, er0
  69. shar.b @er0+ ; shift right arithmetic by one, postinc
  70. ;;; .word 0x0174
  71. ;;; .word 0x6c08
  72. ;;; .word 0x1180
  73. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  74. test_zero_clear
  75. test_ovf_clear
  76. test_neg_set
  77. test_h_gr32 byte_dest+1 er0
  78. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  79. test_gr_a5a5 2
  80. test_gr_a5a5 3
  81. test_gr_a5a5 4
  82. test_gr_a5a5 5
  83. test_gr_a5a5 6
  84. test_gr_a5a5 7
  85. ; 1010 0101 -> 1101 0010
  86. cmp.b #0xd2, @byte_dest
  87. beq .Lbpostinc1
  88. fail
  89. .Lbpostinc1:
  90. mov.b #0xa5, @byte_dest
  91. shar_b_postdec_1:
  92. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  93. set_ccr_zero
  94. mov #byte_dest, er0
  95. shar.b @er0- ; shift right arithmetic by one, postdec
  96. ;;; .word 0x0176
  97. ;;; .word 0x6c08
  98. ;;; .word 0x1180
  99. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  100. test_zero_clear
  101. test_ovf_clear
  102. test_neg_set
  103. test_h_gr32 byte_dest-1 er0
  104. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  105. test_gr_a5a5 2
  106. test_gr_a5a5 3
  107. test_gr_a5a5 4
  108. test_gr_a5a5 5
  109. test_gr_a5a5 6
  110. test_gr_a5a5 7
  111. ; 1010 0101 -> 1101 0010
  112. cmp.b #0xd2, @byte_dest
  113. beq .Lbpostdec1
  114. fail
  115. .Lbpostdec1:
  116. mov.b #0xa5, @byte_dest
  117. shar_b_preinc_1:
  118. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  119. set_ccr_zero
  120. mov #byte_dest-1, er0
  121. shar.b @+er0 ; shift right arithmetic by one, preinc
  122. ;;; .word 0x0175
  123. ;;; .word 0x6c08
  124. ;;; .word 0x1180
  125. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  126. test_zero_clear
  127. test_ovf_clear
  128. test_neg_set
  129. test_h_gr32 byte_dest er0
  130. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  131. test_gr_a5a5 2
  132. test_gr_a5a5 3
  133. test_gr_a5a5 4
  134. test_gr_a5a5 5
  135. test_gr_a5a5 6
  136. test_gr_a5a5 7
  137. ; 1010 0101 -> 1101 0010
  138. cmp.b #0xd2, @byte_dest
  139. beq .Lbpreinc1
  140. fail
  141. .Lbpreinc1:
  142. mov.b #0xa5, @byte_dest
  143. shar_b_predec_1:
  144. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  145. set_ccr_zero
  146. mov #byte_dest+1, er0
  147. shar.b @-er0 ; shift right arithmetic by one, predec
  148. ;;; .word 0x0177
  149. ;;; .word 0x6c08
  150. ;;; .word 0x1180
  151. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  152. test_zero_clear
  153. test_ovf_clear
  154. test_neg_set
  155. test_h_gr32 byte_dest er0
  156. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  157. test_gr_a5a5 2
  158. test_gr_a5a5 3
  159. test_gr_a5a5 4
  160. test_gr_a5a5 5
  161. test_gr_a5a5 6
  162. test_gr_a5a5 7
  163. ; 1010 0101 -> 1101 0010
  164. cmp.b #0xd2, @byte_dest
  165. beq .Lbpredec1
  166. fail
  167. .Lbpredec1:
  168. mov.b #0xa5, @byte_dest
  169. shar_b_disp2_1:
  170. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  171. set_ccr_zero
  172. mov #byte_dest-2, er0
  173. shar.b @(2:2, er0) ; shift right arithmetic by one, disp2
  174. ;;; .word 0x0176
  175. ;;; .word 0x6808
  176. ;;; .word 0x1180
  177. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  178. test_zero_clear
  179. test_ovf_clear
  180. test_neg_set
  181. test_h_gr32 byte_dest-2 er0
  182. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  183. test_gr_a5a5 2
  184. test_gr_a5a5 3
  185. test_gr_a5a5 4
  186. test_gr_a5a5 5
  187. test_gr_a5a5 6
  188. test_gr_a5a5 7
  189. ; 1010 0101 -> 1101 0010
  190. cmp.b #0xd2, @byte_dest
  191. beq .Lbdisp21
  192. fail
  193. .Lbdisp21:
  194. mov.b #0xa5, @byte_dest
  195. shar_b_disp16_1:
  196. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  197. set_ccr_zero
  198. mov #byte_dest-44, er0
  199. shar.b @(44:16, er0) ; shift right arithmetic by one, disp16
  200. ;;; .word 0x0174
  201. ;;; .word 0x6e08
  202. ;;; .word 44
  203. ;;; .word 0x1180
  204. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  205. test_zero_clear
  206. test_ovf_clear
  207. test_neg_set
  208. test_h_gr32 byte_dest-44 er0
  209. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  210. test_gr_a5a5 2
  211. test_gr_a5a5 3
  212. test_gr_a5a5 4
  213. test_gr_a5a5 5
  214. test_gr_a5a5 6
  215. test_gr_a5a5 7
  216. ; 1010 0101 -> 1101 0010
  217. cmp.b #0xd2, @byte_dest
  218. beq .Lbdisp161
  219. fail
  220. .Lbdisp161:
  221. mov.b #0xa5, @byte_dest
  222. shar_b_disp32_1:
  223. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  224. set_ccr_zero
  225. mov #byte_dest-666, er0
  226. shar.b @(666:32, er0) ; shift right arithmetic by one, disp32
  227. ;;; .word 0x7884
  228. ;;; .word 0x6a28
  229. ;;; .long 666
  230. ;;; .word 0x1180
  231. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  232. test_zero_clear
  233. test_ovf_clear
  234. test_neg_set
  235. test_h_gr32 byte_dest-666 er0
  236. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  237. test_gr_a5a5 2
  238. test_gr_a5a5 3
  239. test_gr_a5a5 4
  240. test_gr_a5a5 5
  241. test_gr_a5a5 6
  242. test_gr_a5a5 7
  243. ; 1010 0101 -> 1101 0010
  244. cmp.b #0xd2, @byte_dest
  245. beq .Lbdisp321
  246. fail
  247. .Lbdisp321:
  248. mov.b #0xa5, @byte_dest
  249. shar_b_abs16_1:
  250. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  251. set_ccr_zero
  252. shar.b @byte_dest:16 ; shift right arithmetic by one, abs16
  253. ;;; .word 0x6a18
  254. ;;; .word byte_dest
  255. ;;; .word 0x1180
  256. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  257. test_zero_clear
  258. test_ovf_clear
  259. test_neg_set
  260. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  261. test_gr_a5a5 2
  262. test_gr_a5a5 2
  263. test_gr_a5a5 3
  264. test_gr_a5a5 4
  265. test_gr_a5a5 5
  266. test_gr_a5a5 6
  267. test_gr_a5a5 7
  268. ; 1010 0101 -> 1101 0010
  269. cmp.b #0xd2, @byte_dest
  270. beq .Lbabs161
  271. fail
  272. .Lbabs161:
  273. mov.b #0xa5, @byte_dest
  274. shar_b_abs32_1:
  275. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  276. set_ccr_zero
  277. shar.b @byte_dest:32 ; shift right arithmetic by one, abs32
  278. ;;; .word 0x6a38
  279. ;;; .long byte_dest
  280. ;;; .word 0x1180
  281. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  282. test_zero_clear
  283. test_ovf_clear
  284. test_neg_set
  285. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  286. test_gr_a5a5 2
  287. test_gr_a5a5 2
  288. test_gr_a5a5 3
  289. test_gr_a5a5 4
  290. test_gr_a5a5 5
  291. test_gr_a5a5 6
  292. test_gr_a5a5 7
  293. ; 1010 0101 -> 1101 0010
  294. cmp.b #0xd2, @byte_dest
  295. beq .Lbabs321
  296. fail
  297. .Lbabs321:
  298. mov.b #0xa5, @byte_dest
  299. .endif
  300. shar_b_reg8_2:
  301. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  302. set_ccr_zero
  303. shar.b #2, r0l ; shift right arithmetic by two
  304. ;;; .word 0x11c8
  305. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  306. test_zero_clear
  307. test_ovf_clear
  308. test_neg_set
  309. test_h_gr16 0xa5e9 r0 ; 1010 0101 -> 1110 1001
  310. .if (sim_cpu)
  311. test_h_gr32 0xa5a5a5e9 er0
  312. .endif
  313. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  314. test_gr_a5a5 2
  315. test_gr_a5a5 3
  316. test_gr_a5a5 4
  317. test_gr_a5a5 5
  318. test_gr_a5a5 6
  319. test_gr_a5a5 7
  320. .if (sim_cpu == h8sx)
  321. shar_b_ind_2:
  322. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  323. set_ccr_zero
  324. mov #byte_dest, er0
  325. shar.b #2, @er0 ; shift right arithmetic by two, indirect
  326. ;;; .word 0x7d00
  327. ;;; .word 0x11c0
  328. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  329. test_zero_clear
  330. test_ovf_clear
  331. test_neg_set
  332. test_h_gr32 byte_dest er0
  333. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  334. test_gr_a5a5 2
  335. test_gr_a5a5 3
  336. test_gr_a5a5 4
  337. test_gr_a5a5 5
  338. test_gr_a5a5 6
  339. test_gr_a5a5 7
  340. ; 1010 0101 -> 1110 1001
  341. cmp.b #0xe9, @byte_dest
  342. beq .Lbind2
  343. fail
  344. .Lbind2:
  345. mov.b #0xa5, @byte_dest
  346. shar_b_postinc_2:
  347. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  348. set_ccr_zero
  349. mov #byte_dest, er0
  350. shar.b #2, @er0+ ; shift right arithmetic by two, postinc
  351. ;;; .word 0x0174
  352. ;;; .word 0x6c08
  353. ;;; .word 0x11c0
  354. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  355. test_zero_clear
  356. test_ovf_clear
  357. test_neg_set
  358. test_h_gr32 byte_dest+1 er0
  359. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  360. test_gr_a5a5 2
  361. test_gr_a5a5 3
  362. test_gr_a5a5 4
  363. test_gr_a5a5 5
  364. test_gr_a5a5 6
  365. test_gr_a5a5 7
  366. ; 1010 0101 -> 1110 1001
  367. cmp.b #0xe9, @byte_dest
  368. beq .Lbpostinc2
  369. fail
  370. .Lbpostinc2:
  371. mov.b #0xa5, @byte_dest
  372. shar_b_postdec_2:
  373. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  374. set_ccr_zero
  375. mov #byte_dest, er0
  376. shar.b #2, @er0- ; shift right arithmetic by two, postdec
  377. ;;; .word 0x0176
  378. ;;; .word 0x6c08
  379. ;;; .word 0x11c0
  380. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  381. test_zero_clear
  382. test_ovf_clear
  383. test_neg_set
  384. test_h_gr32 byte_dest-1 er0
  385. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  386. test_gr_a5a5 2
  387. test_gr_a5a5 3
  388. test_gr_a5a5 4
  389. test_gr_a5a5 5
  390. test_gr_a5a5 6
  391. test_gr_a5a5 7
  392. ; 1010 0101 -> 1110 1001
  393. cmp.b #0xe9, @byte_dest
  394. beq .Lbpostdec2
  395. fail
  396. .Lbpostdec2:
  397. mov.b #0xa5, @byte_dest
  398. shar_b_preinc_2:
  399. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  400. set_ccr_zero
  401. mov #byte_dest-1, er0
  402. shar.b #2, @+er0 ; shift right arithmetic by two, preinc
  403. ;;; .word 0x0175
  404. ;;; .word 0x6c08
  405. ;;; .word 0x11c0
  406. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  407. test_zero_clear
  408. test_ovf_clear
  409. test_neg_set
  410. test_h_gr32 byte_dest er0
  411. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  412. test_gr_a5a5 2
  413. test_gr_a5a5 3
  414. test_gr_a5a5 4
  415. test_gr_a5a5 5
  416. test_gr_a5a5 6
  417. test_gr_a5a5 7
  418. ; 1010 0101 -> 1110 1001
  419. cmp.b #0xe9, @byte_dest
  420. beq .Lbpreinc2
  421. fail
  422. .Lbpreinc2:
  423. mov.b #0xa5, @byte_dest
  424. shar_b_predec_2:
  425. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  426. set_ccr_zero
  427. mov #byte_dest+1, er0
  428. shar.b #2, @-er0 ; shift right arithmetic by two, predec
  429. ;;; .word 0x0177
  430. ;;; .word 0x6c08
  431. ;;; .word 0x11c0
  432. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  433. test_zero_clear
  434. test_ovf_clear
  435. test_neg_set
  436. test_h_gr32 byte_dest er0
  437. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  438. test_gr_a5a5 2
  439. test_gr_a5a5 3
  440. test_gr_a5a5 4
  441. test_gr_a5a5 5
  442. test_gr_a5a5 6
  443. test_gr_a5a5 7
  444. ; 1010 0101 -> 1110 1001
  445. cmp.b #0xe9, @byte_dest
  446. beq .Lbpredec2
  447. fail
  448. .Lbpredec2:
  449. mov.b #0xa5, @byte_dest
  450. shar_b_disp2_2:
  451. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  452. set_ccr_zero
  453. mov #byte_dest-2, er0
  454. shar.b #2, @(2:2, er0) ; shift right arithmetic by two, disp2
  455. ;;; .word 0x0176
  456. ;;; .word 0x6808
  457. ;;; .word 0x11c0
  458. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  459. test_zero_clear
  460. test_ovf_clear
  461. test_neg_set
  462. test_h_gr32 byte_dest-2 er0
  463. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  464. test_gr_a5a5 2
  465. test_gr_a5a5 3
  466. test_gr_a5a5 4
  467. test_gr_a5a5 5
  468. test_gr_a5a5 6
  469. test_gr_a5a5 7
  470. ; 1010 0101 -> 1110 1001
  471. cmp.b #0xe9, @byte_dest
  472. beq .Lbdisp22
  473. fail
  474. .Lbdisp22:
  475. mov.b #0xa5, @byte_dest
  476. shar_b_disp16_2:
  477. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  478. set_ccr_zero
  479. mov #byte_dest-44, er0
  480. shar.b #2, @(44:16, er0) ; shift right arithmetic by two, disp16
  481. ;;; .word 0x0174
  482. ;;; .word 0x6e08
  483. ;;; .word 44
  484. ;;; .word 0x11c0
  485. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  486. test_zero_clear
  487. test_ovf_clear
  488. test_neg_set
  489. test_h_gr32 byte_dest-44 er0
  490. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  491. test_gr_a5a5 2
  492. test_gr_a5a5 3
  493. test_gr_a5a5 4
  494. test_gr_a5a5 5
  495. test_gr_a5a5 6
  496. test_gr_a5a5 7
  497. ; 1010 0101 -> 1110 1001
  498. cmp.b #0xe9, @byte_dest
  499. beq .Lbdisp162
  500. fail
  501. .Lbdisp162:
  502. mov.b #0xa5, @byte_dest
  503. shar_b_disp32_2:
  504. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  505. set_ccr_zero
  506. mov #byte_dest-666, er0
  507. shar.b #2, @(666:32, er0) ; shift right arithmetic by two, disp32
  508. ;;; .word 0x7884
  509. ;;; .word 0x6a28
  510. ;;; .long 666
  511. ;;; .word 0x11c0
  512. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  513. test_zero_clear
  514. test_ovf_clear
  515. test_neg_set
  516. test_h_gr32 byte_dest-666 er0
  517. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  518. test_gr_a5a5 2
  519. test_gr_a5a5 3
  520. test_gr_a5a5 4
  521. test_gr_a5a5 5
  522. test_gr_a5a5 6
  523. test_gr_a5a5 7
  524. ; 1010 0101 -> 1110 1001
  525. cmp.b #0xe9, @byte_dest
  526. beq .Lbdisp322
  527. fail
  528. .Lbdisp322:
  529. mov.b #0xa5, @byte_dest
  530. shar_b_abs16_2:
  531. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  532. set_ccr_zero
  533. shar.b #2, @byte_dest:16 ; shift right arithmetic by two, abs16
  534. ;;; .word 0x6a18
  535. ;;; .word byte_dest
  536. ;;; .word 0x11c0
  537. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  538. test_zero_clear
  539. test_ovf_clear
  540. test_neg_set
  541. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  542. test_gr_a5a5 2
  543. test_gr_a5a5 2
  544. test_gr_a5a5 3
  545. test_gr_a5a5 4
  546. test_gr_a5a5 5
  547. test_gr_a5a5 6
  548. test_gr_a5a5 7
  549. ; 1010 0101 -> 1110 1001
  550. cmp.b #0xe9, @byte_dest
  551. beq .Lbabs162
  552. fail
  553. .Lbabs162:
  554. mov.b #0xa5, @byte_dest
  555. shar_b_abs32_2:
  556. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  557. set_ccr_zero
  558. shar.b #2, @byte_dest:32 ; shift right arithmetic by two, abs32
  559. ;;; .word 0x6a38
  560. ;;; .long byte_dest
  561. ;;; .word 0x11c0
  562. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  563. test_zero_clear
  564. test_ovf_clear
  565. test_neg_set
  566. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  567. test_gr_a5a5 2
  568. test_gr_a5a5 2
  569. test_gr_a5a5 3
  570. test_gr_a5a5 4
  571. test_gr_a5a5 5
  572. test_gr_a5a5 6
  573. test_gr_a5a5 7
  574. ; 1010 0101 -> 1110 1001
  575. cmp.b #0xe9, @byte_dest
  576. beq .Lbabs322
  577. fail
  578. .Lbabs322:
  579. mov.b #0xa5, @byte_dest
  580. .endif
  581. .if (sim_cpu) ; Not available in h8300 mode
  582. shar_w_reg16_1:
  583. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  584. set_ccr_zero
  585. shar.w r0 ; shift right arithmetic by one
  586. ;;; .word 0x1190
  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_gr16 0xd2d2 r0 ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  592. test_h_gr32 0xa5a5d2d2 er0
  593. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  594. test_gr_a5a5 2
  595. test_gr_a5a5 3
  596. test_gr_a5a5 4
  597. test_gr_a5a5 5
  598. test_gr_a5a5 6
  599. test_gr_a5a5 7
  600. .if (sim_cpu == h8sx)
  601. shar_w_ind_1:
  602. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  603. set_ccr_zero
  604. mov #word_dest, er0
  605. shar.w @er0 ; shift right arithmetic by one, indirect
  606. ;;; .word 0x7d80
  607. ;;; .word 0x1190
  608. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  609. test_zero_clear
  610. test_ovf_clear
  611. test_neg_set
  612. test_h_gr32 word_dest er0
  613. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  614. test_gr_a5a5 2
  615. test_gr_a5a5 3
  616. test_gr_a5a5 4
  617. test_gr_a5a5 5
  618. test_gr_a5a5 6
  619. test_gr_a5a5 7
  620. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  621. cmp.w #0xd2d2, @word_dest
  622. beq .Lwind1
  623. fail
  624. .Lwind1:
  625. mov.w #0xa5a5, @word_dest
  626. shar_w_postinc_1:
  627. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  628. set_ccr_zero
  629. mov #word_dest, er0
  630. shar.w @er0+ ; shift right arithmetic by one, postinc
  631. ;;; .word 0x0154
  632. ;;; .word 0x6d08
  633. ;;; .word 0x1190
  634. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  635. test_zero_clear
  636. test_ovf_clear
  637. test_neg_set
  638. test_h_gr32 word_dest+2 er0
  639. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  640. test_gr_a5a5 2
  641. test_gr_a5a5 3
  642. test_gr_a5a5 4
  643. test_gr_a5a5 5
  644. test_gr_a5a5 6
  645. test_gr_a5a5 7
  646. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  647. cmp.w #0xd2d2, @word_dest
  648. beq .Lwpostinc1
  649. fail
  650. .Lwpostinc1:
  651. mov.w #0xa5a5, @word_dest
  652. shar_w_postdec_1:
  653. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  654. set_ccr_zero
  655. mov #word_dest, er0
  656. shar.w @er0- ; shift right arithmetic by one, postdec
  657. ;;; .word 0x0156
  658. ;;; .word 0x6d08
  659. ;;; .word 0x1190
  660. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  661. test_zero_clear
  662. test_ovf_clear
  663. test_neg_set
  664. test_h_gr32 word_dest-2 er0
  665. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  666. test_gr_a5a5 2
  667. test_gr_a5a5 3
  668. test_gr_a5a5 4
  669. test_gr_a5a5 5
  670. test_gr_a5a5 6
  671. test_gr_a5a5 7
  672. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  673. cmp.w #0xd2d2, @word_dest
  674. beq .Lwpostdec1
  675. fail
  676. .Lwpostdec1:
  677. mov.w #0xa5a5, @word_dest
  678. shar_w_preinc_1:
  679. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  680. set_ccr_zero
  681. mov #word_dest-2, er0
  682. shar.w @+er0 ; shift right arithmetic by one, preinc
  683. ;;; .word 0x0155
  684. ;;; .word 0x6d08
  685. ;;; .word 0x1190
  686. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  687. test_zero_clear
  688. test_ovf_clear
  689. test_neg_set
  690. test_h_gr32 word_dest er0
  691. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  692. test_gr_a5a5 2
  693. test_gr_a5a5 3
  694. test_gr_a5a5 4
  695. test_gr_a5a5 5
  696. test_gr_a5a5 6
  697. test_gr_a5a5 7
  698. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  699. cmp.w #0xd2d2, @word_dest
  700. beq .Lwpreinc1
  701. fail
  702. .Lwpreinc1:
  703. mov.w #0xa5a5, @word_dest
  704. shar_w_predec_1:
  705. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  706. set_ccr_zero
  707. mov #word_dest+2, er0
  708. shar.w @-er0 ; shift right arithmetic by one, predec
  709. ;;; .word 0x0157
  710. ;;; .word 0x6d08
  711. ;;; .word 0x1190
  712. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  713. test_zero_clear
  714. test_ovf_clear
  715. test_neg_set
  716. test_h_gr32 word_dest er0
  717. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  718. test_gr_a5a5 2
  719. test_gr_a5a5 3
  720. test_gr_a5a5 4
  721. test_gr_a5a5 5
  722. test_gr_a5a5 6
  723. test_gr_a5a5 7
  724. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  725. cmp.w #0xd2d2, @word_dest
  726. beq .Lwpredec1
  727. fail
  728. .Lwpredec1:
  729. mov.w #0xa5a5, @word_dest
  730. shar_w_disp2_1:
  731. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  732. set_ccr_zero
  733. mov #word_dest-4, er0
  734. shar.w @(4:2, er0) ; shift right arithmetic by one, disp2
  735. ;;; .word 0x0156
  736. ;;; .word 0x6908
  737. ;;; .word 0x1190
  738. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  739. test_zero_clear
  740. test_ovf_clear
  741. test_neg_set
  742. test_h_gr32 word_dest-4 er0
  743. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  744. test_gr_a5a5 2
  745. test_gr_a5a5 3
  746. test_gr_a5a5 4
  747. test_gr_a5a5 5
  748. test_gr_a5a5 6
  749. test_gr_a5a5 7
  750. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  751. cmp.w #0xd2d2, @word_dest
  752. beq .Lwdisp21
  753. fail
  754. .Lwdisp21:
  755. mov.w #0xa5a5, @word_dest
  756. shar_w_disp16_1:
  757. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  758. set_ccr_zero
  759. mov #word_dest-44, er0
  760. shar.w @(44:16, er0) ; shift right arithmetic by one, disp16
  761. ;;; .word 0x0154
  762. ;;; .word 0x6f08
  763. ;;; .word 44
  764. ;;; .word 0x1190
  765. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  766. test_zero_clear
  767. test_ovf_clear
  768. test_neg_set
  769. test_h_gr32 word_dest-44 er0
  770. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  771. test_gr_a5a5 2
  772. test_gr_a5a5 3
  773. test_gr_a5a5 4
  774. test_gr_a5a5 5
  775. test_gr_a5a5 6
  776. test_gr_a5a5 7
  777. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  778. cmp.w #0xd2d2, @word_dest
  779. beq .Lwdisp161
  780. fail
  781. .Lwdisp161:
  782. mov.w #0xa5a5, @word_dest
  783. shar_w_disp32_1:
  784. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  785. set_ccr_zero
  786. mov #word_dest-666, er0
  787. shar.w @(666:32, er0) ; shift right arithmetic by one, disp32
  788. ;;; .word 0x7884
  789. ;;; .word 0x6b28
  790. ;;; .long 666
  791. ;;; .word 0x1190
  792. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  793. test_zero_clear
  794. test_ovf_clear
  795. test_neg_set
  796. test_h_gr32 word_dest-666 er0
  797. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  798. test_gr_a5a5 2
  799. test_gr_a5a5 3
  800. test_gr_a5a5 4
  801. test_gr_a5a5 5
  802. test_gr_a5a5 6
  803. test_gr_a5a5 7
  804. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  805. cmp.w #0xd2d2, @word_dest
  806. beq .Lwdisp321
  807. fail
  808. .Lwdisp321:
  809. mov.w #0xa5a5, @word_dest
  810. shar_w_abs16_1:
  811. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  812. set_ccr_zero
  813. shar.w @word_dest:16 ; shift right arithmetic by one, abs16
  814. ;;; .word 0x6b18
  815. ;;; .word word_dest
  816. ;;; .word 0x1190
  817. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  818. test_zero_clear
  819. test_ovf_clear
  820. test_neg_set
  821. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  822. test_gr_a5a5 1
  823. test_gr_a5a5 2
  824. test_gr_a5a5 3
  825. test_gr_a5a5 4
  826. test_gr_a5a5 5
  827. test_gr_a5a5 6
  828. test_gr_a5a5 7
  829. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  830. cmp.w #0xd2d2, @word_dest
  831. beq .Lwabs161
  832. fail
  833. .Lwabs161:
  834. mov.w #0xa5a5, @word_dest
  835. shar_w_abs32_1:
  836. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  837. set_ccr_zero
  838. shar.w @word_dest:32 ; shift right arithmetic by one, abs32
  839. ;;; .word 0x6b38
  840. ;;; .long word_dest
  841. ;;; .word 0x1190
  842. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  843. test_zero_clear
  844. test_ovf_clear
  845. test_neg_set
  846. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  847. test_gr_a5a5 1
  848. test_gr_a5a5 2
  849. test_gr_a5a5 3
  850. test_gr_a5a5 4
  851. test_gr_a5a5 5
  852. test_gr_a5a5 6
  853. test_gr_a5a5 7
  854. ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
  855. cmp.w #0xd2d2, @word_dest
  856. beq .Lwabs321
  857. fail
  858. .Lwabs321:
  859. mov.w #0xa5a5, @word_dest
  860. .endif
  861. shar_w_reg16_2:
  862. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  863. set_ccr_zero
  864. shar.w #2, r0 ; shift right arithmetic by two
  865. ;;; .word 0x11d0
  866. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  867. test_zero_clear
  868. test_ovf_clear
  869. test_neg_set
  870. test_h_gr16 0xe969 r0 ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  871. test_h_gr32 0xa5a5e969 er0
  872. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  873. test_gr_a5a5 2
  874. test_gr_a5a5 3
  875. test_gr_a5a5 4
  876. test_gr_a5a5 5
  877. test_gr_a5a5 6
  878. test_gr_a5a5 7
  879. .if (sim_cpu == h8sx)
  880. shar_w_ind_2:
  881. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  882. set_ccr_zero
  883. mov #word_dest, er0
  884. shar.w #2, @er0 ; shift right arithmetic by two, indirect
  885. ;;; .word 0x7d80
  886. ;;; .word 0x11d0
  887. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  888. test_zero_clear
  889. test_ovf_clear
  890. test_neg_set
  891. test_h_gr32 word_dest er0
  892. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  893. test_gr_a5a5 2
  894. test_gr_a5a5 3
  895. test_gr_a5a5 4
  896. test_gr_a5a5 5
  897. test_gr_a5a5 6
  898. test_gr_a5a5 7
  899. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  900. cmp.w #0xe969, @word_dest
  901. beq .Lwind2
  902. fail
  903. .Lwind2:
  904. mov.w #0xa5a5, @word_dest
  905. shar_w_postinc_2:
  906. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  907. set_ccr_zero
  908. mov #word_dest, er0
  909. shar.w #2, @er0+ ; shift right arithmetic by two, postinc
  910. ;;; .word 0x0154
  911. ;;; .word 0x6d08
  912. ;;; .word 0x11d0
  913. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  914. test_zero_clear
  915. test_ovf_clear
  916. test_neg_set
  917. test_h_gr32 word_dest+2 er0
  918. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  919. test_gr_a5a5 2
  920. test_gr_a5a5 3
  921. test_gr_a5a5 4
  922. test_gr_a5a5 5
  923. test_gr_a5a5 6
  924. test_gr_a5a5 7
  925. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  926. cmp.w #0xe969, @word_dest
  927. beq .Lwpostinc2
  928. fail
  929. .Lwpostinc2:
  930. mov.w #0xa5a5, @word_dest
  931. shar_w_postdec_2:
  932. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  933. set_ccr_zero
  934. mov #word_dest, er0
  935. shar.w #2, @er0- ; shift right arithmetic by two, postdec
  936. ;;; .word 0x0156
  937. ;;; .word 0x6d08
  938. ;;; .word 0x11d0
  939. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  940. test_zero_clear
  941. test_ovf_clear
  942. test_neg_set
  943. test_h_gr32 word_dest-2 er0
  944. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  945. test_gr_a5a5 2
  946. test_gr_a5a5 3
  947. test_gr_a5a5 4
  948. test_gr_a5a5 5
  949. test_gr_a5a5 6
  950. test_gr_a5a5 7
  951. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  952. cmp.w #0xe969, @word_dest
  953. beq .Lwpostdec2
  954. fail
  955. .Lwpostdec2:
  956. mov.w #0xa5a5, @word_dest
  957. shar_w_preinc_2:
  958. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  959. set_ccr_zero
  960. mov #word_dest-2, er0
  961. shar.w #2, @+er0 ; shift right arithmetic by two, preinc
  962. ;;; .word 0x0155
  963. ;;; .word 0x6d08
  964. ;;; .word 0x11d0
  965. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  966. test_zero_clear
  967. test_ovf_clear
  968. test_neg_set
  969. test_h_gr32 word_dest er0
  970. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  971. test_gr_a5a5 2
  972. test_gr_a5a5 3
  973. test_gr_a5a5 4
  974. test_gr_a5a5 5
  975. test_gr_a5a5 6
  976. test_gr_a5a5 7
  977. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  978. cmp.w #0xe969, @word_dest
  979. beq .Lwpreinc2
  980. fail
  981. .Lwpreinc2:
  982. mov.w #0xa5a5, @word_dest
  983. shar_w_predec_2:
  984. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  985. set_ccr_zero
  986. mov #word_dest+2, er0
  987. shar.w #2, @-er0 ; shift right arithmetic by two, predec
  988. ;;; .word 0x0157
  989. ;;; .word 0x6d08
  990. ;;; .word 0x11d0
  991. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  992. test_zero_clear
  993. test_ovf_clear
  994. test_neg_set
  995. test_h_gr32 word_dest er0
  996. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  997. test_gr_a5a5 2
  998. test_gr_a5a5 3
  999. test_gr_a5a5 4
  1000. test_gr_a5a5 5
  1001. test_gr_a5a5 6
  1002. test_gr_a5a5 7
  1003. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  1004. cmp.w #0xe969, @word_dest
  1005. beq .Lwpredec2
  1006. fail
  1007. .Lwpredec2:
  1008. mov.w #0xa5a5, @word_dest
  1009. shar_w_disp2_2:
  1010. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1011. set_ccr_zero
  1012. mov #word_dest-4, er0
  1013. shar.w #2, @(4:2, er0) ; shift right arithmetic by two, disp2
  1014. ;;; .word 0x0156
  1015. ;;; .word 0x6908
  1016. ;;; .word 0x11d0
  1017. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1018. test_zero_clear
  1019. test_ovf_clear
  1020. test_neg_set
  1021. test_h_gr32 word_dest-4 er0
  1022. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1023. test_gr_a5a5 2
  1024. test_gr_a5a5 3
  1025. test_gr_a5a5 4
  1026. test_gr_a5a5 5
  1027. test_gr_a5a5 6
  1028. test_gr_a5a5 7
  1029. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  1030. cmp.w #0xe969, @word_dest
  1031. beq .Lwdisp22
  1032. fail
  1033. .Lwdisp22:
  1034. mov.w #0xa5a5, @word_dest
  1035. shar_w_disp16_2:
  1036. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1037. set_ccr_zero
  1038. mov #word_dest-44, er0
  1039. shar.w #2, @(44:16, er0) ; shift right arithmetic by two, disp16
  1040. ;;; .word 0x0154
  1041. ;;; .word 0x6f08
  1042. ;;; .word 44
  1043. ;;; .word 0x11d0
  1044. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1045. test_zero_clear
  1046. test_ovf_clear
  1047. test_neg_set
  1048. test_h_gr32 word_dest-44 er0
  1049. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1050. test_gr_a5a5 2
  1051. test_gr_a5a5 3
  1052. test_gr_a5a5 4
  1053. test_gr_a5a5 5
  1054. test_gr_a5a5 6
  1055. test_gr_a5a5 7
  1056. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  1057. cmp.w #0xe969, @word_dest
  1058. beq .Lwdisp162
  1059. fail
  1060. .Lwdisp162:
  1061. mov.w #0xa5a5, @word_dest
  1062. shar_w_disp32_2:
  1063. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1064. set_ccr_zero
  1065. mov #word_dest-666, er0
  1066. shar.w #2, @(666:32, er0) ; shift right arithmetic by two, disp32
  1067. ;;; .word 0x7884
  1068. ;;; .word 0x6b28
  1069. ;;; .long 666
  1070. ;;; .word 0x11d0
  1071. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1072. test_zero_clear
  1073. test_ovf_clear
  1074. test_neg_set
  1075. test_h_gr32 word_dest-666 er0
  1076. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1077. test_gr_a5a5 2
  1078. test_gr_a5a5 3
  1079. test_gr_a5a5 4
  1080. test_gr_a5a5 5
  1081. test_gr_a5a5 6
  1082. test_gr_a5a5 7
  1083. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  1084. cmp.w #0xe969, @word_dest
  1085. beq .Lwdisp322
  1086. fail
  1087. .Lwdisp322:
  1088. mov.w #0xa5a5, @word_dest
  1089. shar_w_abs16_2:
  1090. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1091. set_ccr_zero
  1092. shar.w #2, @word_dest:16 ; shift right arithmetic by two, abs16
  1093. ;;; .word 0x6b18
  1094. ;;; .word word_dest
  1095. ;;; .word 0x11d0
  1096. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1097. test_zero_clear
  1098. test_ovf_clear
  1099. test_neg_set
  1100. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1101. test_gr_a5a5 2
  1102. test_gr_a5a5 2
  1103. test_gr_a5a5 3
  1104. test_gr_a5a5 4
  1105. test_gr_a5a5 5
  1106. test_gr_a5a5 6
  1107. test_gr_a5a5 7
  1108. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  1109. cmp.w #0xe969, @word_dest
  1110. beq .Lwabs162
  1111. fail
  1112. .Lwabs162:
  1113. mov.w #0xa5a5, @word_dest
  1114. shar_w_abs32_2:
  1115. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1116. set_ccr_zero
  1117. shar.w #2, @word_dest:32 ; shift right arithmetic by two, abs32
  1118. ;;; .word 0x6b38
  1119. ;;; .long word_dest
  1120. ;;; .word 0x11d0
  1121. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1122. test_zero_clear
  1123. test_ovf_clear
  1124. test_neg_set
  1125. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1126. test_gr_a5a5 2
  1127. test_gr_a5a5 2
  1128. test_gr_a5a5 3
  1129. test_gr_a5a5 4
  1130. test_gr_a5a5 5
  1131. test_gr_a5a5 6
  1132. test_gr_a5a5 7
  1133. ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
  1134. cmp.w #0xe969, @word_dest
  1135. beq .Lwabs322
  1136. fail
  1137. .Lwabs322:
  1138. mov.w #0xa5a5, @word_dest
  1139. .endif
  1140. shar_l_reg32_1:
  1141. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1142. set_ccr_zero
  1143. shar.l er0 ; shift right arithmetic by one, register
  1144. ;;; .word 0x11b0
  1145. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1146. test_zero_clear
  1147. test_ovf_clear
  1148. test_neg_set
  1149. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1150. ; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1151. test_h_gr32 0xd2d2d2d2 er0
  1152. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1153. test_gr_a5a5 2
  1154. test_gr_a5a5 3
  1155. test_gr_a5a5 4
  1156. test_gr_a5a5 5
  1157. test_gr_a5a5 6
  1158. test_gr_a5a5 7
  1159. .if (sim_cpu == h8sx)
  1160. shar_l_ind_1:
  1161. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1162. set_ccr_zero
  1163. mov #long_dest, er0
  1164. shar.l @er0 ; shift right arithmetic by one, indirect
  1165. ;;; .word 0x0104
  1166. ;;; .word 0x6908
  1167. ;;; .word 0x11b0
  1168. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1169. test_zero_clear
  1170. test_ovf_clear
  1171. test_neg_set
  1172. test_h_gr32 long_dest er0
  1173. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1174. test_gr_a5a5 2
  1175. test_gr_a5a5 3
  1176. test_gr_a5a5 4
  1177. test_gr_a5a5 5
  1178. test_gr_a5a5 6
  1179. test_gr_a5a5 7
  1180. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1181. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1182. cmp.l #0xd2d2d2d2, @long_dest
  1183. beq .Llind1
  1184. fail
  1185. .Llind1:
  1186. mov #0xa5a5a5a5, @long_dest
  1187. shar_l_postinc_1:
  1188. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1189. set_ccr_zero
  1190. mov #long_dest, er0
  1191. shar.l @er0+ ; shift right arithmetic by one, postinc
  1192. ;;; .word 0x0104
  1193. ;;; .word 0x6d08
  1194. ;;; .word 0x11b0
  1195. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1196. test_zero_clear
  1197. test_ovf_clear
  1198. test_neg_set
  1199. test_h_gr32 long_dest+4 er0
  1200. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1201. test_gr_a5a5 2
  1202. test_gr_a5a5 3
  1203. test_gr_a5a5 4
  1204. test_gr_a5a5 5
  1205. test_gr_a5a5 6
  1206. test_gr_a5a5 7
  1207. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1208. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1209. cmp.l #0xd2d2d2d2, @long_dest
  1210. beq .Llpostinc1
  1211. fail
  1212. .Llpostinc1:
  1213. mov #0xa5a5a5a5, @long_dest
  1214. shar_l_postdec_1:
  1215. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1216. set_ccr_zero
  1217. mov #long_dest, er0
  1218. shar.l @er0- ; shift right arithmetic by one, postdec
  1219. ;;; .word 0x0106
  1220. ;;; .word 0x6d08
  1221. ;;; .word 0x11b0
  1222. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1223. test_zero_clear
  1224. test_ovf_clear
  1225. test_neg_set
  1226. test_h_gr32 long_dest-4 er0
  1227. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1228. test_gr_a5a5 2
  1229. test_gr_a5a5 3
  1230. test_gr_a5a5 4
  1231. test_gr_a5a5 5
  1232. test_gr_a5a5 6
  1233. test_gr_a5a5 7
  1234. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1235. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1236. cmp.l #0xd2d2d2d2, @long_dest
  1237. beq .Llpostdec1
  1238. fail
  1239. .Llpostdec1:
  1240. mov #0xa5a5a5a5, @long_dest
  1241. shar_l_preinc_1:
  1242. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1243. set_ccr_zero
  1244. mov #long_dest-4, er0
  1245. shar.l @+er0 ; shift right arithmetic by one, preinc
  1246. ;;; .word 0x0105
  1247. ;;; .word 0x6d08
  1248. ;;; .word 0x11b0
  1249. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1250. test_zero_clear
  1251. test_ovf_clear
  1252. test_neg_set
  1253. test_h_gr32 long_dest er0
  1254. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1255. test_gr_a5a5 2
  1256. test_gr_a5a5 3
  1257. test_gr_a5a5 4
  1258. test_gr_a5a5 5
  1259. test_gr_a5a5 6
  1260. test_gr_a5a5 7
  1261. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1262. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1263. cmp.l #0xd2d2d2d2, @long_dest
  1264. beq .Llpreinc1
  1265. fail
  1266. .Llpreinc1:
  1267. mov #0xa5a5a5a5, @long_dest
  1268. shar_l_predec_1:
  1269. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1270. set_ccr_zero
  1271. mov #long_dest+4, er0
  1272. shar.l @-er0 ; shift right arithmetic by one, predec
  1273. ;;; .word 0x0107
  1274. ;;; .word 0x6d08
  1275. ;;; .word 0x11b0
  1276. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1277. test_zero_clear
  1278. test_ovf_clear
  1279. test_neg_set
  1280. test_h_gr32 long_dest 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. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1289. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1290. cmp.l #0xd2d2d2d2, @long_dest
  1291. beq .Llpredec1
  1292. fail
  1293. .Llpredec1:
  1294. mov #0xa5a5a5a5, @long_dest
  1295. shar_l_disp2_1:
  1296. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1297. set_ccr_zero
  1298. mov #long_dest-8, er0
  1299. shar.l @(8:2, er0) ; shift right arithmetic by one, disp2
  1300. ;;; .word 0x0106
  1301. ;;; .word 0x6908
  1302. ;;; .word 0x11b0
  1303. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1304. test_zero_clear
  1305. test_ovf_clear
  1306. test_neg_set
  1307. test_h_gr32 long_dest-8 er0
  1308. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1309. test_gr_a5a5 2
  1310. test_gr_a5a5 3
  1311. test_gr_a5a5 4
  1312. test_gr_a5a5 5
  1313. test_gr_a5a5 6
  1314. test_gr_a5a5 7
  1315. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1316. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1317. cmp.l #0xd2d2d2d2, @long_dest
  1318. beq .Lldisp21
  1319. fail
  1320. .Lldisp21:
  1321. mov #0xa5a5a5a5, @long_dest
  1322. shar_l_disp16_1:
  1323. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1324. set_ccr_zero
  1325. mov #long_dest-44, er0
  1326. shar.l @(44:16, er0) ; shift right arithmetic by one, disp16
  1327. ;;; .word 0x0104
  1328. ;;; .word 0x6f08
  1329. ;;; .word 44
  1330. ;;; .word 0x11b0
  1331. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1332. test_zero_clear
  1333. test_ovf_clear
  1334. test_neg_set
  1335. test_h_gr32 long_dest-44 er0
  1336. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1337. test_gr_a5a5 2
  1338. test_gr_a5a5 3
  1339. test_gr_a5a5 4
  1340. test_gr_a5a5 5
  1341. test_gr_a5a5 6
  1342. test_gr_a5a5 7
  1343. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1344. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1345. cmp.l #0xd2d2d2d2, @long_dest
  1346. beq .Lldisp161
  1347. fail
  1348. .Lldisp161:
  1349. mov #0xa5a5a5a5, @long_dest
  1350. shar_l_disp32_1:
  1351. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1352. set_ccr_zero
  1353. mov #long_dest-666, er0
  1354. shar.l @(666:32, er0) ; shift right arithmetic by one, disp32
  1355. ;;; .word 0x7884
  1356. ;;; .word 0x6b28
  1357. ;;; .long 666
  1358. ;;; .word 0x11b0
  1359. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1360. test_zero_clear
  1361. test_ovf_clear
  1362. test_neg_set
  1363. test_h_gr32 long_dest-666 er0
  1364. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1365. test_gr_a5a5 2
  1366. test_gr_a5a5 3
  1367. test_gr_a5a5 4
  1368. test_gr_a5a5 5
  1369. test_gr_a5a5 6
  1370. test_gr_a5a5 7
  1371. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1372. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1373. cmp.l #0xd2d2d2d2, @long_dest
  1374. beq .Lldisp321
  1375. fail
  1376. .Lldisp321:
  1377. mov #0xa5a5a5a5, @long_dest
  1378. shar_l_abs16_1:
  1379. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1380. set_ccr_zero
  1381. shar.l @long_dest:16 ; shift right arithmetic by one, abs16
  1382. ;;; .word 0x0104
  1383. ;;; .word 0x6b08
  1384. ;;; .word long_dest
  1385. ;;; .word 0x11b0
  1386. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1387. test_zero_clear
  1388. test_ovf_clear
  1389. test_neg_set
  1390. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1391. test_gr_a5a5 1
  1392. test_gr_a5a5 2
  1393. test_gr_a5a5 3
  1394. test_gr_a5a5 4
  1395. test_gr_a5a5 5
  1396. test_gr_a5a5 6
  1397. test_gr_a5a5 7
  1398. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1399. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1400. cmp.l #0xd2d2d2d2, @long_dest
  1401. beq .Llabs161
  1402. fail
  1403. .Llabs161:
  1404. mov #0xa5a5a5a5, @long_dest
  1405. shar_l_abs32_1:
  1406. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1407. set_ccr_zero
  1408. shar.l @long_dest:32 ; shift right arithmetic by one, abs32
  1409. ;;; .word 0x0104
  1410. ;;; .word 0x6b28
  1411. ;;; .long long_dest
  1412. ;;; .word 0x11b0
  1413. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  1414. test_zero_clear
  1415. test_ovf_clear
  1416. test_neg_set
  1417. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1418. test_gr_a5a5 1
  1419. test_gr_a5a5 2
  1420. test_gr_a5a5 3
  1421. test_gr_a5a5 4
  1422. test_gr_a5a5 5
  1423. test_gr_a5a5 6
  1424. test_gr_a5a5 7
  1425. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1426. ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
  1427. cmp.l #0xd2d2d2d2, @long_dest
  1428. beq .Llabs321
  1429. fail
  1430. .Llabs321:
  1431. mov #0xa5a5a5a5, @long_dest
  1432. .endif
  1433. shar_l_reg32_2:
  1434. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1435. set_ccr_zero
  1436. shar.l #2, er0 ; shift right arithmetic by two, register
  1437. ;;; .word 0x11f0
  1438. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1439. test_zero_clear
  1440. test_ovf_clear
  1441. test_neg_set
  1442. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1443. ; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1444. test_h_gr32 0xe9696969 er0
  1445. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1446. test_gr_a5a5 2
  1447. test_gr_a5a5 3
  1448. test_gr_a5a5 4
  1449. test_gr_a5a5 5
  1450. test_gr_a5a5 6
  1451. test_gr_a5a5 7
  1452. .if (sim_cpu == h8sx)
  1453. shar_l_ind_2:
  1454. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1455. set_ccr_zero
  1456. mov #long_dest, er0
  1457. shar.l #2, @er0 ; shift right arithmetic by two, indirect
  1458. ;;; .word 0x0104
  1459. ;;; .word 0x6908
  1460. ;;; .word 0x11f0
  1461. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1462. test_zero_clear
  1463. test_ovf_clear
  1464. test_neg_set
  1465. test_h_gr32 long_dest er0
  1466. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1467. test_gr_a5a5 2
  1468. test_gr_a5a5 3
  1469. test_gr_a5a5 4
  1470. test_gr_a5a5 5
  1471. test_gr_a5a5 6
  1472. test_gr_a5a5 7
  1473. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1474. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1475. cmp.l #0xe9696969, @long_dest
  1476. beq .Llind2
  1477. fail
  1478. .Llind2:
  1479. mov #0xa5a5a5a5, @long_dest
  1480. shar_l_postinc_2:
  1481. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1482. set_ccr_zero
  1483. mov #long_dest, er0
  1484. shar.l #2, @er0+ ; shift right arithmetic by two, postinc
  1485. ;;; .word 0x0104
  1486. ;;; .word 0x6d08
  1487. ;;; .word 0x11f0
  1488. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1489. test_zero_clear
  1490. test_ovf_clear
  1491. test_neg_set
  1492. test_h_gr32 long_dest+4 er0
  1493. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1494. test_gr_a5a5 2
  1495. test_gr_a5a5 3
  1496. test_gr_a5a5 4
  1497. test_gr_a5a5 5
  1498. test_gr_a5a5 6
  1499. test_gr_a5a5 7
  1500. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1501. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1502. cmp.l #0xe9696969, @long_dest
  1503. beq .Llpostinc2
  1504. fail
  1505. .Llpostinc2:
  1506. mov #0xa5a5a5a5, @long_dest
  1507. shar_l_postdec_2:
  1508. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1509. set_ccr_zero
  1510. mov #long_dest, er0
  1511. shar.l #2, @er0- ; shift right arithmetic by two, postdec
  1512. ;;; .word 0x0106
  1513. ;;; .word 0x6d08
  1514. ;;; .word 0x11f0
  1515. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1516. test_zero_clear
  1517. test_ovf_clear
  1518. test_neg_set
  1519. test_h_gr32 long_dest-4 er0
  1520. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1521. test_gr_a5a5 2
  1522. test_gr_a5a5 3
  1523. test_gr_a5a5 4
  1524. test_gr_a5a5 5
  1525. test_gr_a5a5 6
  1526. test_gr_a5a5 7
  1527. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1528. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1529. cmp.l #0xe9696969, @long_dest
  1530. beq .Llpostdec2
  1531. fail
  1532. .Llpostdec2:
  1533. mov #0xa5a5a5a5, @long_dest
  1534. shar_l_preinc_2:
  1535. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1536. set_ccr_zero
  1537. mov #long_dest-4, er0
  1538. shar.l #2, @+er0 ; shift right arithmetic by two, preinc
  1539. ;;; .word 0x0105
  1540. ;;; .word 0x6d08
  1541. ;;; .word 0x11f0
  1542. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1543. test_zero_clear
  1544. test_ovf_clear
  1545. test_neg_set
  1546. test_h_gr32 long_dest er0
  1547. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1548. test_gr_a5a5 2
  1549. test_gr_a5a5 3
  1550. test_gr_a5a5 4
  1551. test_gr_a5a5 5
  1552. test_gr_a5a5 6
  1553. test_gr_a5a5 7
  1554. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1555. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1556. cmp.l #0xe9696969, @long_dest
  1557. beq .Llpreinc2
  1558. fail
  1559. .Llpreinc2:
  1560. mov #0xa5a5a5a5, @long_dest
  1561. shar_l_predec_2:
  1562. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1563. set_ccr_zero
  1564. mov #long_dest+4, er0
  1565. shar.l #2, @-er0 ; shift right arithmetic by two, predec
  1566. ;;; .word 0x0107
  1567. ;;; .word 0x6d08
  1568. ;;; .word 0x11f0
  1569. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1570. test_zero_clear
  1571. test_ovf_clear
  1572. test_neg_set
  1573. test_h_gr32 long_dest er0
  1574. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1575. test_gr_a5a5 2
  1576. test_gr_a5a5 3
  1577. test_gr_a5a5 4
  1578. test_gr_a5a5 5
  1579. test_gr_a5a5 6
  1580. test_gr_a5a5 7
  1581. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1582. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1583. cmp.l #0xe9696969, @long_dest
  1584. beq .Llpredec2
  1585. fail
  1586. .Llpredec2:
  1587. mov #0xa5a5a5a5, @long_dest
  1588. shar_l_disp2_2:
  1589. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1590. set_ccr_zero
  1591. mov #long_dest-8, er0
  1592. shar.l #2, @(8:2, er0) ; shift right arithmetic by two, disp2
  1593. ;;; .word 0x0106
  1594. ;;; .word 0x6908
  1595. ;;; .word 0x11f0
  1596. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1597. test_zero_clear
  1598. test_ovf_clear
  1599. test_neg_set
  1600. test_h_gr32 long_dest-8 er0
  1601. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1602. test_gr_a5a5 2
  1603. test_gr_a5a5 3
  1604. test_gr_a5a5 4
  1605. test_gr_a5a5 5
  1606. test_gr_a5a5 6
  1607. test_gr_a5a5 7
  1608. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1609. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1610. cmp.l #0xe9696969, @long_dest
  1611. beq .Lldisp22
  1612. fail
  1613. .Lldisp22:
  1614. mov #0xa5a5a5a5, @long_dest
  1615. shar_l_disp16_2:
  1616. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1617. set_ccr_zero
  1618. mov #long_dest-44, er0
  1619. shar.l #2, @(44:16, er0) ; shift right arithmetic by two, disp16
  1620. ;;; .word 0x0104
  1621. ;;; .word 0x6f08
  1622. ;;; .word 44
  1623. ;;; .word 0x11f0
  1624. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1625. test_zero_clear
  1626. test_ovf_clear
  1627. test_neg_set
  1628. test_h_gr32 long_dest-44 er0
  1629. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1630. test_gr_a5a5 2
  1631. test_gr_a5a5 3
  1632. test_gr_a5a5 4
  1633. test_gr_a5a5 5
  1634. test_gr_a5a5 6
  1635. test_gr_a5a5 7
  1636. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1637. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1638. cmp.l #0xe9696969, @long_dest
  1639. beq .Lldisp162
  1640. fail
  1641. .Lldisp162:
  1642. mov #0xa5a5a5a5, @long_dest
  1643. shar_l_disp32_2:
  1644. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1645. set_ccr_zero
  1646. mov #long_dest-666, er0
  1647. shar.l #2, @(666:32, er0) ; shift right arithmetic by two, disp32
  1648. ;;; .word 0x7884
  1649. ;;; .word 0x6b28
  1650. ;;; .long 666
  1651. ;;; .word 0x11f0
  1652. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1653. test_zero_clear
  1654. test_ovf_clear
  1655. test_neg_set
  1656. test_h_gr32 long_dest-666 er0
  1657. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  1658. test_gr_a5a5 2
  1659. test_gr_a5a5 3
  1660. test_gr_a5a5 4
  1661. test_gr_a5a5 5
  1662. test_gr_a5a5 6
  1663. test_gr_a5a5 7
  1664. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1665. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1666. cmp.l #0xe9696969, @long_dest
  1667. beq .Lldisp322
  1668. fail
  1669. .Lldisp322:
  1670. mov #0xa5a5a5a5, @long_dest
  1671. shar_l_abs16_2:
  1672. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1673. set_ccr_zero
  1674. shar.l #2, @long_dest:16 ; shift right arithmetic by two, abs16
  1675. ;;; .word 0x0104
  1676. ;;; .word 0x6b08
  1677. ;;; .word long_dest
  1678. ;;; .word 0x11f0
  1679. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1680. test_zero_clear
  1681. test_ovf_clear
  1682. test_neg_set
  1683. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1684. test_gr_a5a5 1
  1685. test_gr_a5a5 2
  1686. test_gr_a5a5 3
  1687. test_gr_a5a5 4
  1688. test_gr_a5a5 5
  1689. test_gr_a5a5 6
  1690. test_gr_a5a5 7
  1691. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1692. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1693. cmp.l #0xe9696969, @long_dest
  1694. beq .Llabs162
  1695. fail
  1696. .Llabs162:
  1697. mov #0xa5a5a5a5, @long_dest
  1698. shar_l_abs32_2:
  1699. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  1700. set_ccr_zero
  1701. shar.l #2, @long_dest:32 ; shift right arithmetic by two, abs32
  1702. ;;; .word 0x0104
  1703. ;;; .word 0x6b28
  1704. ;;; .long long_dest
  1705. ;;; .word 0x11f0
  1706. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  1707. test_zero_clear
  1708. test_ovf_clear
  1709. test_neg_set
  1710. test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
  1711. test_gr_a5a5 1
  1712. test_gr_a5a5 2
  1713. test_gr_a5a5 3
  1714. test_gr_a5a5 4
  1715. test_gr_a5a5 5
  1716. test_gr_a5a5 6
  1717. test_gr_a5a5 7
  1718. ; 1010 0101 1010 0101 1010 0101 1010 0101
  1719. ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
  1720. cmp.l #0xe9696969, @long_dest
  1721. beq .Llabs322
  1722. fail
  1723. .Llabs322:
  1724. mov #0xa5a5a5a5, @long_dest
  1725. .endif
  1726. .endif
  1727. pass
  1728. exit 0