diff options
Diffstat (limited to 'sim/testsuite/cr16')
134 files changed, 3069 insertions, 0 deletions
diff --git a/sim/testsuite/cr16/ChangeLog b/sim/testsuite/cr16/ChangeLog new file mode 100644 index 0000000..4cb008b --- /dev/null +++ b/sim/testsuite/cr16/ChangeLog @@ -0,0 +1,51 @@ +2015-12-24 Mike Frysinger <vapier@gentoo.org> + + * allinsn.exp: Append --load-vma to global_sim_options. + * misc.exp: Likewise. + +2015-03-29 Mike Frysinger <vapier@gentoo.org> + + PR sim/12385 + * testutils.inc (START): Add _start symbol. + +2008-05-02 M R Swami Reddy <MR.Swami.Reddy@nsc.com> + + * cbitb.cgs, cbitw.cgs, sbitb.cgs, sbitw.cgs, tbit.cgs, tbitb.cgs, + tbitw.cgs, hw-trap.ms, uread16.ms, uread32.ms: New testcases. + addb.cgs, addd.cgs, addi.cgs, andb.cgs, andd.cgs, andw.cgs, ashub.cgs, + ashub_i.cgs, ashud.cgs, ashud_i.cgs, ashuw.cgs, ashuw_i.cgs, cmpi.cgs, + cmpw.cgs, jlt.cgs, jump.cgs, loadd.cgs, loadw.cgs, lshb.cgs, lshb_i.cgs, + lshd.cgs, lshd_i.cgs, lshw.cgs, lshw_i.cgs, movb.cgs, movd.cgs, + movw.cgs, movxb.cgs, movxw.cgs, movzb.cgs, movzw.cgs, mulb.cgs, + muluw.cgs, mulw.cgs, orb.cgs, ord.cgs, orw.cgs, pop1.cgs, pop2.cgs, + pop3.cgs, popret1.cgs, popret2.cgs, popret3.cgs, push1.cgs, push2.cgs, + push3.cgs: Update testcase comment. + bnc8.cgs, bnc24.cgs and ret.cgs: Removed. + +2008-04-08 M R Swami Reddy <MR.Swami.Reddy@nsc.com> + + * allinsn.exp: Remove target_alias and global_ld_options. + +2008-02-12 M R Swami Reddy <MR.Swami.Reddy@nsc.com> + + * allinsn.exp, misc.exp: New files: Test scripts + testutils.inc: New file: Test macros. + addb.cgs, addd.cgs, addi.cgs, addw.cgs, andb.cgs, andd.cgs, andw.cgs, + ashub.cgs, ashub_i.cgs, ashud.cgs, ashud_i.cgs, ashuw.cgs, ashuw_i.cgs, + bal1_24.cgs, bal2_24.cgs, bcc.cgs, bcs.cgs, beq0b.cgs, beq0w.cgs, + beq.cgs, bge.cgs, bgt.cgs, bhi.cgs, bhs.cgs, bht.cgs, blo.cgs, bls.cgs, + blt.cgs, bnc24.cgs, bnc8.cgs, bne0b.cgs, bne0w.cgs, bne.cgs, br.cgs, + cmpb.cgs, cmpb_i.cgs, cmpd.cgs, cmpd_i.cgs, cmpi.cgs, cmpw.cgs, + cmpw_i.cgs, excp.cgs, hello.ms, jal.cgs, jcc.cgs, jcs.cgs, jeq.cgs, + jfc.cgs, jfs.cgs, jge.cgs, jgt.cgs, jhi.cgs, jhs.cgs, jlo.cgs, jls.cgs, + jlt.cgs, jne.cgs, jump.cgs, loadb.cgs, loadd.cgs, loadm.cgs, loadmp.cgs, + loadw.cgs, lprd-sprd.cgs, lpr-spr.cgs, lshb.cgs, lshb_i.cgs, lshd.cgs, + lshd_i.cgs, lshw.cgs, lshw_i.cgs, macqw.cgs, macsw.cgs, macuw.cgs, + movb.cgs, movd.cgs, movw.cgs, movxb.cgs, movxw.cgs, movzb.cgs, + movzw.cgs, mulb.cgs, mulsb.cgs, mulsw.cgs, muluw.cgs, mulw.cgs, + nop.cgs, orb.cgs, ord.cgs, orw.cgs, pop1.cgs, pop2.cgs, pop3.cgs, + popret1.cgs, popret2.cgs, popret3.cgs, push1.cgs, push2.cgs, push3.cgs, + ret.cgs, scc.cgs, scs.cgs, seq.cgs, sfc.cgs, sfs.cgs, sge.cgs, sgt.cgs, + shi.cgs, shs.cgs, slo.cgs, sls.cgs, slt.cgs, sne.cgs, storb.cgs, + stord.cgs, storw.cgs, subb.cgs, subd.cgs, subi.cgs, subw.cgs, + xorb.cgs, xord.cgs, xorw.cgs: New files diff --git a/sim/testsuite/cr16/addb.cgs b/sim/testsuite/cr16/addb.cgs new file mode 100644 index 0000000..272804a --- /dev/null +++ b/sim/testsuite/cr16/addb.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for addb $sr, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global add +add: + + movb $0x1234,r4 + movb $0x1234,r5 + addb r4, r5 + test_h_gr r5, 0x68 + + pass diff --git a/sim/testsuite/cr16/addd.cgs b/sim/testsuite/cr16/addd.cgs new file mode 100644 index 0000000..c13164d --- /dev/null +++ b/sim/testsuite/cr16/addd.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for addd $sr, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global addd +addd: + + movd $0x12345678,(r4,r3) + addd $0x44444444,(r4,r3) + + test_h_grp "(r4,r3)", 0x56789abc + + pass diff --git a/sim/testsuite/cr16/addi.cgs b/sim/testsuite/cr16/addi.cgs new file mode 100644 index 0000000..dae8941 --- /dev/null +++ b/sim/testsuite/cr16/addi.cgs @@ -0,0 +1,30 @@ +# cr16 testcase for addi $imm8, $dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global addi +addi: + + movb $1, r4 + addb $2, r4 + + cmpb $3,r4 + bne not_ok + + movw $0x1234, r5 + addw $0x1234, r5 + test_h_gr r5, 0x2468 + + pass + + movd $0x12345678, (r5,r4) + addd $0x12345678, (r5,r4) + test_h_grp "(r5,r4)", 0x2468acf0 + + pass + +not_ok: + fail diff --git a/sim/testsuite/cr16/addw.cgs b/sim/testsuite/cr16/addw.cgs new file mode 100644 index 0000000..866349c --- /dev/null +++ b/sim/testsuite/cr16/addw.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for addw $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global addw +addw: + + movw $0x1234,r4 + addw $0x1234,r4 + + test_h_gr r4, 0x2468 + + pass diff --git a/sim/testsuite/cr16/allinsn.exp b/sim/testsuite/cr16/allinsn.exp new file mode 100644 index 0000000..852a673 --- /dev/null +++ b/sim/testsuite/cr16/allinsn.exp @@ -0,0 +1,31 @@ +# CR16 simulator testsuite. + +if [istarget cr16*-*-*] { + # load support procs + # load_lib cgen.exp + + # all machines + set all_machs "cr16" + + global global_sim_options + if ![info exists global_sim_options] { + set global_sim_options "" + } + set saved_global_sim_options $global_sim_options + # The cr16 linker sets the default LMA base to 0, and all the code + # expects the VMA when running, so use that when running the tests. + set global_sim_options "$saved_global_sim_options --load-vma" + + # The .cgs suffix is for "cgen .s". + foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] { + # If we're only testing specific files and this isn't one of them, + # skip it. + if ![runtest_file_p $runtests $src] { + continue + } + + run_sim_test $src $all_machs + } + + set global_sim_options $saved_global_sim_options +} diff --git a/sim/testsuite/cr16/andb.cgs b/sim/testsuite/cr16/andb.cgs new file mode 100644 index 0000000..bc201ad --- /dev/null +++ b/sim/testsuite/cr16/andb.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for and $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global and +and: + movb $3, r4 + movb $6, r5 + + andb r4,r5 + + test_h_gr r5, 2 + + pass diff --git a/sim/testsuite/cr16/andd.cgs b/sim/testsuite/cr16/andd.cgs new file mode 100644 index 0000000..8e72bae --- /dev/null +++ b/sim/testsuite/cr16/andd.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for and $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global and +and: + movd $0x33333333, (r4,r3) + movd $0x66666666, (r6,r5) + + andd (r4,r3), (r6,r5) + + test_h_grp "(r6,r5)", 0x22222222 + + pass diff --git a/sim/testsuite/cr16/andw.cgs b/sim/testsuite/cr16/andw.cgs new file mode 100644 index 0000000..d2d634a --- /dev/null +++ b/sim/testsuite/cr16/andw.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for and $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global and +and: + movw $3, r4 + movw $6, r5 + + andw r4, r5 + + test_h_gr r5, 2 + + pass diff --git a/sim/testsuite/cr16/ashub.cgs b/sim/testsuite/cr16/ashub.cgs new file mode 100644 index 0000000..ef3e94e --- /dev/null +++ b/sim/testsuite/cr16/ashub.cgs @@ -0,0 +1,26 @@ +# cr16 testcase for ashub $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ashub +ashub: + + movw $0x12f1, r4 + movw $4,r5 + ashub r5, r4 + + cmpw $0x1210, r4 + beq ok +not_ok: + fail +ok: + movw $0x12f1, r4 + movw $-4,r5 + ashub r5, r4 + + test_h_gr r4, 0x12ff + + pass diff --git a/sim/testsuite/cr16/ashub_i.cgs b/sim/testsuite/cr16/ashub_i.cgs new file mode 100644 index 0000000..b4765a4 --- /dev/null +++ b/sim/testsuite/cr16/ashub_i.cgs @@ -0,0 +1,24 @@ +# cr16 testcase for ashub $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ashub +ashub: + + movw $0x12f1, r4 + ashub $4, r4 + + cmpw $0x1210, r4 + beq ok +not_ok: + fail +ok: + movw $0x12f1, r4 + ashub $-4, r4 + + test_h_gr r4, 0x12ff + + pass diff --git a/sim/testsuite/cr16/ashud.cgs b/sim/testsuite/cr16/ashud.cgs new file mode 100644 index 0000000..c9511da --- /dev/null +++ b/sim/testsuite/cr16/ashud.cgs @@ -0,0 +1,26 @@ +# cr16 testcase for ashud $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ashud +ashud: + + movd $0xf1234567, (r4,r3) + movw $20,r5 + ashud r5, (r4,r3) + + cmpd $0x56700000, (r4,r3) + beq ok +not_ok: + fail +ok: + movd $0xf1234567, (r4,r3) + movw $-20,r5 + ashud r5, (r4,r3) + + test_h_grp "(r4,r3)", -238 + + pass diff --git a/sim/testsuite/cr16/ashud_i.cgs b/sim/testsuite/cr16/ashud_i.cgs new file mode 100644 index 0000000..3beb4e3 --- /dev/null +++ b/sim/testsuite/cr16/ashud_i.cgs @@ -0,0 +1,24 @@ +# cr16 testcase for ashud $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ashud +ashud: + + movd $0xf1234567, (r4,r3) + ashud $20, (r4,r3) + + cmpd $0x56700000, (r4,r3) + beq ok +not_ok: + fail +ok: + movd $0xf1234567, (r4,r3) + ashud $-20, (r4,r3) + + test_h_grp "(r4,r3)", -238 + + pass diff --git a/sim/testsuite/cr16/ashuw.cgs b/sim/testsuite/cr16/ashuw.cgs new file mode 100644 index 0000000..8f52e35 --- /dev/null +++ b/sim/testsuite/cr16/ashuw.cgs @@ -0,0 +1,26 @@ +# cr16 testcase for ashuw $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ashuw +ashuw: + + movw $0x1ff1, r4 + movw $12,r5 + ashuw r5, r4 + + cmpw $0x1000, r4 + beq ok +not_ok: + fail +ok: + movw $0x1ff1, r4 + movw $-12,r5 + ashuw r5, r4 + + test_h_gr r4, 0x1 + + pass diff --git a/sim/testsuite/cr16/ashuw_i.cgs b/sim/testsuite/cr16/ashuw_i.cgs new file mode 100644 index 0000000..9925914 --- /dev/null +++ b/sim/testsuite/cr16/ashuw_i.cgs @@ -0,0 +1,24 @@ +# cr16 testcase for ashuw $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ashuw +ashuw: + + movw $0x1ff1, r4 + ashuw $12, r4 + + cmpw $0x1000, r4 + beq ok +not_ok: + fail +ok: + movw $0x1ff1, r4 + ashuw $-12, r4 + + test_h_gr r4, 0x1 + + pass diff --git a/sim/testsuite/cr16/bal1_24.cgs b/sim/testsuite/cr16/bal1_24.cgs new file mode 100644 index 0000000..a174b31 --- /dev/null +++ b/sim/testsuite/cr16/bal1_24.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for bal $disp24 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global bal24 +bal24: + bal (ra), ok + + fail + +ok: + pass diff --git a/sim/testsuite/cr16/bal2_24.cgs b/sim/testsuite/cr16/bal2_24.cgs new file mode 100644 index 0000000..37cda7f --- /dev/null +++ b/sim/testsuite/cr16/bal2_24.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for bal $disp24 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global bal24 +bal24: + bal (r12), ok + + fail + +ok: + pass diff --git a/sim/testsuite/cr16/bcc.cgs b/sim/testsuite/cr16/bcc.cgs new file mode 100644 index 0000000..b0bee2b --- /dev/null +++ b/sim/testsuite/cr16/bcc.cgs @@ -0,0 +1,22 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $12, r4 + movw $10, r5 + cmpw r4, r5 + bcc ok +not_ok: + fail +ok: + movw $11, r5 + cmpw r4, r5 + beq not_ok + + pass diff --git a/sim/testsuite/cr16/bcs.cgs b/sim/testsuite/cr16/bcs.cgs new file mode 100644 index 0000000..0ba14b1 --- /dev/null +++ b/sim/testsuite/cr16/bcs.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for bcs disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global bcs +bcs: + mvi_h_condbit 0 + movw $12, r4 + movw $10, r5 + subw r4, r5 + bcs ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/beq.cgs b/sim/testsuite/cr16/beq.cgs new file mode 100644 index 0000000..35ece27 --- /dev/null +++ b/sim/testsuite/cr16/beq.cgs @@ -0,0 +1,22 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $12, r4 + movw $12, r5 + cmpw r4, r5 + beq ok +not_ok: + fail +ok: + movw $11, r5 + cmpw r4, r5 + beq not_ok + + pass diff --git a/sim/testsuite/cr16/beq0b.cgs b/sim/testsuite/cr16/beq0b.cgs new file mode 100644 index 0000000..af6a26b --- /dev/null +++ b/sim/testsuite/cr16/beq0b.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for beq0b reg disp5 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq0b +beq0b: + mvi_h_condbit 0 + movw $0x1200, r4 + beq0b r4, 0x1a +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/beq0w.cgs b/sim/testsuite/cr16/beq0w.cgs new file mode 100644 index 0000000..b3805ac --- /dev/null +++ b/sim/testsuite/cr16/beq0w.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $0, r4 + beq0b r4, 0x1a +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bge.cgs b/sim/testsuite/cr16/bge.cgs new file mode 100644 index 0000000..bb705e7 --- /dev/null +++ b/sim/testsuite/cr16/bge.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + bgt ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bgt.cgs b/sim/testsuite/cr16/bgt.cgs new file mode 100644 index 0000000..bb705e7 --- /dev/null +++ b/sim/testsuite/cr16/bgt.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + bgt ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bhi.cgs b/sim/testsuite/cr16/bhi.cgs new file mode 100644 index 0000000..9a88af7 --- /dev/null +++ b/sim/testsuite/cr16/bhi.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + bhi ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bhs.cgs b/sim/testsuite/cr16/bhs.cgs new file mode 100644 index 0000000..97dcc55 --- /dev/null +++ b/sim/testsuite/cr16/bhs.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for bhi disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global bhi +bhi: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + bhs ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bht.cgs b/sim/testsuite/cr16/bht.cgs new file mode 100644 index 0000000..39912e2 --- /dev/null +++ b/sim/testsuite/cr16/bht.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + blt ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/blo.cgs b/sim/testsuite/cr16/blo.cgs new file mode 100644 index 0000000..39912e2 --- /dev/null +++ b/sim/testsuite/cr16/blo.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + blt ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bls.cgs b/sim/testsuite/cr16/bls.cgs new file mode 100644 index 0000000..f394570 --- /dev/null +++ b/sim/testsuite/cr16/bls.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + bls ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/blt.cgs b/sim/testsuite/cr16/blt.cgs new file mode 100644 index 0000000..39912e2 --- /dev/null +++ b/sim/testsuite/cr16/blt.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for beq disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global beq +beq: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + blt ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bne.cgs b/sim/testsuite/cr16/bne.cgs new file mode 100644 index 0000000..3740f24 --- /dev/null +++ b/sim/testsuite/cr16/bne.cgs @@ -0,0 +1,22 @@ +# cr16 testcase for bne disp16 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global bne +bne: + movw $1, r4 + movw $2, r5 + cmpw r4,r5 + bne test0pass +test1fail: + fail + +test0pass: + movw $1, r5 + cmpw r4,r5 + bne test1fail + + pass diff --git a/sim/testsuite/cr16/bne0b.cgs b/sim/testsuite/cr16/bne0b.cgs new file mode 100644 index 0000000..63f3cad --- /dev/null +++ b/sim/testsuite/cr16/bne0b.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for bne0b reg disp5 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ne0b +bne0b: + mvi_h_condbit 0 + movw $0x1201, r4 + bne0b r4, 0x1a +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/bne0w.cgs b/sim/testsuite/cr16/bne0w.cgs new file mode 100644 index 0000000..f45e399 --- /dev/null +++ b/sim/testsuite/cr16/bne0w.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for bne0w reg disp5 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global bne0w +bne0w: + mvi_h_condbit 0 + movw $1, r4 + bne0w r4, 0x1a +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/br.cgs b/sim/testsuite/cr16/br.cgs new file mode 100644 index 0000000..f7ba86d --- /dev/null +++ b/sim/testsuite/cr16/br.cgs @@ -0,0 +1,24 @@ +# cr16 testcase for bc $disp24 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global bc24 +bc24: + + mvi_h_condbit 0 + bne test0fail + br test0pass +test0fail: + fail +test0pass: + + mvi_h_condbit 1 + bne test1pass + fail +test1pass: + + pass + diff --git a/sim/testsuite/cr16/cbitb.cgs b/sim/testsuite/cr16/cbitb.cgs new file mode 100644 index 0000000..473fd71 --- /dev/null +++ b/sim/testsuite/cr16/cbitb.cgs @@ -0,0 +1,35 @@ +# cr16 testcase for cbitb $bit_pos, ABS/REGP/REG +# mach: cr16 + + .include "testutils.inc" + + start + + .global cbitb +cbitb: + cbitb $0,_y + loadw _y, r1 + cmpb $0xfe, r1 + beq ok1 +not_ok: + fail + +ok1: + movd $_y, (r1,r0) + cbitb $1,0(r1,r0) + loadw _y, r1 + cmpb $0xfc, r1 + beq ok2 + br not_ok +ok2: + + movw $_y, r1 + cbitb $2,0(r1) + loadw _y, r1 + cmpb $0xf8, r1 + beq ok3 + br not_ok +ok3: + pass + +_y: .word 0xff diff --git a/sim/testsuite/cr16/cbitw.cgs b/sim/testsuite/cr16/cbitw.cgs new file mode 100644 index 0000000..a97698c --- /dev/null +++ b/sim/testsuite/cr16/cbitw.cgs @@ -0,0 +1,35 @@ +# cr16 testcase for cbitw +# mach: cr16 + + .include "testutils.inc" + + start + + .global cbitw +cbitw: + cbitw $4,_y + loadw _y, r1 + cmpb $0xef, r1 + beq ok1 +not_ok: + fail + +ok1: + movd $_y, (r1,r0) + cbitw $5,0(r1,r0) + loadw _y, r1 + cmpb $0xcf, r1 + beq ok2 + br not_ok +ok2: + + movw $_y, r1 + cbitw $6,0(r1) + loadw _y, r1 + cmpb $0x8f, r1 + beq ok3 + br not_ok +ok3: + pass + +_y: .word 0xff diff --git a/sim/testsuite/cr16/cmpb.cgs b/sim/testsuite/cr16/cmpb.cgs new file mode 100644 index 0000000..50984bf --- /dev/null +++ b/sim/testsuite/cr16/cmpb.cgs @@ -0,0 +1,23 @@ +# cr16 testcase for cmpb reg1, reg2 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global cmpb +cmpb: + mvi_h_condbit 0 + movw $0x2311, r4 + movw $0x4211, r5 + cmpb r4,r5 + beq ok +not_ok: + fail +ok: + mvi_h_condbit 1 + movw $0x4222, r5 + cmpb r4,r5 + beq not_ok + + pass diff --git a/sim/testsuite/cr16/cmpb_i.cgs b/sim/testsuite/cr16/cmpb_i.cgs new file mode 100644 index 0000000..591abe9 --- /dev/null +++ b/sim/testsuite/cr16/cmpb_i.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for cmpb $imm4, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global cmpb_i +cmpb_i: + mvi_h_condbit 0 + movw $0x2311, r4 + cmpb $0x4211, r4 + beq ok +not_ok: + fail +ok: + mvi_h_condbit 1 + cmpb $0x4222,r4 + beq not_ok + + pass diff --git a/sim/testsuite/cr16/cmpd.cgs b/sim/testsuite/cr16/cmpd.cgs new file mode 100644 index 0000000..cc9e55d --- /dev/null +++ b/sim/testsuite/cr16/cmpd.cgs @@ -0,0 +1,23 @@ +# cr16 testcase for cmpd (regp), (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global cmpd +cmpd: + mvi_h_condbit 0 + movd $0x12345678, (r4,r3) + movd $0x12345678, (r6,r5) + cmpd (r4,r3), (r6,r5) + beq ok +not_ok: + fail +ok: + mvi_h_condbit 1 + movd $0x12341234, (r6,r5) + cmpd (r4,r3), (r6,r5) + beq not_ok + + pass diff --git a/sim/testsuite/cr16/cmpd_i.cgs b/sim/testsuite/cr16/cmpd_i.cgs new file mode 100644 index 0000000..ad6018a --- /dev/null +++ b/sim/testsuite/cr16/cmpd_i.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for cmpb $imm32,(regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global cmpd_i +cmpd_i: + mvi_h_condbit 0 + movd $0x12345678, (r4,r3) + cmpd $0x12345678, (r4,r3) + beq ok +not_ok: + fail +ok: + mvi_h_condbit 1 + cmpd $0x12341234, (r4,r3) + beq not_ok + + pass diff --git a/sim/testsuite/cr16/cmpi.cgs b/sim/testsuite/cr16/cmpi.cgs new file mode 100644 index 0000000..cff17e8 --- /dev/null +++ b/sim/testsuite/cr16/cmpi.cgs @@ -0,0 +1,23 @@ +# cr16 testcase for cmpi $imm16, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global cmpi +cmpi: + mvi_h_condbit 0 + movw $1, r4 + cmpw $1, r4 + beq ok +not_ok: + fail +ok: + mvi_h_condbit 1 + movw $2, r4 + cmpw $2, r4 + bne not_ok + + + pass diff --git a/sim/testsuite/cr16/cmpw.cgs b/sim/testsuite/cr16/cmpw.cgs new file mode 100644 index 0000000..9d333fb --- /dev/null +++ b/sim/testsuite/cr16/cmpw.cgs @@ -0,0 +1,23 @@ +# cr16 testcase for cmp $imm, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global cmp +cmp: + mvi_h_condbit 0 + movw $0x1234, r4 + movw $0x1234, r5 + cmpb r4,r5 + beq ok +not_ok: + fail +ok: + mvi_h_condbit 1 + movw $0x2222, r5 + cmpw r4,r5 + beq not_ok + + pass diff --git a/sim/testsuite/cr16/cmpw_i.cgs b/sim/testsuite/cr16/cmpw_i.cgs new file mode 100644 index 0000000..31f701c --- /dev/null +++ b/sim/testsuite/cr16/cmpw_i.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for cmpw_i $imm16, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global cmpw_i +cmpw_i: + mvi_h_condbit 0 + movw $0x1234, r4 + cmpw $0x1234, r4 + beq ok +not_ok: + fail +ok: + mvi_h_condbit 1 + cmpw $0x2222, r4 + beq not_ok + + pass diff --git a/sim/testsuite/cr16/excp.cgs b/sim/testsuite/cr16/excp.cgs new file mode 100644 index 0000000..82d445a --- /dev/null +++ b/sim/testsuite/cr16/excp.cgs @@ -0,0 +1,110 @@ +# cr16 testcase for excp uimm4 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global excp +excp: + pass # pass macro use the excp 8 + +## Test 1: bbpsw = 0, bpsw = 1, psw = 0 +# +# # bbsm = 0, bie = 0, bbcond = 0 +# movw $0, r4 +# lpr r4, cr8 +# +# # bsm = 1, bie = 1, bcond = 1, sm = 0, ie = 0, cond = 0 +# movw $0xc100, r4 +# lpr r4, cr0 +# +# # bbpc = 0 +# movw $0, r4 +# mvtc r4, bbpc +# +# # bpc = 42 +# mvaddr_h_gr r4, 42 +# mvtc r4, bpc +# +# # Copy excp2_handler to excp area of memory. +# ld24 r0,#0x48 # address of excp 2 handler +# ld24 r1,#excp2_handler +# ld r2,@r1 +# st r2,@r0 +# # Set up return address. +# ld24 r5,#excp2_ret1 +# +#excp_insn1: +# excp 2 +# fail +# +#excp2_ret1: +# # test bbsm = 1, bbie = 1, bbcond = 1 +# mvfc r4, cr8 +# test_h_gr r4, 0xc1 +# +# # test bsm = 0, bie = 0, bcond = 0, sm = 0, ie = 0, cond = 0 +# mvfc r4, cr0 +# test_h_gr r4, 0 +# +# # test bbpc = 42 +# mvfc r4, bbpc +# test_h_gr r4, 42 +# +# # test bpc = proper return address +# mvfc r4, bpc +# test_h_gr r4, excp_insn1 + 4 +# +## Test 2: bbpsw = 1, bpsw = 0, psw = 1 +# +# # bbsm = 1, bie = 1, bbcond = 1 +# mvi_h_gr r4, 0xc1 +# mvtc r4, cr8 +# +# # bsm = 0, bie = 0, bcond = 0, sm = 1, ie = 1, cond = 1 +# mvi_h_gr r4, 0xc1 +# mvtc r4, cr0 +# +# # bbpc = 42 +# mvaddr_h_gr r4, 42 +# mvtc r4, bbpc +# +# # bpc = 0 +# mvaddr_h_gr r4, 0 +# mvtc r4, bpc +# +# # Set up return address. +# ld24 r5,#excp2_ret2 +# +#excp_insn2: +# excp #2 +# fail +# +#excp2_ret2: +# # test bbsm = 0, bbie = 0, bbcond = 0 +# mvfc r4, cr8 +# test_h_gr r4, 0 +# +# # test bsm = 1, bie = 1, bcond = 1, sm = 1, ie = 0, cond = 0 +# mvfc r4, cr0 +# test_h_gr r4, 0xc180 +# +# # test bbpc = 0 +# mvfc r4, bbpc +# test_h_gr r4, 0 +# +# # test bpc = proper return address +# mvfc r4, bpc +# test_h_gr r4, excp_insn2 + 4 +# +# pass +# +# .data +# +## Don't use rte as it will undo the effects of excp we're testing. +# +# .p2align 2 +#excp2_handler: +# jmp r5 +# nop diff --git a/sim/testsuite/cr16/hello.ms b/sim/testsuite/cr16/hello.ms new file mode 100644 index 0000000..ab6c482 --- /dev/null +++ b/sim/testsuite/cr16/hello.ms @@ -0,0 +1,19 @@ +# output(): Hello world!\n +# mach(): cr16 + + .globl _start +_start: + +# write (hello world) + movw $1,r2 + movd $hello,(r4,r3) + loadw length,r5 + movw $0x404,r0 + excp 8 +# exit (0) + movw $0,r2 + movw $0x410,r0 + excp 8 + +length: .long 14 +hello: .ascii "Hello world!\r\n" diff --git a/sim/testsuite/cr16/hw-trap.ms b/sim/testsuite/cr16/hw-trap.ms new file mode 100644 index 0000000..8c8c185 --- /dev/null +++ b/sim/testsuite/cr16/hw-trap.ms @@ -0,0 +1,10 @@ +# mach(): cr16 + + .include "testutils.inc" + + start + +# perform trap + movw $0,r2 + movw $0x410,r0 + pass # the pass macro use the trap 8 diff --git a/sim/testsuite/cr16/jal.cgs b/sim/testsuite/cr16/jal.cgs new file mode 100644 index 0000000..106c864 --- /dev/null +++ b/sim/testsuite/cr16/jal.cgs @@ -0,0 +1,35 @@ +# cr16 testcase for jal $sr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jal +jal: + movd $ok1, (r5, r4) + lshd $-1, (r5,r4) + jal (ra), (r5,r4) +not_ok: + fail +ok1: + movd $not_ok, (r7, r6) + lshd $-1, (r7,r6) + cmpd (r7,r6), (ra) + beq ok2 + br not_ok +ok2: + movd $ok3, (r5, r4) + lshd $-1, (r5,r4) + jal (r1,r0), (r5,r4) +not_ok1: + br not_ok +ok3: + movd $not_ok1, (r7, r6) + lshd $-1, (r7,r6) + cmpd (r7,r6), (r1,r0) + beq ok4 + br not_ok +ok4: + + pass diff --git a/sim/testsuite/cr16/jcc.cgs b/sim/testsuite/cr16/jcc.cgs new file mode 100644 index 0000000..84db77a --- /dev/null +++ b/sim/testsuite/cr16/jcc.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jcc (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jcc +jcc: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $12, r4 + movw $10, r5 + cmpw r4, r5 + jcc (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jcs.cgs b/sim/testsuite/cr16/jcs.cgs new file mode 100644 index 0000000..91d40a3 --- /dev/null +++ b/sim/testsuite/cr16/jcs.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jcs (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jcs +jcs: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $12, r4 + movw $10, r5 + subw r4, r5 + jcs (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jeq.cgs b/sim/testsuite/cr16/jeq.cgs new file mode 100644 index 0000000..824828d --- /dev/null +++ b/sim/testsuite/cr16/jeq.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jeq (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jeq +jeq: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $12, r4 + movw $12, r5 + cmpw r4, r5 + jeq (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jfc.cgs b/sim/testsuite/cr16/jfc.cgs new file mode 100644 index 0000000..0bf1c29 --- /dev/null +++ b/sim/testsuite/cr16/jfc.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jfc (repl) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jfc +jfc: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + subw r4, r5 + jfc (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jfs.cgs b/sim/testsuite/cr16/jfs.cgs new file mode 100644 index 0000000..c14f565 --- /dev/null +++ b/sim/testsuite/cr16/jfs.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jfs (repl) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jfs +jfs: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $0xaa, r4 + movw $0xaa, r5 + addb r4, r5 + jfs (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jge.cgs b/sim/testsuite/cr16/jge.cgs new file mode 100644 index 0000000..685ba4c --- /dev/null +++ b/sim/testsuite/cr16/jge.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jge (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jge +jge: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + jge (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jgt.cgs b/sim/testsuite/cr16/jgt.cgs new file mode 100644 index 0000000..e1bed75 --- /dev/null +++ b/sim/testsuite/cr16/jgt.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jgt (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jgt +jgt: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + jgt (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jhi.cgs b/sim/testsuite/cr16/jhi.cgs new file mode 100644 index 0000000..0959d1d --- /dev/null +++ b/sim/testsuite/cr16/jhi.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jeq (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jeq +jeq: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + jhi (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jhs.cgs b/sim/testsuite/cr16/jhs.cgs new file mode 100644 index 0000000..80a3944 --- /dev/null +++ b/sim/testsuite/cr16/jhs.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jhs (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jhs +jhs: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + subw r4, r5 + jhs (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jlo.cgs b/sim/testsuite/cr16/jlo.cgs new file mode 100644 index 0000000..cf00e3e --- /dev/null +++ b/sim/testsuite/cr16/jlo.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jlo (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jlo +jlo: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + jlo (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jls.cgs b/sim/testsuite/cr16/jls.cgs new file mode 100644 index 0000000..be50f74 --- /dev/null +++ b/sim/testsuite/cr16/jls.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jeq (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jeq +jeq: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + jls (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jlt.cgs b/sim/testsuite/cr16/jlt.cgs new file mode 100644 index 0000000..ca93cf1 --- /dev/null +++ b/sim/testsuite/cr16/jlt.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jlt (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jlt +jlt: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + jlt (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jne.cgs b/sim/testsuite/cr16/jne.cgs new file mode 100644 index 0000000..fb86889 --- /dev/null +++ b/sim/testsuite/cr16/jne.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for jne (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jne +jne: + movd $ok, (r7,r6) + lshd $-1, (r7,r6) + + mvi_h_condbit 0 + movw $0, r4 + movw $1, r5 + cmpw r4, r5 + jne (r7,r6) +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/jump.cgs b/sim/testsuite/cr16/jump.cgs new file mode 100644 index 0000000..df20c15 --- /dev/null +++ b/sim/testsuite/cr16/jump.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for jmp (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global jmp +jmp: + movd $ok1, (r4,r3) + jump (r4,r3) + fail +ok1: + movd $ok2, (r4,r3) + jump (r4,r3) + fail +ok2: + pass diff --git a/sim/testsuite/cr16/loadb.cgs b/sim/testsuite/cr16/loadb.cgs new file mode 100644 index 0000000..c591ec9 --- /dev/null +++ b/sim/testsuite/cr16/loadb.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for loadb $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ldb +ldb: + movd $data_loc, (r4,r3) + movw $0,r5 + + loadb 0(r4,r3),r5 + + test_h_gr r5, 0x78 # little endian processor + + pass + +data_loc: + .word 0x5678 + diff --git a/sim/testsuite/cr16/loadd.cgs b/sim/testsuite/cr16/loadd.cgs new file mode 100644 index 0000000..b6a851d --- /dev/null +++ b/sim/testsuite/cr16/loadd.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for loadd 0(regp),regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ldb +ldb: + movd $data_loc, (r4,r3) + movd $0,(r6,r5) + + loadd 0(r4,r3),(r6,r5) + + test_h_grp "(r6, r5)", 0x12345678 # little endian processor + + pass + +data_loc: + .long 0x12345678 + diff --git a/sim/testsuite/cr16/loadm.cgs b/sim/testsuite/cr16/loadm.cgs new file mode 100644 index 0000000..8bd6d11 --- /dev/null +++ b/sim/testsuite/cr16/loadm.cgs @@ -0,0 +1,41 @@ +# cr16 testcase for loadm count +# mach(): cr16 + + .include "testutils.inc" + + start + + .global loadm +loadm: + movw $0x1000, r0 + movw $0x12, r2 + storw r2, 0x1000 + movw $0x34, r3 + storw r3, 0x1002 + movw $0x56, r4 + storw r4, 0x1004 + movw $0x78, r5 + storw r5, 0x1006 + + loadm $4 + + cmpw $0x12,r2 + beq ok1 +not_ok: + fail +ok1: + cmpw $0x34,r3 + beq ok2 + br not_ok +ok2: + cmpw $0x56,r4 + beq ok3 + br not_ok +ok3: + cmpw $0x78,r5 + beq ok4 + br not_ok +ok4: + pass + pass + diff --git a/sim/testsuite/cr16/loadmp.cgs b/sim/testsuite/cr16/loadmp.cgs new file mode 100644 index 0000000..6003c3f --- /dev/null +++ b/sim/testsuite/cr16/loadmp.cgs @@ -0,0 +1,40 @@ +# cr16 testcase for loadmp count +# mach(): cr16 + + .include "testutils.inc" + + start + + .global loadmp +loadmp: + movd $0x1000, (r1,r0) + movw $0x12, r2 + storw r2, 0x1000 + movw $0x34, r3 + storw r3, 0x1002 + movw $0x56, r4 + storw r4, 0x1004 + movw $0x78, r5 + storw r5, 0x1006 + + loadmp $4 + + cmpw $0x12,r2 + beq ok1 +not_ok: + fail +ok1: + cmpw $0x34,r3 + beq ok2 + br not_ok +ok2: + cmpw $0x56,r4 + beq ok3 + br not_ok +ok3: + cmpw $0x78,r5 + beq ok4 + br not_ok +ok4: + pass + diff --git a/sim/testsuite/cr16/loadw.cgs b/sim/testsuite/cr16/loadw.cgs new file mode 100644 index 0000000..8faf616 --- /dev/null +++ b/sim/testsuite/cr16/loadw.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for loadw 0(regp), (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ldb +ldb: + movd $data_loc, (r4,r3) + movw $0,r5 + + loadw 0(r4,r3),r5 + + test_h_gr r5, 0x5678 # little endian processor + + pass + +data_loc: + .word 0x5678 + diff --git a/sim/testsuite/cr16/lpr-spr.cgs b/sim/testsuite/cr16/lpr-spr.cgs new file mode 100644 index 0000000..c2679ea --- /dev/null +++ b/sim/testsuite/cr16/lpr-spr.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for lpr reg, preg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lpr +lpr: + movw $0x1234,r3 + lpr r3, psr + + spr psr,r5 + + + test_h_gr r5, 0x1234 + + pass diff --git a/sim/testsuite/cr16/lprd-sprd.cgs b/sim/testsuite/cr16/lprd-sprd.cgs new file mode 100644 index 0000000..3df8de3 --- /dev/null +++ b/sim/testsuite/cr16/lprd-sprd.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for lprd reg, preg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lprd +lprd: + movd $0x12345678,(r4,r3) + lprd (r4,r3), psr + + sprd psr,(r6,r5) + + + test_h_grp "(r6,r5)", 0x12345678 + + pass diff --git a/sim/testsuite/cr16/lshb.cgs b/sim/testsuite/cr16/lshb.cgs new file mode 100644 index 0000000..59ddbba --- /dev/null +++ b/sim/testsuite/cr16/lshb.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for lshb count, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lshb +lshb: + movb $6, r4 + movb $1, r5 + lshb r5, r4 + test_h_gr r4, 12 + + pass diff --git a/sim/testsuite/cr16/lshb_i.cgs b/sim/testsuite/cr16/lshb_i.cgs new file mode 100644 index 0000000..10d3085 --- /dev/null +++ b/sim/testsuite/cr16/lshb_i.cgs @@ -0,0 +1,14 @@ +# cr16 testcase for lshb_i $uimm5, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lshb_i +lshb_i: + movb $6,r4 + lshb $1, r4 + test_h_gr r4, 12 + + pass diff --git a/sim/testsuite/cr16/lshd.cgs b/sim/testsuite/cr16/lshd.cgs new file mode 100644 index 0000000..e146ca1 --- /dev/null +++ b/sim/testsuite/cr16/lshd.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for lshd reg, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lshd +lshd: + movd $0x12345678, (r4,r3) + movw $0x10, r5 + lshd r5, (r4,r3) + test_h_grp "(r4,r3)", 0x56780000 + + pass diff --git a/sim/testsuite/cr16/lshd_i.cgs b/sim/testsuite/cr16/lshd_i.cgs new file mode 100644 index 0000000..aa65933 --- /dev/null +++ b/sim/testsuite/cr16/lshd_i.cgs @@ -0,0 +1,14 @@ +# cr16 testcase for lshb_i $uimm5, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lshb_i +lshb_i: + movd $0x12345678,(r4,r3) + lshd $16, (r4,r3) + test_h_grp "(r4,r3)", 0x56780000 + + pass diff --git a/sim/testsuite/cr16/lshw.cgs b/sim/testsuite/cr16/lshw.cgs new file mode 100644 index 0000000..a10edff --- /dev/null +++ b/sim/testsuite/cr16/lshw.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for lshw reg, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lshw +lshw: + movw $0x1234, r4 + movw $8, r5 + lshw r5, r4 + test_h_gr r4, 0x3400 + + pass diff --git a/sim/testsuite/cr16/lshw_i.cgs b/sim/testsuite/cr16/lshw_i.cgs new file mode 100644 index 0000000..9e94a5e --- /dev/null +++ b/sim/testsuite/cr16/lshw_i.cgs @@ -0,0 +1,14 @@ +# cr16 testcase for lshb_i $uimm4, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global lshb_i +lshb_i: + movw $0x1234,r4 + lshw $8, r4 + test_h_gr r4, 0x3400 + + pass diff --git a/sim/testsuite/cr16/macqw.cgs b/sim/testsuite/cr16/macqw.cgs new file mode 100644 index 0000000..4c6da4f --- /dev/null +++ b/sim/testsuite/cr16/macqw.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for macqw reg, (regp) +# mach(): cr16 + + .include "testutils.inc" + + start # REVIST to update testcase + + .global macqw +macqw: + movw $0x123,r3 + movw $0x456,r4 + macqw r3, r4, (r6,r5) + test_h_grp "(r6,r5)", 0x4edc2 + + pass diff --git a/sim/testsuite/cr16/macsw.cgs b/sim/testsuite/cr16/macsw.cgs new file mode 100644 index 0000000..8a0f227 --- /dev/null +++ b/sim/testsuite/cr16/macsw.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for macsw reg, (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global macsw # REVISIT to update this testcase +macsw: + movw $0x123,r3 + movw $0x456,r4 + macsw r3,r4, (r6,r5) + test_h_grp "(r6,r5)", 0x4edc2 + + pass diff --git a/sim/testsuite/cr16/macuw.cgs b/sim/testsuite/cr16/macuw.cgs new file mode 100644 index 0000000..ea4c3fc --- /dev/null +++ b/sim/testsuite/cr16/macuw.cgs @@ -0,0 +1,15 @@ +# cr16 testcase for macuw reg, reg, (regp) +# mach(): cr16 + + .include "testutils.inc" + + start # REVIST to update testcase + + .global macuw +macuw: + movw $0x123,r3 + movw $0x456,r4 + macuw r3, r4, (r6,r5) + test_h_grp "(r6,r5)", 0x4edc2 + + pass diff --git a/sim/testsuite/cr16/misc.exp b/sim/testsuite/cr16/misc.exp new file mode 100644 index 0000000..39dd3a4 --- /dev/null +++ b/sim/testsuite/cr16/misc.exp @@ -0,0 +1,31 @@ +# Miscellaneous CR16 simulator testcases + +if [istarget cr16*-*-*] { + # load support procs + # load_lib cgen.exp + + # all machines + set all_machs "cr16" + + global global_sim_options + if ![info exists global_sim_options] { + set global_sim_options "" + } + set saved_global_sim_options $global_sim_options + # The cr16 linker sets the default LMA base to 0, and all the code + # expects the VMA when running, so use that when running the tests. + set global_sim_options "$saved_global_sim_options --load-vma" + + # The .ms suffix is for "miscellaneous .s". + foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.ms]] { + # If we're only testing specific files and this isn't one of them, + # skip it. + if ![runtest_file_p $runtests $src] { + continue + } + + run_sim_test $src $all_machs + } + + set global_sim_options $saved_global_sim_options +} diff --git a/sim/testsuite/cr16/movb.cgs b/sim/testsuite/cr16/movb.cgs new file mode 100644 index 0000000..fc8fcba --- /dev/null +++ b/sim/testsuite/cr16/movb.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for movb $imm, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global movb +movb: + movb $1, r4 + movb $0, r5 + + movb r4, r5 + + test_h_gr r5, 1 + + pass diff --git a/sim/testsuite/cr16/movd.cgs b/sim/testsuite/cr16/movd.cgs new file mode 100644 index 0000000..8b1b638 --- /dev/null +++ b/sim/testsuite/cr16/movd.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for movd $imm32, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global movd +movd: + movd $0x12345678, (r4,r3) + + movd (r4,r3), (r6,r5) + + test_h_grp "(r6,r5)", 0x12345678 + + pass diff --git a/sim/testsuite/cr16/movw.cgs b/sim/testsuite/cr16/movw.cgs new file mode 100644 index 0000000..e14afb0 --- /dev/null +++ b/sim/testsuite/cr16/movw.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for movw $imm16, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global movw +movw: + movw $0x1234, r4 + + movw r4, r5 + + test_h_gr r5, 0x1234 + + pass diff --git a/sim/testsuite/cr16/movxb.cgs b/sim/testsuite/cr16/movxb.cgs new file mode 100644 index 0000000..3c356c9 --- /dev/null +++ b/sim/testsuite/cr16/movxb.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for movb $imm4, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global movb +movb: + movb $0xf, r4 + movw $0x1234, r5 + + movxb r4, r5 + + test_h_gr r5, 0xf + + pass diff --git a/sim/testsuite/cr16/movxw.cgs b/sim/testsuite/cr16/movxw.cgs new file mode 100644 index 0000000..77dea80 --- /dev/null +++ b/sim/testsuite/cr16/movxw.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for movw reg, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global movw +movw: + movw $0x1234, r4 + movd $0, (r6,r5) + + movxw r4, (r6,r5) + + test_h_grp "(r6, r5)", 0x1234 + + pass diff --git a/sim/testsuite/cr16/movzb.cgs b/sim/testsuite/cr16/movzb.cgs new file mode 100644 index 0000000..acbe2b6 --- /dev/null +++ b/sim/testsuite/cr16/movzb.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for movzb reg, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global movzb +movzb: + movw $0x120f, r4 + movw $0x1200, r5 + + movzb r4, r5 + + test_h_gr r5, 0xf + + pass diff --git a/sim/testsuite/cr16/movzw.cgs b/sim/testsuite/cr16/movzw.cgs new file mode 100644 index 0000000..93855e4 --- /dev/null +++ b/sim/testsuite/cr16/movzw.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for movzw reg, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global movzw +movzw: + movb $0xff, r4 + movd $0x12345678,(r6, r5) + + movzw r4, (r6,r5) + + test_h_grp "(r6, r5)", 0xff + + pass diff --git a/sim/testsuite/cr16/mulb.cgs b/sim/testsuite/cr16/mulb.cgs new file mode 100644 index 0000000..c4b859f --- /dev/null +++ b/sim/testsuite/cr16/mulb.cgs @@ -0,0 +1,30 @@ +# cr16 testcase for mulb $imm4/imm16/reg,$reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global mulb +mulb: + movw $0x1234,r4 + movw $0x4567,r5 + + mulb r4, r5 + cmpb $0xec, r5 + beq ok1 +not_ok: + fail + +ok1: + movw $3,r4 + mulb $7,r4 + cmpb $21, r4 + beq ok + br not_ok +ok: + movw $3,r4 + mulb $0x1207, r4 + test_h_gr r4, 21 + + pass diff --git a/sim/testsuite/cr16/mulsb.cgs b/sim/testsuite/cr16/mulsb.cgs new file mode 100644 index 0000000..60912af --- /dev/null +++ b/sim/testsuite/cr16/mulsb.cgs @@ -0,0 +1,24 @@ +# cr16 testcase for mulsb $imm4/imm16/reg, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global mulsb +mulsb: + movw $-3,r4 + movw $7,r5 + + mulsb r4, r5 + cmpw $-21, r5 + beq ok1 +not_ok: + fail + +ok1: + movw $3,r4 + mulw $7, r4 + test_h_gr r4, 21 + + pass diff --git a/sim/testsuite/cr16/mulsw.cgs b/sim/testsuite/cr16/mulsw.cgs new file mode 100644 index 0000000..5bf5ac1 --- /dev/null +++ b/sim/testsuite/cr16/mulsw.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for mulsw reg, (regp) +# mach(): cr16 + + .include "testutils.inc" + + start + + .global mulsw +mulsw: + movw $0xfff,r4 # fix for 0xffff + movd $0xffffffff,(r6,r5) + + mulsw r4, (r6,r5) + test_h_grp "(r6,r5)", 0xfffff001 + + pass diff --git a/sim/testsuite/cr16/muluw.cgs b/sim/testsuite/cr16/muluw.cgs new file mode 100644 index 0000000..71f7ee0 --- /dev/null +++ b/sim/testsuite/cr16/muluw.cgs @@ -0,0 +1,16 @@ +# cr16 testcase for muluw reg, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global muluw +muluw: + movw $0xfff,r4 # fix for 0xffff + movd $0xffffffff,(r6,r5) + + muluw r4, (r6,r5) + test_h_grp "(r6,r5)", 0xffef001 + + pass diff --git a/sim/testsuite/cr16/mulw.cgs b/sim/testsuite/cr16/mulw.cgs new file mode 100644 index 0000000..cbd4552 --- /dev/null +++ b/sim/testsuite/cr16/mulw.cgs @@ -0,0 +1,23 @@ +# cr16 testcase for mulw reg reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global mulw +mulw: + movw $0x1234,r4 + movw $0x1234,r5 + + mulw r4, r5 + cmpw $0x5a90, r5 + beq ok1 +not_ok: + fail + +ok1: + mulw $0x1234, r4 + test_h_gr r4, 0x5a90 + + pass diff --git a/sim/testsuite/cr16/nop.cgs b/sim/testsuite/cr16/nop.cgs new file mode 100644 index 0000000..e29fa93 --- /dev/null +++ b/sim/testsuite/cr16/nop.cgs @@ -0,0 +1,11 @@ +# cr16 testcase for nop +# mach(): cr16 + + .include "testutils.inc" + + start + + .global nop +nop: + nop + pass diff --git a/sim/testsuite/cr16/orb.cgs b/sim/testsuite/cr16/orb.cgs new file mode 100644 index 0000000..43ce26b --- /dev/null +++ b/sim/testsuite/cr16/orb.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for orb $imm, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global orb +orb: + movb $3, r4 + movb $6, r5 + + orb r4,r5 + + test_h_gr r5, 7 + + pass diff --git a/sim/testsuite/cr16/ord.cgs b/sim/testsuite/cr16/ord.cgs new file mode 100644 index 0000000..e682d3a --- /dev/null +++ b/sim/testsuite/cr16/ord.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for ord $imm32, regp +# mach(): cr16 + + .include "testutils.inc" + + start + + .global ord +ord: + movd $0x33333333, (r4,r3) + movd $0x66666666, (r6,r5) + + ord (r4,r3), (r6,r5) + + test_h_grp "(r6,r5)", 0x77777777 + + pass diff --git a/sim/testsuite/cr16/orw.cgs b/sim/testsuite/cr16/orw.cgs new file mode 100644 index 0000000..4c1b529 --- /dev/null +++ b/sim/testsuite/cr16/orw.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for orw reg, reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global orw +orw: + movw $3, r4 + movw $6, r5 + + orw r4, r5 + + test_h_gr r5, 7 + + pass diff --git a/sim/testsuite/cr16/pop1.cgs b/sim/testsuite/cr16/pop1.cgs new file mode 100644 index 0000000..cf2a02d --- /dev/null +++ b/sim/testsuite/cr16/pop1.cgs @@ -0,0 +1,42 @@ +# cr16 testcase for pop count reg RA insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global pop1 +pop1: + movd $0x1000, (sp) + movw $0x2f50, r3 + storw r3, 0x1000 + movw $0x107e, r3 + storw r3, 0x1002 + movw $0x35ec, r3 + storw r3, 0x1004 + + movd $0xabcd, (r3,r2) + stord (r3,r2), 0x1006 + + pop $3,r5, RA + + cmpw $0x2f50,r5 + beq ok1 + br not_ok +not_ok: + fail +ok1: + cmpw $0x107e,r6 + beq ok2 + br not_ok +ok2: + cmpw $0x35ec,r7 + beq ok3 + br not_ok + +ok3: + cmpd $0xabcd, (ra) + beq ok4 + br not_ok +ok4: + pass diff --git a/sim/testsuite/cr16/pop2.cgs b/sim/testsuite/cr16/pop2.cgs new file mode 100644 index 0000000..aa3a9ec --- /dev/null +++ b/sim/testsuite/cr16/pop2.cgs @@ -0,0 +1,35 @@ +# cr16 testcase for pop count reg insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global pop2 +pop2: + movd $0x1000, (sp) + movw $0x2f50, r3 + storw r3, 0x1000 + movw $0x107e, r3 + storw r3, 0x1002 + movw $0x35ec, r3 + storw r3, 0x1004 + + pop $3,r5 + + cmpw $0x2f50,r5 + beq ok1 + br not_ok +not_ok: + fail +ok1: + cmpw $0x107e,r6 + beq ok2 + br not_ok +ok2: + cmpw $0x35ec,r7 + beq ok3 + br not_ok + +ok3: + pass diff --git a/sim/testsuite/cr16/pop3.cgs b/sim/testsuite/cr16/pop3.cgs new file mode 100644 index 0000000..13478f1 --- /dev/null +++ b/sim/testsuite/cr16/pop3.cgs @@ -0,0 +1,24 @@ +# cr16 testcase for pop RA insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global pop3 +pop3: + movd $0x1006, (sp) + movd $0xabcd, (r3,r2) + stord (r3,r2), 0x1006 + pop RA + + + cmpd $0xabcd, (ra) + beq ok + br not_ok +not_ok: + fail +ok: + pass + + diff --git a/sim/testsuite/cr16/popret1.cgs b/sim/testsuite/cr16/popret1.cgs new file mode 100644 index 0000000..a34b0fb --- /dev/null +++ b/sim/testsuite/cr16/popret1.cgs @@ -0,0 +1,40 @@ +# cr16 testcase for popret count reg RA insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global popret1 +popret1: + movd $0x1000, (sp) + movw $0x2f50, r3 + storw r3, 0x1000 + movw $0x107e, r3 + storw r3, 0x1002 + movw $0x35ec, r3 + storw r3, 0x1004 + + movd $ok, (r3,r2) # jump to ok + lshd $-1, (r3,r2) + stord (r3,r2), 0x1006 + + popret $3,r5, RA + +ok: + cmpw $0x2f50,r5 + beq ok1 + br not_ok +not_ok: + fail +ok1: + cmpw $0x107e,r6 + beq ok2 + br not_ok +ok2: + cmpw $0x35ec,r7 + beq ok3 + br not_ok + +ok3: + pass diff --git a/sim/testsuite/cr16/popret2.cgs b/sim/testsuite/cr16/popret2.cgs new file mode 100644 index 0000000..5a7f905 --- /dev/null +++ b/sim/testsuite/cr16/popret2.cgs @@ -0,0 +1,40 @@ +# cr16 testcase for popret count reg insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global popret2 +popret2: + movd $0x1000, (sp) + movw $0x2f50, r3 + storw r3, 0x1000 + movw $0x107e, r3 + storw r3, 0x1002 + movw $0x35ec, r3 + storw r3, 0x1004 + + movd $ok, (ra) + lshd $-1, (ra) + stord (ra), 0x1006 + + popret $3,r5 + +ok: + cmpw $0x2f50,r5 + beq ok1 + br not_ok +not_ok: + fail +ok1: + cmpw $0x107e,r6 + beq ok2 + br not_ok +ok2: + cmpw $0x35ec,r7 + beq ok3 + br not_ok + +ok3: + pass diff --git a/sim/testsuite/cr16/popret3.cgs b/sim/testsuite/cr16/popret3.cgs new file mode 100644 index 0000000..31aaa9b --- /dev/null +++ b/sim/testsuite/cr16/popret3.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for popret RA insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global popret3 +popret3: + movd $0x1006, (sp) + movd $ok, (ra) + lshd $-1, (ra) + stord (ra), 0x1006 + popret RA + +ok: + pass diff --git a/sim/testsuite/cr16/push1.cgs b/sim/testsuite/cr16/push1.cgs new file mode 100644 index 0000000..12d50a6 --- /dev/null +++ b/sim/testsuite/cr16/push1.cgs @@ -0,0 +1,41 @@ +# cr16 testcase for push count reg RA insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global push1 +push1: + movd $0x100a, (sp) + movd $0xabcd, (ra) + movw $0x2f50, r5 + movw $0x107e, r6 + movw $0x35ed, r7 + push $3,r5,RA + + loadw 0x1000, r3 + cmpw r3,r5 + beq ok1 + br not_ok +not_ok: + fail +ok1: + loadw 0x1002, r3 + cmpw r3,r6 + beq ok2 + br not_ok +ok2: + loadw 0x1004, r3 + cmpw r3,r7 + beq ok3 + br not_ok + +ok3: + loadd 0x1006, (r3,r2) + cmpd (r3,r2), (ra) + beq ok4 + br not_ok + +ok4: + pass diff --git a/sim/testsuite/cr16/push2.cgs b/sim/testsuite/cr16/push2.cgs new file mode 100644 index 0000000..76c1a37 --- /dev/null +++ b/sim/testsuite/cr16/push2.cgs @@ -0,0 +1,36 @@ +# cr16 testcase for push count reg insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global push2 +push2: + movd $0x1006, (sp) + movw $0x2f50, r5 + movw $0x107e, r6 + movw $0x35ed, r7 + push $3,r5 + + loadw 0x1000, r3 + cmpw r3,r5 + beq ok1 + br not_ok +not_ok: + fail +ok1: + loadw 0x1002, r3 + cmpw r3,r6 + beq ok2 + br not_ok +ok2: + loadw 0x1004, r3 + cmpw r3,r7 + beq ok3 + br not_ok + +ok3: + pass + + diff --git a/sim/testsuite/cr16/push3.cgs b/sim/testsuite/cr16/push3.cgs new file mode 100644 index 0000000..f9f5c26 --- /dev/null +++ b/sim/testsuite/cr16/push3.cgs @@ -0,0 +1,24 @@ +# cr16 testcase for push RA insns. +# mach: cr16 + + .include "testutils.inc" + + start + + .global push1 +push1: + movd $0x1006, (sp) + movd $0xabcd, (ra) + push RA + + + loadd 0x1002, (r3,r2) + cmpd (r3,r2), (ra) + beq ok + br not_ok +not_ok: + fail +ok: + pass + + diff --git a/sim/testsuite/cr16/sbitb.cgs b/sim/testsuite/cr16/sbitb.cgs new file mode 100644 index 0000000..b98329c --- /dev/null +++ b/sim/testsuite/cr16/sbitb.cgs @@ -0,0 +1,35 @@ +# cr16 testcase for sbitb $count, reg/regp/mem +# mach: cr16 + + .include "testutils.inc" + + start + + .global sbitb +sbitb: + sbitb $0,_y + loadw _y, r1 + cmpb $0xf1, r1 + beq ok1 +not_ok: + fail + +ok1: + movd $_y, (r1,r0) + sbitb $1,0(r1,r0) + loadw _y, r1 + cmpb $0xf3, r1 + beq ok2 + br not_ok +ok2: + + movw $_y, r1 + sbitb $2,0(r1) + loadw _y, r1 + cmpb $0xf7, r1 + beq ok3 + br not_ok +ok3: + pass + +_y: .word 0xf0 diff --git a/sim/testsuite/cr16/sbitw.cgs b/sim/testsuite/cr16/sbitw.cgs new file mode 100644 index 0000000..2a9a828 --- /dev/null +++ b/sim/testsuite/cr16/sbitw.cgs @@ -0,0 +1,35 @@ +# cr16 testcase for sbitw +# mach: cr16 + + .include "testutils.inc" + + start + + .global sbitw +sbitw: + sbitw $4,_y + loadw _y, r1 + cmpb $0x1f, r1 + beq ok1 +not_ok: + fail + +ok1: + movd $_y, (r1,r0) + sbitw $5,0(r1,r0) + loadw _y, r1 + cmpb $0x3f, r1 + beq ok2 + br not_ok +ok2: + + movw $_y, r1 + sbitw $6,0(r1) + loadw _y, r1 + cmpb $0x7f, r1 + beq ok3 + br not_ok +ok3: + pass + +_y: .word 0x0f diff --git a/sim/testsuite/cr16/scc.cgs b/sim/testsuite/cr16/scc.cgs new file mode 100644 index 0000000..ac592e0 --- /dev/null +++ b/sim/testsuite/cr16/scc.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for scc reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global scc +scc: + mvi_h_condbit 0 + movw $12, r4 + movw $10, r5 + cmpw r4, r5 + scc r3 + + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/scs.cgs b/sim/testsuite/cr16/scs.cgs new file mode 100644 index 0000000..a34e094 --- /dev/null +++ b/sim/testsuite/cr16/scs.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for scs reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global scs +scs: + mvi_h_condbit 0 + movw $12, r4 + movw $10, r5 + subw r4, r5 + scs r3 + + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/seq.cgs b/sim/testsuite/cr16/seq.cgs new file mode 100644 index 0000000..1b4ad79 --- /dev/null +++ b/sim/testsuite/cr16/seq.cgs @@ -0,0 +1,20 @@ +# cr16 testcase for seq reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global seq +seq: + mvi_h_condbit 0 + movw $12, r4 + movw $12, r5 + cmpw r4, r5 + seq r3 + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/sfc.cgs b/sim/testsuite/cr16/sfc.cgs new file mode 100644 index 0000000..1221f8e --- /dev/null +++ b/sim/testsuite/cr16/sfc.cgs @@ -0,0 +1,20 @@ +# cr16 testcase for sfc rep +# mach(): cr16 + + .include "testutils.inc" + + start + + .global sfc +sfc: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + subw r4, r5 + sfc r3 + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/sfs.cgs b/sim/testsuite/cr16/sfs.cgs new file mode 100644 index 0000000..5663bfb --- /dev/null +++ b/sim/testsuite/cr16/sfs.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for sfs reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global sfs +sfs: + mvi_h_condbit 0 + movw $0xaa, r4 + movw $0xaa, r5 + addb r4, r5 + sfs r3 + + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/sge.cgs b/sim/testsuite/cr16/sge.cgs new file mode 100644 index 0000000..7a65658 --- /dev/null +++ b/sim/testsuite/cr16/sge.cgs @@ -0,0 +1,20 @@ +# cr16 testcase for sge reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global sge +sge: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + sge r3 + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/sgt.cgs b/sim/testsuite/cr16/sgt.cgs new file mode 100644 index 0000000..cc47ea3 --- /dev/null +++ b/sim/testsuite/cr16/sgt.cgs @@ -0,0 +1,20 @@ +# cr16 testcase for sgt reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global sgt +sgt: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + sgt r3 + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/shi.cgs b/sim/testsuite/cr16/shi.cgs new file mode 100644 index 0000000..5188a51 --- /dev/null +++ b/sim/testsuite/cr16/shi.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for shi reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global shi +shi: + mvi_h_condbit 0 + movw $2, r4 + movw $1, r5 + cmpw r4, r5 + shi r3 + + cmpw $1,r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/shs.cgs b/sim/testsuite/cr16/shs.cgs new file mode 100644 index 0000000..2a10324 --- /dev/null +++ b/sim/testsuite/cr16/shs.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for shs reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global shs +shs: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + subw r4, r5 + shs r3 + + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/slo.cgs b/sim/testsuite/cr16/slo.cgs new file mode 100644 index 0000000..4e9332a --- /dev/null +++ b/sim/testsuite/cr16/slo.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for slo reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global slo +slo: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + slo r3 + + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/sls.cgs b/sim/testsuite/cr16/sls.cgs new file mode 100644 index 0000000..aab309c --- /dev/null +++ b/sim/testsuite/cr16/sls.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for sls reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global sls +sls: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + sls r3 + + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/slt.cgs b/sim/testsuite/cr16/slt.cgs new file mode 100644 index 0000000..a4fa1b5 --- /dev/null +++ b/sim/testsuite/cr16/slt.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for slt rep +# mach(): cr16 + + .include "testutils.inc" + + start + + .global slt +slt: + mvi_h_condbit 0 + movw $1, r4 + movw $2, r5 + cmpw r4, r5 + slt r3 + + cmpw $1,r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/sne.cgs b/sim/testsuite/cr16/sne.cgs new file mode 100644 index 0000000..0d2ccc5 --- /dev/null +++ b/sim/testsuite/cr16/sne.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for sne reg +# mach(): cr16 + + .include "testutils.inc" + + start + + .global sne +sne: + mvi_h_condbit 0 + movw $0, r4 + movw $1, r5 + cmpw r4, r5 + sne r3 + + cmpw $1, r3 + beq ok +not_ok: + fail +ok: + pass diff --git a/sim/testsuite/cr16/storb.cgs b/sim/testsuite/cr16/storb.cgs new file mode 100644 index 0000000..289055d --- /dev/null +++ b/sim/testsuite/cr16/storb.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for st $src1,@$src2 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global st +st: + movd $data_loc, (r4,r3) + movw $1,r5 + + storw r5, 0(r4,r3) + + loadw 0(r4,r3),r1 + test_h_gr r1, 1 + + pass + +data_loc: + .word 0 diff --git a/sim/testsuite/cr16/stord.cgs b/sim/testsuite/cr16/stord.cgs new file mode 100644 index 0000000..64f40c1 --- /dev/null +++ b/sim/testsuite/cr16/stord.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for st $src1,@$src2 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global st +st: + movd $data_loc, (r4,r3) + movd $0x12345678, (r6,r5) + + stord (r6,r5),0(r4,r3) + + loadd 0(r4,r3), (r1,r0) + test_h_grp "( r1,r0)", 0x12345678 + + pass + +data_loc: + .word 0 diff --git a/sim/testsuite/cr16/storw.cgs b/sim/testsuite/cr16/storw.cgs new file mode 100644 index 0000000..9287636 --- /dev/null +++ b/sim/testsuite/cr16/storw.cgs @@ -0,0 +1,21 @@ +# cr16 testcase for st $src1,@$src2 +# mach(): cr16 + + .include "testutils.inc" + + start + + .global st +st: + movd $data_loc, (r4,r3) + movw $0x1234,r5 + + storw r5,0(r4,r3) + + loadw 0(r4,r3),r1 + test_h_gr r1, 0x1234 + + pass + +data_loc: + .word 0 diff --git a/sim/testsuite/cr16/subb.cgs b/sim/testsuite/cr16/subb.cgs new file mode 100644 index 0000000..6a893dd --- /dev/null +++ b/sim/testsuite/cr16/subb.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for subb $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global subb +subb: + + movb $7, r4 + movb $3, r5 + + subb r5, r4 + + test_h_gr r4, 4 + + pass diff --git a/sim/testsuite/cr16/subd.cgs b/sim/testsuite/cr16/subd.cgs new file mode 100644 index 0000000..2e2a334 --- /dev/null +++ b/sim/testsuite/cr16/subd.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for subd $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global subd +subd: + + movd $0x12345678, (r4,r3) + movd $0x11111111, (r6,r5) + + subd (r6,r5), (r4,r3) + + test_h_grp "(r4,r3)", 0x1234567 + + pass diff --git a/sim/testsuite/cr16/subi.cgs b/sim/testsuite/cr16/subi.cgs new file mode 100644 index 0000000..5d0fa1a --- /dev/null +++ b/sim/testsuite/cr16/subi.cgs @@ -0,0 +1,30 @@ +# cr16 testcase for addi #$simm8, $dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global addi +addi: + + movb $1, r4 + addb $2, r4 + + cmpb $3,r4 + bne not_ok + + movw $0x1234, r5 + addw $0x1234, r5 + test_h_gr r5, 0x2468 + + pass + + movd $0x12345678, (r5,r4) + addd $0x12345678, (r5,r4) + test_h_grp "(r5,r4)", 0x2468acf0 + + pass + +not_ok: + fail diff --git a/sim/testsuite/cr16/subw.cgs b/sim/testsuite/cr16/subw.cgs new file mode 100644 index 0000000..12a1229 --- /dev/null +++ b/sim/testsuite/cr16/subw.cgs @@ -0,0 +1,18 @@ +# cr16 testcase for subw $sr,$dr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global subw +subw: + + movw $0x1234, r4 + movw $0x1111, r5 + + subw r5, r4 + + test_h_gr r4, 0x123 + + pass diff --git a/sim/testsuite/cr16/tbit.cgs b/sim/testsuite/cr16/tbit.cgs new file mode 100644 index 0000000..ac1b7e2 --- /dev/null +++ b/sim/testsuite/cr16/tbit.cgs @@ -0,0 +1,31 @@ +# cr16 testcase for tbit +# mach: cr16 + + .include "testutils.inc" + + start + + .global tbit +tbit: + movw $0, r1 + lpr r1, psr + movw $0x7, r1 + tbit $0, r1 + spr psr, r1 + cmpb $0x20, r1 + beq ok1 +not_ok: + fail + +ok1: + movw $0, r1 + lpr r1, psr + movw $0xa, r1 + movw $0x1, r2 + tbit r2,r1 + spr psr, r1 + cmpb $0x20, r1 + beq ok2 + br not_ok +ok2: + pass diff --git a/sim/testsuite/cr16/tbitb.cgs b/sim/testsuite/cr16/tbitb.cgs new file mode 100644 index 0000000..57a8ab2 --- /dev/null +++ b/sim/testsuite/cr16/tbitb.cgs @@ -0,0 +1,33 @@ +# cr16 testcase for tbitb +# mach: cr16 + + .include "testutils.inc" + + start + + .global tbitb +tbitb: + movw $0, r1 + lpr r1, psr + movw $_y, r1 + tbitb $0, 0(r1) + spr psr, r1 + cmpb $0x20, r1 + beq ok1 +not_ok: + fail + +ok1: + movw $0, r1 + lpr r1, psr + movd $_y, (r1,r0) + tbitb $1,0(r1,r0) + spr psr, r1 + cmpb $0x20, r1 + beq ok2 + br not_ok +ok2: + + pass + +_y: .word 0xf7 diff --git a/sim/testsuite/cr16/tbitw.cgs b/sim/testsuite/cr16/tbitw.cgs new file mode 100644 index 0000000..018c73e --- /dev/null +++ b/sim/testsuite/cr16/tbitw.cgs @@ -0,0 +1,33 @@ +# cr16 testcase for tbitw +# mach: cr16 + + .include "testutils.inc" + + start + + .global tbitw +tbitw: + movw $0, r1 + lpr r1, psr + tbitw $0,_y + spr psr, r1 + cmpb $0x20, r1 + beq ok1 +not_ok: + fail + +ok1: + movw $0, r1 + lpr r1, psr + movd $_y, (r1,r0) + tbitw $1,0(r1,r0) + loadw _y, r1 + spr psr, r1 + cmpb $0x20, r1 + beq ok2 + br not_ok +ok2: + + pass + +_y: .word 0xf7 diff --git a/sim/testsuite/cr16/testutils.inc b/sim/testsuite/cr16/testutils.inc new file mode 100644 index 0000000..1b82dc6 --- /dev/null +++ b/sim/testsuite/cr16/testutils.inc @@ -0,0 +1,74 @@ +# r0-r5 are used as tmps, consider them call clobbered by these macros. + + .macro START + .data +failmsg: + .ascii "fail\n" +passmsg: + .ascii "pass\n" + .text + .global _START +_START: + .global _start +_start: + .endm + + .macro exit rc + movw $\rc,r2 + movw $0x410,r0 + excp 8 + .endm + + .macro pass + movw $1, r2 + movd $passmsg,(r4,r3) + movw $5, r5 + movw $0x404, r0 + excp 8 + exit 0 + .endm + + .macro fail + movw $1, r2 + movd $failmsg,(r4,r3) + movw $5, r5 + movw $0x404, r0 + excp 8 + exit 1 + .endm + +# Other macros know this only clobbers r0. + .macro test_h_gr reg, val + movw $\val,r0 + cmpw \reg, r0 + beq test_gr + fail +test_gr: + .endm + + .macro test_h_grp regp, val + movd $\val,(r1,r0) + cmpd \regp,(r1,r0) + beq test_grp + fail +test_grp: + .endm + + + .macro mvi_h_condbit val + movw $0, r0 + movw $\val, r1 + cmpw r0, r1 + .endm + + .macro test_h_condbit val + .if \val + br test_c1 + fail +test_c1: + .else + br test_c0 + fail +test_c0: + .endif + .endm diff --git a/sim/testsuite/cr16/uread16.ms b/sim/testsuite/cr16/uread16.ms new file mode 100644 index 0000000..54253b4 --- /dev/null +++ b/sim/testsuite/cr16/uread16.ms @@ -0,0 +1,17 @@ +# mach: cr16 + + .include "testutils.inc" + + start + + .global read16 +read16: + loadw foo,r1 + cmpw $42, r1 + beq ok + fail +ok: + pass + +foo: + .word 42 diff --git a/sim/testsuite/cr16/uread32.ms b/sim/testsuite/cr16/uread32.ms new file mode 100644 index 0000000..c2181e5 --- /dev/null +++ b/sim/testsuite/cr16/uread32.ms @@ -0,0 +1,17 @@ +# mach: cr16 + + .include "testutils.inc" + + start + + .global read32 +read32: + loadd foo, (r1,r0) + cmpd $0x12345678, (r1,r0) + beq ok + fail +ok: + pass + +foo: + .long 0x12345678 diff --git a/sim/testsuite/cr16/xorb.cgs b/sim/testsuite/cr16/xorb.cgs new file mode 100644 index 0000000..4ee4b2d --- /dev/null +++ b/sim/testsuite/cr16/xorb.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for xor $dr,$sr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global xor +xor: + movb $3, r4 + movb $6, r5 + + xorb r4,r5 + + test_h_gr r5, 5 + + pass diff --git a/sim/testsuite/cr16/xord.cgs b/sim/testsuite/cr16/xord.cgs new file mode 100644 index 0000000..3bbcac0 --- /dev/null +++ b/sim/testsuite/cr16/xord.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for xor $dr,$sr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global xor +xor: + movd $0x33333333, (r4,r3) + movd $0x66666666, (r6,r5) + + xord (r4,r3), (r6,r5) + + test_h_grp "(r6,r5)", 0x55555555 + + pass diff --git a/sim/testsuite/cr16/xorw.cgs b/sim/testsuite/cr16/xorw.cgs new file mode 100644 index 0000000..d82faa3 --- /dev/null +++ b/sim/testsuite/cr16/xorw.cgs @@ -0,0 +1,17 @@ +# cr16 testcase for xor $dr,$sr +# mach(): cr16 + + .include "testutils.inc" + + start + + .global xor +xor: + movw $3, r4 + movw $6, r5 + + xorw r4, r5 + + test_h_gr r5, 5 + + pass |