tb.ms 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #mach: crisv32
  2. #output: Basic clock cycles, total @: 54\n
  3. #output: Memory source stall cycles: 0\n
  4. #output: Memory read-after-write stall cycles: 0\n
  5. #output: Movem source stall cycles: 0\n
  6. #output: Movem destination stall cycles: 0\n
  7. #output: Movem address stall cycles: 0\n
  8. #output: Multiplication source stall cycles: 0\n
  9. #output: Jump source stall cycles: 0\n
  10. #output: Branch misprediction stall cycles: 18\n
  11. #output: Jump target stall cycles: 0\n
  12. #sim: --cris-cycles=basic
  13. ; Check branch penalties. It is assumed that the taken-counters
  14. ; in the bimodal branch-predictors start at 0, meaning two taken
  15. ; branches are required for a branch to be predicted as taken
  16. ; for each counter, from reset. None of these branches go
  17. ; to the end of a cache-line and none map to the same counter.
  18. .include "testutils.inc"
  19. startnostack
  20. ba 0f ; No penalty: always-taken condition not "predicted".
  21. nop
  22. nop
  23. 0:
  24. setf c
  25. bcs 0f ; Penalty 2 cycles.
  26. nop
  27. nop
  28. 0:
  29. clearf c
  30. bcc 0f ; Penalty 2 cycles, though branch is a nop.
  31. moveq 4,r0 ; Execute 5 times:
  32. 0:
  33. move.d r0,r0
  34. bne 0b ; Mispredicted 3 out of 5 times: penalty 3*2 cycles.
  35. subq 1,r0
  36. 0:
  37. beq 0f ; Not taken; no penalty.
  38. nop
  39. nop
  40. 0:
  41. ; (Almost) same insns, but with 16-bit bCC insns.
  42. ba 0f ; No penalty: always-taken condition not "predicted".
  43. nop
  44. .space 520
  45. 0:
  46. setf c
  47. bcs 0f ; Penalty 2 cycles.
  48. nop
  49. .space 520
  50. 0:
  51. moveq 4,r0 ; Execute 5 times:
  52. 0:
  53. ba 1f
  54. move.d r0,r0 ; Mispredicted 3 out of 5 times:
  55. .space 520
  56. 1:
  57. bne 0b ; Penalty 3*2 cycles.
  58. subq 1,r0
  59. beq 0f ; Not taken; no penalty.
  60. nop
  61. 0:
  62. break 15