1.include "macros.inc" 2 3test_suite loop 4 5test loop 6 movi a2, 0 7 movi a3, 5 8 loop a3, 1f 9 addi a2, a2, 1 101: 11 assert eqi, a2, 5 12test_end 13 14test loop0 15 movi a2, 0 16 loop a2, 1f 17 rsr a2, lcount 18 assert eqi, a2, -1 19 j 1f 201: 21test_end 22 23test loop_jump 24 movi a2, 0 25 movi a3, 5 26 loop a3, 1f 27 addi a2, a2, 1 28 j 1f 291: 30 assert eqi, a2, 1 31test_end 32 33test loop_branch 34 movi a2, 0 35 movi a3, 5 36 loop a3, 1f 37 addi a2, a2, 1 38 beqi a2, 3, 1f 391: 40 assert eqi, a2, 3 41test_end 42 43test loop_manual 44 movi a2, 0 45 movi a3, 5 46 movi a4, 1f 47 movi a5, 2f 48 wsr a3, lcount 49 wsr a4, lbeg 50 wsr a5, lend 51 isync 52 j 1f 53.align 4 541: 55 addi a2, a2, 1 562: 57 assert eqi, a2, 6 58test_end 59 60test loop_excm 61 movi a2, 0 62 movi a3, 5 63 rsr a4, ps 64 movi a5, 0x10 65 or a4, a4, a5 66 wsr a4, ps 67 isync 68 loop a3, 1f 69 addi a2, a2, 1 701: 71 xor a4, a4, a5 72 isync 73 wsr a4, ps 74 assert eqi, a2, 1 75test_end 76 77test_suite_end 78