# HG changeset patch # User nkeynes # Date 1190964118 0 # Node ID c5ed3c8642a2583d88d56289b5c26f5e037dcc53 # Parent 1cf393db32f27f00d87e7053ad6151965635ef62 Add BSR tests --- a/test/Makefile Thu Sep 20 11:24:45 2007 +0000 +++ b/test/Makefile Fri Sep 28 07:21:58 2007 +0000 @@ -73,8 +73,9 @@ testsh4: crt0.so sh4/testsh4.so timer.so interrupt.so \ sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \ - sh4/bf.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so sh4/div0.so \ - sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so sh4/mac.s \ + sh4/bf.so sh4/bsr.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so \ + sh4/div0.so sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so \ + sh4/mac.s \ sh4/rot.so sh4/shl.so sh4/shld.so sh4/sub.so sh4/subc.so \ sh4/tas.so sh4/xtrct.so \ sh4/excslot.so sh4/undef.so --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sh4/bsr.s Fri Sep 28 07:21:58 2007 +0000 @@ -0,0 +1,99 @@ +.section .text +.include "sh4/inc.s" +! + +.global _test_bsr +_test_bsr: + start_test + mov.l r11, @-r15 + +test_bsr_1: ! Ordinary case + add #1, r12 + sts pr, r11 + mova test_bsr_1_fail, r0 + mov r0, r5 + xor r1, r1 + bsr test_bsr_1_target + add #1, r1 +test_bsr_1_fail: + fail test_bsr_str_k + bra test_bsr_2 + nop +test_bsr_1_target: + sts pr, r3 + cmp/eq r5,r3 + bf test_bsr_1_fail + mov #1, r2 + cmp/eq r1, r2 + bf test_bsr_1_fail + +test_bsr_2: ! Write PR in delay slot + add #1, r12 + + bsr test_bsr_2_target + lds r11, pr +test_bsr_2_fail: + fail test_bsr_str_k + bra test_bsr_3 + nop +test_bsr_2_target: + sts pr, r4 + cmp/eq r4,r11 + bf test_bsr_2_fail + +test_bsr_3: ! Read PR in delay slot + add #1, r12 + + mova test_bsr_3_fail, r0 + mov r0, r5 + bsr test_bsr_3_target + sts pr, r2 +test_bsr_3_fail: + fail test_bsr_str_k + bra test_bsr_4 +test_bsr_3_target: + cmp/eq r2, r5 + bf test_bsr_3_fail + sts pr, r3 + cmp/eq r3, r5 + bf test_bsr_3_fail + +test_bsr_4: ! Exception in delay slot + add #1, r12 + + mova test_bsr_4_fail, r0 + add #1, r0 + expect_exc 0x000001A0 + mova test_bsr_4_rte, r0 + mov r0, r11 +test_bsr_4_fault_pc: + bsr test_bsr_4_fail + bt test_bsr_4_rte +test_bsr_4_rte: + sts pr, r1 + cmp/eq r1, r11 + bf test_bsr_4_fail + assert_exc_caught test_bsr_str_k test_bsr_4_fault_pc + bra test_bsr_5 + nop +test_bsr_4_fail: + fail test_bsr_str_k + +test_bsr_5: + +test_bsr_end: + mov.l @r15+, r11 + end_test test_bsr_str_k + +! Branch point used for tests that should never be reached (under correct +! operation. Returns immediately, which should hit the "no exception" test +test_bsr_fail: + rts + nop + +test_bsr_str_k: + .long test_bsr_str +test_bsr_str: + .string "BSR" + + \ No newline at end of file --- a/test/sh4/testsh4.c Thu Sep 20 11:24:45 2007 +0000 +++ b/test/sh4/testsh4.c Fri Sep 28 07:21:58 2007 +0000 @@ -53,6 +53,7 @@ test_andi(); test_bf(); test_bt(); + test_bsr(); test_cmp(); test_cmpstr(); test_div0();