hwloop-branch-in.s 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Blackfin testcase for branching into the middle of a hardware loop
  2. # mach: bfin
  3. .include "testutils.inc"
  4. .macro test_prep lc:req
  5. loadsym P5, 1f;
  6. dmm32 LC0, \lc
  7. R5 = 0;
  8. R6 = 0;
  9. R7 = 0;
  10. .endm
  11. .macro test_check exp5:req, exp6:req, exp7:req, expLC:req
  12. 1:
  13. imm32 R4, \exp5;
  14. CC = R4 == R5;
  15. IF !CC JUMP 2f;
  16. imm32 R4, \exp6;
  17. CC = R4 == R6;
  18. IF !CC JUMP 2f;
  19. imm32 R4, \exp7;
  20. CC = R4 == R7;
  21. IF !CC JUMP 2f;
  22. R3 = LC0;
  23. imm32 R4, \expLC;
  24. CC = R4 == R3;
  25. IF !CC JUMP 2f;
  26. JUMP 3f;
  27. 2: fail
  28. 3:
  29. .endm
  30. .macro test_rts entry:req, lc:req, exp5:req, exp6:req, exp7:req, expLC:req
  31. loadsym R1, \entry;
  32. RETS = R1;
  33. test_prep \lc
  34. RTS;
  35. test_check \exp5, \exp6, \exp7, \expLC
  36. .endm
  37. .macro test_jump entry:req, lc:req, exp5:req, exp6:req, exp7:req, expLC:req
  38. loadsym P1, \entry;
  39. test_prep \lc
  40. JUMP (P1);
  41. test_check \exp5, \exp6, \exp7, \expLC
  42. .endm
  43. start
  44. loadsym R1, hws;
  45. LT0 = R1;
  46. loadsym R1, hwe;
  47. LB0 = R1;
  48. test_rts hws, 0, 1, 1, 1, 0
  49. test_rts hws, 1, 1, 1, 1, 0
  50. test_rts hws, 2, 2, 2, 2, 0
  51. test_rts hws, 20, 20, 20, 20, 0
  52. test_rts hwm, 0, 0, 1, 1, 0
  53. test_rts hwm, 1, 0, 1, 1, 0
  54. test_rts hwm, 2, 1, 2, 2, 0
  55. test_rts hwm, 20, 19, 20, 20, 0
  56. test_rts hwe, 0, 0, 0, 1, 0
  57. test_rts hwe, 1, 0, 0, 1, 0
  58. test_rts hwe, 2, 1, 1, 2, 0
  59. test_rts hwe, 20, 19, 19, 20, 0
  60. test_rts hwp, 0, 0, 0, 0, 0
  61. test_rts hwp, 1, 0, 0, 0, 1
  62. test_rts hwp, 2, 0, 0, 0, 2
  63. test_jump hws, 0, 1, 1, 1, 0
  64. test_jump hws, 1, 1, 1, 1, 0
  65. test_jump hws, 2, 2, 2, 2, 0
  66. test_jump hws, 20, 20, 20, 20, 0
  67. test_jump hwm, 0, 0, 1, 1, 0
  68. test_jump hwm, 1, 0, 1, 1, 0
  69. test_jump hwm, 2, 1, 2, 2, 0
  70. test_jump hwm, 20, 19, 20, 20, 0
  71. test_jump hwe, 0, 0, 0, 1, 0
  72. test_jump hwe, 1, 0, 0, 1, 0
  73. test_jump hwe, 2, 1, 1, 2, 0
  74. test_jump hwe, 20, 19, 19, 20, 0
  75. test_jump hwp, 0, 0, 0, 0, 0
  76. test_jump hwp, 1, 0, 0, 0, 1
  77. test_jump hwp, 2, 0, 0, 0, 2
  78. pass
  79. hws: R5 += 1;
  80. hwm: R6 += 1;
  81. hwe: R7 += 1;
  82. hwp: JUMP (P5);