shll.s 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. # Hitachi H8 testcase 'shll'
  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. shll_b_reg8_1:
  20. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  21. set_ccr_zero
  22. shll.b r0l ; shift left logical by one
  23. ;;; .word 0x1008
  24. test_carry_set ; H=0 N=0 Z=0 V=0 C=1
  25. test_zero_clear
  26. test_ovf_clear
  27. test_neg_clear
  28. test_h_gr16 0xa54a r0 ; 1010 0101 -> 0100 1010
  29. .if (sim_cpu)
  30. test_h_gr32 0xa5a5a54a 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. shll_b_reg8_2:
  40. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  41. set_ccr_zero
  42. shll.b #2, r0l ; shift left logical by two
  43. ;;; .word 0x1048
  44. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  45. test_zero_clear
  46. test_ovf_clear
  47. test_neg_set
  48. test_h_gr16 0xa594 r0 ; 1010 0101 -> 1001 0100
  49. .if (sim_cpu)
  50. test_h_gr32 0xa5a5a594 er0
  51. .endif
  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. .if (sim_cpu == h8sx)
  60. shll_b_reg8_4:
  61. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  62. set_ccr_zero
  63. shll.b #4, r0l ; shift left logical by four
  64. ;;; .word 0x10a8
  65. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  66. test_zero_clear
  67. test_ovf_clear
  68. test_neg_clear
  69. test_h_gr16 0xa550 r0 ; 1010 0101 -> 0101 0000
  70. test_h_gr32 0xa5a5a550 er0
  71. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  72. test_gr_a5a5 2
  73. test_gr_a5a5 3
  74. test_gr_a5a5 4
  75. test_gr_a5a5 5
  76. test_gr_a5a5 6
  77. test_gr_a5a5 7
  78. shll_b_reg8_reg8:
  79. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  80. set_ccr_zero
  81. mov #5, r0h
  82. shll.b r0h, r0l ; shift left logical by register value
  83. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  84. test_zero_clear
  85. test_ovf_clear
  86. test_neg_set
  87. test_h_gr16 0x05a0 r0 ; 1010 0101 -> 1010 0000
  88. test_h_gr32 0xa5a505a0 er0
  89. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  90. test_gr_a5a5 2
  91. test_gr_a5a5 3
  92. test_gr_a5a5 4
  93. test_gr_a5a5 5
  94. test_gr_a5a5 6
  95. test_gr_a5a5 7
  96. .endif
  97. .if (sim_cpu) ; Not available in h8300 mode
  98. shll_w_reg16_1:
  99. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  100. set_ccr_zero
  101. shll.w r0 ; shift left logical by one
  102. ;;; .word 0x1010
  103. test_carry_set ; H=0 N=0 Z=0 V=0 C=1
  104. test_zero_clear
  105. test_ovf_clear
  106. test_neg_clear
  107. test_h_gr16 0x4b4a r0 ; 1010 0101 1010 0101 -> 0100 1011 0100 1010
  108. test_h_gr32 0xa5a54b4a er0
  109. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  110. test_gr_a5a5 2
  111. test_gr_a5a5 3
  112. test_gr_a5a5 4
  113. test_gr_a5a5 5
  114. test_gr_a5a5 6
  115. test_gr_a5a5 7
  116. shll_w_reg16_2:
  117. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  118. set_ccr_zero
  119. shll.w #2, r0 ; shift left logical by two
  120. ;;; .word 0x1050
  121. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  122. test_zero_clear
  123. test_ovf_clear
  124. test_neg_set
  125. test_h_gr16 0x9694 r0 ; 1010 0101 1010 0101 -> 1001 0110 1001 0100
  126. test_h_gr32 0xa5a59694 er0
  127. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  128. test_gr_a5a5 2
  129. test_gr_a5a5 3
  130. test_gr_a5a5 4
  131. test_gr_a5a5 5
  132. test_gr_a5a5 6
  133. test_gr_a5a5 7
  134. .if (sim_cpu == h8sx)
  135. shll_w_reg16_4:
  136. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  137. set_ccr_zero
  138. shll.w #4, r0 ; shift left logical by four
  139. ;;; .word 0x1020
  140. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  141. test_zero_clear
  142. test_ovf_clear
  143. test_neg_clear
  144. test_h_gr16 0x5a50 r0 ; 1010 0101 1010 0101 -> 0101 1010 0101 0000
  145. test_h_gr32 0xa5a55a50 er0
  146. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  147. test_gr_a5a5 2
  148. test_gr_a5a5 3
  149. test_gr_a5a5 4
  150. test_gr_a5a5 5
  151. test_gr_a5a5 6
  152. test_gr_a5a5 7
  153. shll_w_reg16_8:
  154. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  155. set_ccr_zero
  156. shll.w #8, r0 ; shift left logical by eight
  157. ;;; .word 0x1060
  158. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  159. test_zero_clear
  160. test_ovf_clear
  161. test_neg_set
  162. test_h_gr16 0xa500 r0 ; 1010 0101 1010 0101 -> 1010 0101 0000 0000
  163. test_h_gr32 0xa5a5a500 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. shll_w_reg16_reg8:
  172. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  173. set_ccr_zero
  174. mov #5, r0h
  175. shll.w r0h, r0 ; shift left logical by register value
  176. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  177. test_zero_clear
  178. test_ovf_clear
  179. test_neg_set
  180. test_h_gr16 0xb4a0 r0 ; 1010 0101 1010 0101 -> 1011 0100 1010 0000
  181. test_h_gr32 0xa5a5b4a0 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. .endif
  190. shll_l_reg32_1:
  191. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  192. set_ccr_zero
  193. shll.l er0 ; shift left logical by one
  194. ;;; .word 1030
  195. test_carry_set ; H=0 N=0 Z=0 V=0 C=1
  196. test_zero_clear
  197. test_ovf_clear
  198. test_neg_clear
  199. ; 1010 0101 1010 0101 1010 0101 1010 0101
  200. ; -> 0100 1011 0100 1011 0100 1011 0100 1010
  201. test_h_gr32 0x4b4b4b4a er0
  202. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  203. test_gr_a5a5 2
  204. test_gr_a5a5 3
  205. test_gr_a5a5 4
  206. test_gr_a5a5 5
  207. test_gr_a5a5 6
  208. test_gr_a5a5 7
  209. shll_l_reg32_2:
  210. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  211. set_ccr_zero
  212. shll.l #2, er0 ; shift left logical by two
  213. ;;; .word 0x1070
  214. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  215. test_zero_clear
  216. test_ovf_clear
  217. test_neg_set
  218. ; 1010 0101 1010 0101 1010 0101 1010 0101
  219. ; -> 1001 0110 1001 0110 1001 0110 1001 0100
  220. test_h_gr32 0x96969694 er0
  221. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  222. test_gr_a5a5 2
  223. test_gr_a5a5 3
  224. test_gr_a5a5 4
  225. test_gr_a5a5 5
  226. test_gr_a5a5 6
  227. test_gr_a5a5 7
  228. .if (sim_cpu == h8sx)
  229. shll_l_reg32_4:
  230. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  231. set_ccr_zero
  232. shll.l #4, er0 ; shift left logical by four
  233. ;;; .word 0x1038
  234. test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
  235. test_zero_clear
  236. test_ovf_clear
  237. test_neg_clear
  238. ; 1010 0101 1010 0101 1010 0101 1010 0101
  239. ; -> 0101 1010 0101 1010 0101 1010 0101 0000
  240. test_h_gr32 0x5a5a5a50 er0
  241. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  242. test_gr_a5a5 2
  243. test_gr_a5a5 3
  244. test_gr_a5a5 4
  245. test_gr_a5a5 5
  246. test_gr_a5a5 6
  247. test_gr_a5a5 7
  248. shll_l_reg32_8:
  249. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  250. set_ccr_zero
  251. shll.l #8, er0 ; shift left logical by eight
  252. ;;; .word 0x1078
  253. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  254. test_zero_clear
  255. test_ovf_clear
  256. test_neg_set
  257. test_h_gr16 0xa500 r0
  258. ; 1010 0101 1010 0101 1010 0101 1010 0101
  259. ; -> 1010 0101 1010 0101 1010 0101 0000 0000
  260. test_h_gr32 0xa5a5a500 er0
  261. test_gr_a5a5 1 ; Make sure other general regs not disturbed
  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. shll_l_reg32_16:
  269. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  270. set_ccr_zero
  271. shll.l #16, er0 ; shift left logical by sixteen
  272. ;;; .word 0x10f8
  273. test_carry_set ; H=0 N=1 Z=0 V=0 C=1
  274. test_zero_clear
  275. test_ovf_clear
  276. test_neg_set
  277. ; 1010 0101 1010 0101 1010 0101 1010 0101
  278. ;; -> 1010 0101 1010 0101 0000 0000 0000 0000
  279. test_h_gr32 0xa5a50000 er0
  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. shll_l_reg32_reg8:
  288. set_grs_a5a5 ; Fill all general regs with a fixed pattern
  289. set_ccr_zero
  290. mov #5, r1l
  291. shll.l r1l, er0 ; shift left logical by register value
  292. test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
  293. test_zero_clear
  294. test_ovf_clear
  295. test_neg_set
  296. ; 1010 0101 1010 0101 1010 0101 1010 0101
  297. ; -> 1011 0100 1011 0100 1011 0100 1010 0000
  298. test_h_gr32 0xb4b4b4a0 er0
  299. test_h_gr32 0xa5a5a505 er1
  300. test_gr_a5a5 2 ; Make sure other general regs not disturbed
  301. test_gr_a5a5 3
  302. test_gr_a5a5 4
  303. test_gr_a5a5 5
  304. test_gr_a5a5 6
  305. test_gr_a5a5 7
  306. .endif
  307. .endif
  308. pass
  309. exit 0