1998-12-14 Dave Brolley <brolley@cygnus.com>
[binutils-gdb.git] / sim / testsuite / sim / fr30 / testutils.inc
index 7f9bbc45301ff9c8b954ffbb4745912b2e37780e..2b9e489f0635ef5274a55fa2f107726d388e9f30 100644 (file)
@@ -10,6 +10,8 @@ passmsg:
        .global _start
 _start:
        ldi32 0x7fffc,sp        ; TODO -- what's a good value for this?
+       mov   sp,usp
+       mov   sp,ssp
        .endm
 
 ; Exit with return code
@@ -45,6 +47,12 @@ _start:
        ldi32 \val,\reg
        .endm
 
+; Load an immediate value into a dedicated register
+       .macro mvi_h_dr val reg
+       ldi32 \val,r0
+       mov r0,\reg
+       .endm
+
 ; Load a general register into another general register
        .macro mvr_h_gr src targ
        mov \src,\targ
@@ -108,18 +116,39 @@ testr_gr\@:
        test_h_gr \val r5
        .endm
 
+; Test the value of an general register against a dedicated register
+       .macro testr_h_dr gr dr
+       mov \dr,r5
+       testr_h_gr \gr r5
+       .endm
+
 ; Compare an immediate with word in memory
        .macro test_h_mem val addr
        ldmem_h_gr \addr r5
        test_h_gr \val r5
        .endm
 
+; Compare a general register with word in memory
+       .macro testr_h_mem reg addr
+       ldmem_h_gr \addr r5
+       testr_h_gr \reg r5
+       .endm
+
 ; Set the condition codes
        .macro set_cc mask
        andccr  0xf0
        orccr   \mask
        .endm
 
+; Set the stack mode
+       .macro set_s_user
+       orccr   0x20
+       .endm
+
+       .macro set_s_system
+       andccr  0x1f
+       .endm
+
 ; Test the condition codes
        .macro test_cc N Z V C
        .if (\N == 1)
@@ -147,3 +176,35 @@ fail\@:
        fail
 test_cc\@:
        .endm
+
+; Set the division bits
+       .macro set_dbits val
+       mvr_h_gr ps,r5
+       mvi_h_gr 0xfffff8ff,r4
+       and r4,r5
+       mvi_h_gr \val,r0
+       mvi_h_gr 3,r4
+       and r4,r0
+       lsl 9,r0
+       or r0,r5
+       mvr_h_gr r5,ps
+       .endm
+
+; Test the division bits
+       .macro test_dbits val
+       mvr_h_gr ps,r0
+       lsr 9,r0
+       mvi_h_gr 3,r4
+       and r4,r0
+       test_h_gr \val,r0
+       .endm
+
+; Save the return pointer
+       .macro save_rp
+       st rp,@-R15
+       .ENDM
+
+; restore the return pointer
+       .macro restore_rp
+       ld @R15+,rp
+       .endm