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 14; Check branch penalties. It is assumed that the taken-counters 15; in the bimodal branch-predictors start at 0, meaning two taken 16; branches are required for a branch to be predicted as taken 17; for each counter, from reset. None of these branches go 18; to the end of a cache-line and none map to the same counter. 19 20 .include "testutils.inc" 21 startnostack 22 ba 0f ; No penalty: always-taken condition not "predicted". 23 nop 24 nop 250: 26 setf c 27 bcs 0f ; Penalty 2 cycles. 28 nop 29 30 nop 310: 32 clearf c 33 bcc 0f ; Penalty 2 cycles, though branch is a nop. 34 moveq 4,r0 ; Execute 5 times: 35 360: 37 move.d r0,r0 38 bne 0b ; Mispredicted 3 out of 5 times: penalty 3*2 cycles. 39 subq 1,r0 40 410: 42 beq 0f ; Not taken; no penalty. 43 nop 44 45 nop 460: 47 48; (Almost) same insns, but with 16-bit bCC insns. 49 50 ba 0f ; No penalty: always-taken condition not "predicted". 51 nop 52 .space 520 530: 54 setf c 55 bcs 0f ; Penalty 2 cycles. 56 nop 57 58 .space 520 590: 60 moveq 4,r0 ; Execute 5 times: 610: 62 ba 1f 63 move.d r0,r0 ; Mispredicted 3 out of 5 times: 64 .space 520 651: 66 bne 0b ; Penalty 3*2 cycles. 67 subq 1,r0 68 69 beq 0f ; Not taken; no penalty. 70 nop 710: 72 break 15 73