URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-stable/gdb-7.2/sim/testsuite/sim/cr16
- from Rev 835 to Rev 841
- ↔ Reverse comparison
Rev 835 → Rev 841
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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 |
/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" |
/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 |
/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 |
/misc.exp
0,0 → 1,21
# Miscellaneous CR16 simulator testcases |
|
if [istarget cr16*-*-*] { |
# load support procs |
# load_lib cgen.exp |
|
# all machines |
set all_machs "cr16" |
|
|
# 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 |
} |
} |
/ChangeLog
0,0 → 1,41
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 |
ChangeLog
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: macuw.cgs
===================================================================
--- macuw.cgs (nonexistent)
+++ macuw.cgs (revision 841)
@@ -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
Index: subw.cgs
===================================================================
--- subw.cgs (nonexistent)
+++ subw.cgs (revision 841)
@@ -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
Index: mulw.cgs
===================================================================
--- mulw.cgs (nonexistent)
+++ mulw.cgs (revision 841)
@@ -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
Index: scs.cgs
===================================================================
--- scs.cgs (nonexistent)
+++ scs.cgs (revision 841)
@@ -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
Index: beq0b.cgs
===================================================================
--- beq0b.cgs (nonexistent)
+++ beq0b.cgs (revision 841)
@@ -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
Index: addb.cgs
===================================================================
--- addb.cgs (nonexistent)
+++ addb.cgs (revision 841)
@@ -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
Index: addd.cgs
===================================================================
--- addd.cgs (nonexistent)
+++ addd.cgs (revision 841)
@@ -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
Index: loadm.cgs
===================================================================
--- loadm.cgs (nonexistent)
+++ loadm.cgs (revision 841)
@@ -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
+
Index: sgt.cgs
===================================================================
--- sgt.cgs (nonexistent)
+++ sgt.cgs (revision 841)
@@ -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
Index: excp.cgs
===================================================================
--- excp.cgs (nonexistent)
+++ excp.cgs (revision 841)
@@ -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
Index: jfc.cgs
===================================================================
--- jfc.cgs (nonexistent)
+++ jfc.cgs (revision 841)
@@ -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
Index: bne.cgs
===================================================================
--- bne.cgs (nonexistent)
+++ bne.cgs (revision 841)
@@ -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
Index: loadw.cgs
===================================================================
--- loadw.cgs (nonexistent)
+++ loadw.cgs (revision 841)
@@ -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
+
Index: mulsw.cgs
===================================================================
--- mulsw.cgs (nonexistent)
+++ mulsw.cgs (revision 841)
@@ -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
Index: loadmp.cgs
===================================================================
--- loadmp.cgs (nonexistent)
+++ loadmp.cgs (revision 841)
@@ -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
+
Index: jne.cgs
===================================================================
--- jne.cgs (nonexistent)
+++ jne.cgs (revision 841)
@@ -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
Index: lshw.cgs
===================================================================
--- lshw.cgs (nonexistent)
+++ lshw.cgs (revision 841)
@@ -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
Index: cmpw_i.cgs
===================================================================
--- cmpw_i.cgs (nonexistent)
+++ cmpw_i.cgs (revision 841)
@@ -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
Index: cmpb.cgs
===================================================================
--- cmpb.cgs (nonexistent)
+++ cmpb.cgs (revision 841)
@@ -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
Index: jfs.cgs
===================================================================
--- jfs.cgs (nonexistent)
+++ jfs.cgs (revision 841)
@@ -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
Index: shi.cgs
===================================================================
--- shi.cgs (nonexistent)
+++ shi.cgs (revision 841)
@@ -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
Index: cbitb.cgs
===================================================================
--- cbitb.cgs (nonexistent)
+++ cbitb.cgs (revision 841)
@@ -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
Index: cmpd.cgs
===================================================================
--- cmpd.cgs (nonexistent)
+++ cmpd.cgs (revision 841)
@@ -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
Index: bal2_24.cgs
===================================================================
--- bal2_24.cgs (nonexistent)
+++ bal2_24.cgs (revision 841)
@@ -0,0 +1,15 @@
+# cr16 testcase for bal $disp24
+# mach(): cr16
+
+ .include "testutils.inc"
+
+ start
+
+ .global bal24
+bal24:
+ bal (r12), ok
+
+ fail
+
+ok:
+ pass
Index: bcc.cgs
===================================================================
--- bcc.cgs (nonexistent)
+++ bcc.cgs (revision 841)
@@ -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
Index: andw.cgs
===================================================================
--- andw.cgs (nonexistent)
+++ andw.cgs (revision 841)
@@ -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
Index: shs.cgs
===================================================================
--- shs.cgs (nonexistent)
+++ shs.cgs (revision 841)
@@ -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
Index: movzb.cgs
===================================================================
--- movzb.cgs (nonexistent)
+++ movzb.cgs (revision 841)
@@ -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
Index: ashuw_i.cgs
===================================================================
--- ashuw_i.cgs (nonexistent)
+++ ashuw_i.cgs (revision 841)
@@ -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
Index: jcc.cgs
===================================================================
--- jcc.cgs (nonexistent)
+++ jcc.cgs (revision 841)
@@ -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
Index: push1.cgs
===================================================================
--- push1.cgs (nonexistent)
+++ push1.cgs (revision 841)
@@ -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
Index: slt.cgs
===================================================================
--- slt.cgs (nonexistent)
+++ slt.cgs (revision 841)
@@ -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
Index: push3.cgs
===================================================================
--- push3.cgs (nonexistent)
+++ push3.cgs (revision 841)
@@ -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
+
+
Index: sbitb.cgs
===================================================================
--- sbitb.cgs (nonexistent)
+++ sbitb.cgs (revision 841)
@@ -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
Index: movb.cgs
===================================================================
--- movb.cgs (nonexistent)
+++ movb.cgs (revision 841)
@@ -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
Index: br.cgs
===================================================================
--- br.cgs (nonexistent)
+++ br.cgs (revision 841)
@@ -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
+
Index: tbitb.cgs
===================================================================
--- tbitb.cgs (nonexistent)
+++ tbitb.cgs (revision 841)
@@ -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
Index: movd.cgs
===================================================================
--- movd.cgs (nonexistent)
+++ movd.cgs (revision 841)
@@ -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
Index: bcs.cgs
===================================================================
--- bcs.cgs (nonexistent)
+++ bcs.cgs (revision 841)
@@ -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
Index: bgt.cgs
===================================================================
--- bgt.cgs (nonexistent)
+++ bgt.cgs (revision 841)
@@ -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
Index: jcs.cgs
===================================================================
--- jcs.cgs (nonexistent)
+++ jcs.cgs (revision 841)
@@ -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
Index: jgt.cgs
===================================================================
--- jgt.cgs (nonexistent)
+++ jgt.cgs (revision 841)
@@ -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
Index: bal1_24.cgs
===================================================================
--- bal1_24.cgs (nonexistent)
+++ bal1_24.cgs (revision 841)
@@ -0,0 +1,15 @@
+# cr16 testcase for bal $disp24
+# mach(): cr16
+
+ .include "testutils.inc"
+
+ start
+
+ .global bal24
+bal24:
+ bal (ra), ok
+
+ fail
+
+ok:
+ pass
Index: lshw_i.cgs
===================================================================
--- lshw_i.cgs (nonexistent)
+++ lshw_i.cgs (revision 841)
@@ -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
Index: seq.cgs
===================================================================
--- seq.cgs (nonexistent)
+++ seq.cgs (revision 841)
@@ -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
Index: cmpb_i.cgs
===================================================================
--- cmpb_i.cgs (nonexistent)
+++ cmpb_i.cgs (revision 841)
@@ -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
Index: storb.cgs
===================================================================
--- storb.cgs (nonexistent)
+++ storb.cgs (revision 841)
@@ -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
Index: popret1.cgs
===================================================================
--- popret1.cgs (nonexistent)
+++ popret1.cgs (revision 841)
@@ -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
Index: stord.cgs
===================================================================
--- stord.cgs (nonexistent)
+++ stord.cgs (revision 841)
@@ -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
Index: nop.cgs
===================================================================
--- nop.cgs (nonexistent)
+++ nop.cgs (revision 841)
@@ -0,0 +1,11 @@
+# cr16 testcase for nop
+# mach(): cr16
+
+ .include "testutils.inc"
+
+ start
+
+ .global nop
+nop:
+ nop
+ pass
Index: popret3.cgs
===================================================================
--- popret3.cgs (nonexistent)
+++ popret3.cgs (revision 841)
@@ -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
Index: bhi.cgs
===================================================================
--- bhi.cgs (nonexistent)
+++ bhi.cgs (revision 841)
@@ -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
Index: muluw.cgs
===================================================================
--- muluw.cgs (nonexistent)
+++ muluw.cgs (revision 841)
@@ -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
Index: xorb.cgs
===================================================================
--- xorb.cgs (nonexistent)
+++ xorb.cgs (revision 841)
@@ -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
Index: jhi.cgs
===================================================================
--- jhi.cgs (nonexistent)
+++ jhi.cgs (revision 841)
@@ -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
Index: ashub_i.cgs
===================================================================
--- ashub_i.cgs (nonexistent)
+++ ashub_i.cgs (revision 841)
@@ -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
Index: xord.cgs
===================================================================
--- xord.cgs (nonexistent)
+++ xord.cgs (revision 841)
@@ -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
Index: bhs.cgs
===================================================================
--- bhs.cgs (nonexistent)
+++ bhs.cgs (revision 841)
@@ -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
Index: pop1.cgs
===================================================================
--- pop1.cgs (nonexistent)
+++ pop1.cgs (revision 841)
@@ -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
Index: blt.cgs
===================================================================
--- blt.cgs (nonexistent)
+++ blt.cgs (revision 841)
@@ -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
Index: pop3.cgs
===================================================================
--- pop3.cgs (nonexistent)
+++ pop3.cgs (revision 841)
@@ -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
+
+
Index: jhs.cgs
===================================================================
--- jhs.cgs (nonexistent)
+++ jhs.cgs (revision 841)
@@ -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
Index: jlt.cgs
===================================================================
--- jlt.cgs (nonexistent)
+++ jlt.cgs (revision 841)
@@ -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
Index: subb.cgs
===================================================================
--- subb.cgs (nonexistent)
+++ subb.cgs (revision 841)
@@ -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
Index: subd.cgs
===================================================================
--- subd.cgs (nonexistent)
+++ subd.cgs (revision 841)
@@ -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
Index: mulb.cgs
===================================================================
--- mulb.cgs (nonexistent)
+++ mulb.cgs (revision 841)
@@ -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
Index: lshb_i.cgs
===================================================================
--- lshb_i.cgs (nonexistent)
+++ lshb_i.cgs (revision 841)
@@ -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
Index: tbit.cgs
===================================================================
--- tbit.cgs (nonexistent)
+++ tbit.cgs (revision 841)
@@ -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
Index: jal.cgs
===================================================================
--- jal.cgs (nonexistent)
+++ jal.cgs (revision 841)
@@ -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
Index: beq.cgs
===================================================================
--- beq.cgs (nonexistent)
+++ beq.cgs (revision 841)
@@ -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
Index: orw.cgs
===================================================================
--- orw.cgs (nonexistent)
+++ orw.cgs (revision 841)
@@ -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
Index: macqw.cgs
===================================================================
--- macqw.cgs (nonexistent)
+++ macqw.cgs (revision 841)
@@ -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
Index: uread16.ms
===================================================================
--- uread16.ms (nonexistent)
+++ uread16.ms (revision 841)
@@ -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
Index: jump.cgs
===================================================================
--- jump.cgs (nonexistent)
+++ jump.cgs (revision 841)
@@ -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
Index: bne0w.cgs
===================================================================
--- bne0w.cgs (nonexistent)
+++ bne0w.cgs (revision 841)
@@ -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
Index: sge.cgs
===================================================================
--- sge.cgs (nonexistent)
+++ sge.cgs (revision 841)
@@ -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
Index: jeq.cgs
===================================================================
--- jeq.cgs (nonexistent)
+++ jeq.cgs (revision 841)
@@ -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
Index: movxw.cgs
===================================================================
--- movxw.cgs (nonexistent)
+++ movxw.cgs (revision 841)
@@ -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
Index: loadb.cgs
===================================================================
--- loadb.cgs (nonexistent)
+++ loadb.cgs (revision 841)
@@ -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
+
Index: mulsb.cgs
===================================================================
--- mulsb.cgs (nonexistent)
+++ mulsb.cgs (revision 841)
@@ -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
Index: loadd.cgs
===================================================================
--- loadd.cgs (nonexistent)
+++ loadd.cgs (revision 841)
@@ -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
+
Index: ashuw.cgs
===================================================================
--- ashuw.cgs (nonexistent)
+++ ashuw.cgs (revision 841)
@@ -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
Index: lshb.cgs
===================================================================
--- lshb.cgs (nonexistent)
+++ lshb.cgs (revision 841)
@@ -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
Index: lshd.cgs
===================================================================
--- lshd.cgs (nonexistent)
+++ lshd.cgs (revision 841)
@@ -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
Index: lpr-spr.cgs
===================================================================
--- lpr-spr.cgs (nonexistent)
+++ lpr-spr.cgs (revision 841)
@@ -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
Index: addi.cgs
===================================================================
--- addi.cgs (nonexistent)
+++ addi.cgs (revision 841)
@@ -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
Index: andb.cgs
===================================================================
--- andb.cgs (nonexistent)
+++ andb.cgs (revision 841)
@@ -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
Index: andd.cgs
===================================================================
--- andd.cgs (nonexistent)
+++ andd.cgs (revision 841)
@@ -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
Index: lprd-sprd.cgs
===================================================================
--- lprd-sprd.cgs (nonexistent)
+++ lprd-sprd.cgs (revision 841)
@@ -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
Index: beq0w.cgs
===================================================================
--- beq0w.cgs (nonexistent)
+++ beq0w.cgs (revision 841)
@@ -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
Index: addw.cgs
===================================================================
--- addw.cgs (nonexistent)
+++ addw.cgs (revision 841)
@@ -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
Index: cmpi.cgs
===================================================================
--- cmpi.cgs (nonexistent)
+++ cmpi.cgs (revision 841)
@@ -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
Index: bge.cgs
===================================================================
--- bge.cgs (nonexistent)
+++ bge.cgs (revision 841)
@@ -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
Index: slo.cgs
===================================================================
--- slo.cgs (nonexistent)
+++ slo.cgs (revision 841)
@@ -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
Index: push2.cgs
===================================================================
--- push2.cgs (nonexistent)
+++ push2.cgs (revision 841)
@@ -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
+
+
Index: sls.cgs
===================================================================
--- sls.cgs (nonexistent)
+++ sls.cgs (revision 841)
@@ -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
Index: jge.cgs
===================================================================
--- jge.cgs (nonexistent)
+++ jge.cgs (revision 841)
@@ -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
Index: cmpw.cgs
===================================================================
--- cmpw.cgs (nonexistent)
+++ cmpw.cgs (revision 841)
@@ -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
Index: cbitw.cgs
===================================================================
--- cbitw.cgs (nonexistent)
+++ cbitw.cgs (revision 841)
@@ -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
Index: macsw.cgs
===================================================================
--- macsw.cgs (nonexistent)
+++ macsw.cgs (revision 841)
@@ -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
Index: allinsn.exp
===================================================================
--- allinsn.exp (nonexistent)
+++ allinsn.exp (revision 841)
@@ -0,0 +1,22 @@
+# CR16 simulator testsuite.
+
+
+if [istarget cr16*-*-*] {
+ # load support procs
+ # load_lib cgen.exp
+
+ # all machines
+ set all_machs "cr16"
+
+
+ # 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
+ }
+}
Index: movzw.cgs
===================================================================
--- movzw.cgs (nonexistent)
+++ movzw.cgs (revision 841)
@@ -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
Index: sbitw.cgs
===================================================================
--- sbitw.cgs (nonexistent)
+++ sbitw.cgs (revision 841)
@@ -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
Index: movw.cgs
===================================================================
--- movw.cgs (nonexistent)
+++ movw.cgs (revision 841)
@@ -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
Index: tbitw.cgs
===================================================================
--- tbitw.cgs (nonexistent)
+++ tbitw.cgs (revision 841)
@@ -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
Index: popret2.cgs
===================================================================
--- popret2.cgs (nonexistent)
+++ popret2.cgs (revision 841)
@@ -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
Index: cmpd_i.cgs
===================================================================
--- cmpd_i.cgs (nonexistent)
+++ cmpd_i.cgs (revision 841)
@@ -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
Index: testutils.inc
===================================================================
--- testutils.inc (nonexistent)
+++ testutils.inc (revision 841)
@@ -0,0 +1,72 @@
+# 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:
+ .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