movsd.s 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Hitachi H8 testcase 'movsd'
  2. # mach(): all
  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. src: .byte 'h', 'e', 'l', 'l', 'o', 0
  13. dst1: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  14. dst2: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  15. start
  16. .if (sim_cpu == h8sx)
  17. movsd_n:#
  18. # In this test, the transfer will stop after n bytes.
  19. #
  20. set_grs_a5a5
  21. mov #src, er5
  22. mov #dst1, er6
  23. mov #4, r4
  24. set_ccr_zero
  25. ;; movsd.b disp:16
  26. movsd.b fail1:16
  27. ;;; .word 0x7b84
  28. ;;; .word 0x02
  29. bra pass1
  30. fail1: fail
  31. pass1: test_cc_clear
  32. test_gr_a5a5 0
  33. test_gr_a5a5 1
  34. test_gr_a5a5 2
  35. test_gr_a5a5 3
  36. test_h_gr32 0xa5a50000 er4
  37. test_h_gr32 src+4 er5
  38. test_h_gr32 dst1+4 er6
  39. test_gr_a5a5 7
  40. #
  41. # Now make sure exactly 4 bytes were transferred.
  42. cmp.b @src, @dst1
  43. bne fail1:16
  44. cmp.b @src+1, @dst1+1
  45. bne fail1:16
  46. cmp.b @src+2, @dst1+2
  47. bne fail1:16
  48. cmp.b @src+3, @dst1+3
  49. bne fail1:16
  50. cmp.b @src+4, @dst1+4
  51. beq fail1:16
  52. movsd_s:#
  53. # In this test, the entire null-terminated string is transferred.
  54. #
  55. set_grs_a5a5
  56. mov #src, er5
  57. mov #dst2, er6
  58. mov #8, r4
  59. set_ccr_zero
  60. ;; movsd.b disp:16
  61. movsd.b pass2:16
  62. ;;; .word 0x7b84
  63. ;;; .word 0x10
  64. fail2: fail
  65. pass2: test_cc_clear
  66. test_gr_a5a5 0
  67. test_gr_a5a5 1
  68. test_gr_a5a5 2
  69. test_gr_a5a5 3
  70. test_h_gr32 0xa5a50002 er4
  71. test_h_gr32 src+6 er5
  72. test_h_gr32 dst2+6 er6
  73. test_gr_a5a5 7
  74. #
  75. # Now make sure 5 bytes were transferred, and the 6th is zero.
  76. cmp.b @src, @dst2
  77. bne fail2:16
  78. cmp.b @src+1, @dst2+1
  79. bne fail2:16
  80. cmp.b @src+2, @dst2+2
  81. bne fail2:16
  82. cmp.b @src+3, @dst2+3
  83. bne fail2:16
  84. cmp.b @src+4, @dst2+4
  85. bne fail2:16
  86. cmp.b #0, @dst2+5
  87. bne fail2:16
  88. .endif
  89. pass
  90. exit 0