t-rep.s 622 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # mach: all
  2. # output:
  3. # sim: --environment operating
  4. .include "t-macros.i"
  5. start
  6. ;; Check that the instruction @REP_E is executed when it
  7. ;; is reached using a branch instruction
  8. ldi r2, 1
  9. test_rep_1:
  10. rep r2, end_rep_1
  11. nop || nop
  12. nop || nop
  13. nop || nop
  14. nop || nop
  15. ldi r3, 46
  16. bra end_rep_1
  17. ldi r3, 42
  18. end_rep_1:
  19. addi r3, 1
  20. check 1 r3 47
  21. ;; Check that the loop is executed the correct number of times
  22. ldi r2, 10
  23. ldi r3, 0
  24. ldi r4, 0
  25. test_rep_2:
  26. rep r2, end_rep_2
  27. nop || nop
  28. nop || nop
  29. nop || nop
  30. nop || nop
  31. nop || nop
  32. addi r3, 1
  33. end_rep_2:
  34. addi r4, 1
  35. check 2 r3 10
  36. check 3 r4 10
  37. exit0