movmd.s 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # Hitachi H8 testcase 'movmd'
  2. # mach(): 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. .data
  12. byte_src:
  13. .byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
  14. byte_dst:
  15. .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  16. .align 2
  17. word_src:
  18. .word 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
  19. word_dst:
  20. .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  21. .align 4
  22. long_src:
  23. .long 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
  24. long_dst:
  25. .long 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  26. start
  27. .if (sim_cpu == h8sx)
  28. movmd_b:#
  29. # Byte block transfer
  30. #
  31. set_grs_a5a5
  32. mov #byte_src, er5
  33. mov #byte_dst, er6
  34. mov #10, r4
  35. set_ccr_zero
  36. ;; movmd.b
  37. movmd.b
  38. ;;; .word 0x7b94
  39. test_cc_clear
  40. test_gr_a5a5 0
  41. test_gr_a5a5 1
  42. test_gr_a5a5 2
  43. test_gr_a5a5 3
  44. test_h_gr32 0xa5a50000 er4
  45. test_h_gr32 byte_src+10 er5
  46. test_h_gr32 byte_dst+10 er6
  47. test_gr_a5a5 7
  48. #
  49. # Now make sure exactly 10 bytes were transferred.
  50. memcmp byte_src byte_dst 10
  51. cmp.b #0, @byte_dst+10
  52. beq .L0
  53. fail
  54. .L0:
  55. movmd_w:#
  56. # Word block transfer
  57. #
  58. set_grs_a5a5
  59. mov #word_src, er5
  60. mov #word_dst, er6
  61. mov #10, r4
  62. set_ccr_zero
  63. ;; movmd.w
  64. movmd.w
  65. ;;; .word 0x7ba4
  66. test_cc_clear
  67. test_gr_a5a5 0
  68. test_gr_a5a5 1
  69. test_gr_a5a5 2
  70. test_gr_a5a5 3
  71. test_h_gr32 0xa5a50000 er4
  72. test_h_gr32 word_src+20 er5
  73. test_h_gr32 word_dst+20 er6
  74. test_gr_a5a5 7
  75. #
  76. # Now make sure exactly 20 bytes were transferred.
  77. memcmp word_src word_dst 20
  78. cmp.w #0, @word_dst+20
  79. beq .L1
  80. fail
  81. .L1:
  82. movmd_l:#
  83. # Long block transfer
  84. #
  85. set_grs_a5a5
  86. mov #long_src, er5
  87. mov #long_dst, er6
  88. mov #10, r4
  89. set_ccr_zero
  90. ;; movmd.b
  91. movmd.l
  92. ;;; .word 0x7bb4
  93. test_cc_clear
  94. test_gr_a5a5 0
  95. test_gr_a5a5 1
  96. test_gr_a5a5 2
  97. test_gr_a5a5 3
  98. test_h_gr32 0xa5a50000 er4
  99. test_h_gr32 long_src+40 er5
  100. test_h_gr32 long_dst+40 er6
  101. test_gr_a5a5 7
  102. #
  103. # Now make sure exactly 40 bytes were transferred.
  104. memcmp long_src long_dst 40
  105. cmp.l #0, @long_dst+40
  106. beq .L2
  107. fail
  108. .L2:
  109. .endif
  110. pass
  111. exit 0