OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gdb/gdb-6.8/gdb-6.8.openrisc-2.1/sim/testsuite/sim/sh64/compact
    from Rev 24 to Rev 33
    Reverse comparison

Rev 24 → Rev 33

/fmac.cgs
0,0 → 1,78
# sh testcase for fmac -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
# 0.0 * x + y = y.
 
fldi0 fr0
fldi1 fr1
fldi1 fr2
fmac fr0, fr1, fr2
# check result.
fldi1 fr0
fcmp/eq fr0, fr2
bf wrong
 
# x * y + 0.0 = x * y.
 
fldi1 fr0
fldi1 fr1
fldi0 fr2
# double it.
fadd fr1, fr2
fmac fr0, fr1, fr2
# check result.
fldi1 fr0
fadd fr0, fr0
fcmp/eq fr0, fr2
bf wrong
# x * 0.0 + y = y.
 
fldi1 fr0
fldi0 fr1
fldi1 fr2
fadd fr2, fr2
fmac fr0, fr1, fr2
# check result.
fldi1 fr0
# double fr0.
fadd fr0, fr0
fcmp/eq fr0, fr2
bf wrong
 
# x * 0.0 + 0.0 = 0.0
 
fldi1 fr0
fadd fr0, fr0
fldi0 fr1
fldi0 fr2
fmac fr0, fr1, fr2
# check result.
fldi0 fr0
fcmp/eq fr0, fr2
bf wrong
 
# 0.0 * x + 0.0 = 0.0.
 
fldi0 fr0
fldi1 fr1
# double it.
fadd fr1, fr1
fldi0 fr2
fmac fr0, fr1, fr2
# check result.
fldi0 fr0
fcmp/eq fr0, fr2
bf wrong
 
okay:
pass
 
wrong:
fail
/cmpstr.cgs
0,0 → 1,148
# sh testcase for cmp/str $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
.macro rot8
rotr r0
rotr r0
rotr r0
rotr r0
rotr r0
rotr r0
rotr r0
rotr r0
.endm
 
start
 
# Use multiple "wrong" labels because this program is quite long. It's
# likely that some instructions will be too far away from the branch
# target to use PC-relative branches.
match0:
# No bytes matching.
mov #1, r0
neg r0, r0
xor #170, r0
rot8
xor #170, r0
rot8
xor #170, r0
rot8
xor #170, r0
rot8
mov r0, r1
mov #1, r0
neg r0, r0
xor #85, r0
rot8
xor #85, r0
rot8
xor #85, r0
rot8
xor #85, r0
rot8
cmp/str r0, r1
bt wrong0
 
bra match1
nop
wrong0:
fail
 
match1:
# One byte matching.
mov #1, r0
neg r0, r0
xor #170, r0
rot8
xor #170, r0
rot8
xor #170, r0
rot8
mov r0, r1
mov #1, r0
neg r0, r0
xor #85, r0
rot8
xor #85, r0
rot8
xor #85, r0
rot8
cmp/str r0, r1
bf wrong1
 
bra match2
nop
wrong1:
fail
 
match2:
# Two bytes matching.
mov #1, r0
neg r0, r0
xor #170, r0
rot8
xor #170, r0
rot8
mov r0, r1
mov #1, r0
neg r0, r0
xor #85, r0
rot8
xor #85, r0
rot8
cmp/str r0, r1
bf wrong2
 
bra match3
nop
wrong2:
fail
byte0:
match3:
# One byte matching.
# This is also the test for byte 0.
mov #85, r0
mov #85, r1
cmp/str r0, r1
bf wrong3
 
byte1:
# Match in byte position 1.
mov #85, r0
shll8 r0
mov #85, r1
shll8 r1
cmp/str r0, r1
bf wrong3
 
byte2:
# Match in byte position 2.
mov #85, r0
shll16 r0
mov #85, r1
shll16 r1
cmp/str r0, r1
bf wrong3
 
byte3:
# Match in byte position 3.
mov #85, r0
shll16 r0
shll8 r0
mov #85, r1
shll16 r1
shll8 r1
cmp/str r0, r1
bf wrong3
 
okay:
pass
wrong3:
fail
/xor.cgs
0,0 → 1,70
# sh testcase for xor $rm64, $rn64 -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global xor
xor:
# 0 (+) 1 = 1.
mov #0, r0
mov #1, r1
xor r0, r1
assert r1, #1
 
xor2:
# 1 (+) 0 = 0.
mov #1, r0
mov #0, r1
xor r0, r1
assert r1, #1
 
xor3:
# 0 (+) 0 = 0.
mov #0, r0
mov #0, r1
xor r0, r1
assert r1, #0
 
xor4:
# 0 (+) 0 = 0.
mov #0, r0
xor r0, r0
assert r0, #0
 
xor5:
mov #0, r0
or #85, r0
shll16 r0
or #170, r0
mov r0, r1
mov #0, r0
or #85, r0
shll16 r0
or #170, r0
xor r1, r0
assert r0, #0
 
xor6:
mov #0, r0
or #85, r0
shll16 r0
or #170, r0
mov r0, r1
mov #0, r0
or #85, r0
shll16 r0
or #12, r0
xor r0, r1
mov #0, r0
or #166, r0
cmp/eq r0, r1
bf wrong
 
okay:
pass
wrong:
fail
/ocbi.cgs
0,0 → 1,14
# sh testcase for ocbi @$rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
.global ocbi
ocbi:
ocbi @r0
ocbi @r1
ocbi @r15
pass
/cmpeqi.cgs
0,0 → 1,39
# sh testcase for cmp/eq #$imm8, r0 -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
zeroes:
mov #0, r0
cmp/eq #0, r0
bf wrong
zero1:
mov #0, r0
cmp/eq #1, r0
bt wrong
zero2:
mov #1, r0
cmp/eq #0, r0
bt wrong
equal:
mov #192, r0
cmp/eq #192, r0
bf wrong
sign:
mov #255, r0
cmp/eq #255, r0
bf wrong
okay:
pass
 
wrong:
fail
/xori.cgs
0,0 → 1,50
# sh testcase for xor #$imm8, r0 -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global xori
xori:
# 0 (+) 1 = 1.
mov #0, r0
xor #1, r0
assert r0, #1
 
xori2:
# 1 (+) 0 = 1.
mov #1, r0
xor #0, r0
assert r0, #1
 
xori3:
# 1 (+) 1 = 0.
mov #1, r0
xor #1, r0
assert r0, #0
 
xori4:
# 255 (+) 255 = 0.
mov #0, r0
or #255, r0
xor #255, r0
assert r0, #0
 
xori5:
# 0 (+) 255 = 255.
mov #0, r0
xor #255, r0
mov r0, r1
 
mov #0, r0
or #255, r0
cmp/eq r0, r1
bf wrong
 
okay:
pass
wrong:
fail
/orb.cgs
0,0 → 1,24
# sh testcase for or.b #$imm8, @(r0, gbr) -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global orb
init:
# Init GBR and R0.
mov #30, r0
ldc r0, gbr
mov #40, r0
 
orb:
or.b #0, @(r0, gbr)
or.b #170, @(r0, gbr)
or.b #0, @(r0, gbr)
or.b #255, @(r0, gbr)
 
okay:
pass
/movb2.cgs
0,0 → 1,34
# sh testcase for mov.b $rm, @-$rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
mov #40, r1
shll8 r1
mov #55, r2
# Save ADDR, DATA.
mov r1, r7
mov r2, r8
 
# Do the move.
mov.b r2, @-r1
# Load the value back into r3.
mov.b @r1, r3
cmp/eq r2, r3
bf wrong
 
# Ensure that r1 has been decremented.
mov #1, r0
sub r0, r7
cmp/eq r7, r1
bf wrong
 
okay:
pass
wrong:
fail
/div0s.cgs
0,0 → 1,52
# sh testcase for div0s $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
init:
mov #0, r0
mov #3, r1
mov #4, r2
neg r1, r3
neg r2, r4
 
perm1:
div0s r0, r0
bt wrong
div0s r0, r1
bt wrong
div0s r1, r0
bt wrong
 
perm2:
div0s r0, r4
bf wrong
div0s r4, r0
bf wrong
 
perm3:
div0s r1, r2
bt wrong
div0s r2, r1
bt wrong
 
perm4:
div0s r3, r4
bt wrong
div0s r4, r3
bt wrong
 
perm5:
div0s r1, r1
bt wrong
div0s r3, r3
bt wrong
 
okay:
pass
 
wrong:
fail
/ldcl-gbr.cgs
0,0 → 1,28
# sh testcase for ldc.l @${rn}+, gbr -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global ldcl
ldcl:
mov #40, r0
shll8 r0
# Preserve address.
mov r0, r1
ldc.l @r0+, gbr
 
# Add 4 to saved address (r1).
# Then compare with r0.
add #4, r1
cmp/eq r0, r1
bf wrong
 
okay:
pass
 
wrong:
fail
/div0u.cgs
0,0 → 1,21
# sh testcase for div0u -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global div0u
div0u:
div0u
# Can't easily test Q and M (other than visually inspecting
# the simulator's trace output).
bt wrong
 
okay:
pass
 
wrong:
fail
/movb4.cgs
0,0 → 1,28
# sh testcase for mov.b r0, @($imm8, gbr) -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
mov #0, r0
or #170, r0
mov r0, r3
mov #30, r2
ldc r2, gbr
mov.b r0, @(40, gbr)
 
# Load the value back into a different register.
mov.b @(40, gbr), r0
# Check the lowest order byte matches the stored value.
and #255, r0
cmp/eq r0, r3
bf wrong
 
okay:
pass
 
wrong:
fail
/bts.cgs
0,0 → 1,28
# sh testcase for bt/s $disp8 -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global taken
taken:
sett
bt/s ntaken
slot1:
nop
fail
.global ntaken
ntaken:
clrt
bt/s bad
slot2:
nop
pass
bad:
fail
fail
fail
fail
/movb6.cgs
0,0 → 1,26
# sh testcase for mov.b @$rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
mov #30, r2
shll8 r2
# Store something first.
mov #0, r0
or #170, r0
mov r0, r7
mov.b r7, @r2
# Load it back.
mov.b @r2, r1
mov r1, r0
and #255, r0
cmp/eq r7, r0
bf wrong
 
okay:
pass
wrong:
fail
/tasb.cgs
0,0 → 1,26
# sh testcase for tas.b @$rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
tasb1:
mov #40, r0
shll8 r0
tas.b @r0
bf wrong
 
tasb2:
mov #40, r0
shll8 r0
tas.b @r0
bt wrong
 
okay:
pass
 
wrong:
fail
/shld.cgs
0,0 → 1,48
# sh testcase for shld $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global null
null:
mov #1, r0
mov #0, r1
shld r1, r0
# no shift is performed.
assert r0, #1
 
.global gt0
gt0:
mov #4, r0
mov #3, r1
shld r1, r0
# shift left 3 bits.
assert r0, #32
 
.global lt0
lt0:
mov #32, r0
mov #3, r1
neg r1, r1
shld r1, r0
# shift right 3 bits.
assert r0, #4
 
.global fill
fill:
mov #1, r0
rotr r0
mov #1, r1
rotr r1
shld r1, r0
assert r0, #0
okay:
pass
wrong:
fail
/stsl-mach.cgs
0,0 → 1,42
# sh testcase for sts.l mach, @-$rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global stsl_mach
stsl_mach:
# Build up a distinctive bit pattern.
mov #1, r0
shll8 r0
add #12, r0
shll8 r0
add #85, r0
shll8 r0
add #170, r0
lds r0, mach
mov #40, r2
shll8 r2
# Preserve r2.
mov r2, r7
sts.l mach, @-r2
 
# check results.
mov.l @r2, r3
cmp/eq r0, r3
bf wrong
 
# Ensure decrement occurred.
add #4, r2
cmp/eq r2, r7
bf wrong
 
okay:
pass
wrong:
fail
/movb8.cgs
0,0 → 1,27
# sh testcase for mov.b @(r0, $rm), $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
mov #30, r0
shll8 r0
mov #14, r1
# Store something there first.
mov #0, r0
or #170, r0
mov r0, r7
mov.b r7, @(r0, r1)
# Load it back.
mov.b @(r0, r1), r2
mov r2, r0
and #255, r0
cmp/eq r0, r7
bf wrong
 
okay:
pass
wrong:
fail
/subc.cgs
0,0 → 1,109
# sh testcase for subc $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
zero:
mov #0, r0
mov #0, r1
clrt
subc r0, r1
assert r1, #0
 
zerot:
mov #0, r0
mov #0, r1
sett
subc r0, r1
# Invert all 1's to all 0's for ease of comparison.
not r1, r1
assert r1, #0
 
null:
mov #0, r0
mov #10, r1
clrt
subc r0, r1
assert r1, #10
 
nullt:
mov #0, r0
mov #10, r1
sett
subc r0, r1
assert r1, #9
 
subc:
mov #10, r0
mov #0, r1
clrt
subc r0, r1
# Again, invert ..
not r1, r1
assert r1, #9
 
subct:
mov #10, r0
mov #0, r1
sett
subc r0, r1
# Again, invert ..
not r1, r1
assert r1, #10
 
subc2:
mov #10, r0
mov #20, r1
clrt
subc r0, r1
assert r1, #10
 
subc2t:
mov #20, r0
mov #10, r1
sett
subc r0, r1
# Again, invert ..
not r1, r1
assert r1, #10
 
subc3:
mov #5, r0
mov #5, r1
clrt
subc r0, r1
assert r1, #0
 
subc3t:
mov #5, r0
mov #5, r1
sett
subc r0, r1
# Again, invert ..
not r1, r1
assert r1, #0
large:
mov #2, r0
mov #10, r1
clrt
subc r1, r0
# Again, invert ..
not r0, r0
assert r0, #7
 
larget:
mov #2, r0
mov #10, r1
sett
subc r0, r1
assert r1, #7
 
okay:
pass
 
wrong:
fail
/fsqrt.cgs
0,0 → 1,93
# sh testcase for fsqrt -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
# sqrt(0.0) = 0.0.
fldi0 fr0
fsqrt fr0
fldi0 fr1
fcmp/eq fr0, fr1
bf wrong
 
# sqrt(1.0) = 1.0.
fldi1 fr0
fsqrt fr0
fldi1 fr1
fcmp/eq fr0, fr1
bf wrong
 
# sqrt(4.0) = 2.0
fldi1 fr0
# Double it.
fadd fr0, fr0
# Double it again.
fadd fr0, fr0
fsqrt fr0
fldi1 fr1
# Double it.
fadd fr1, fr1
fcmp/eq fr0, fr1
bf wrong
 
bra double
nop
 
wrong:
fail
 
double:
# sqrt(0.0) = 0.0.
fldi0 fr0
_s2d fr0, dr0
_setpr
fsqrt dr0
_clrpr
fldi0 fr2
_s2d fr2, dr2
_setpr
fcmp/eq dr0, dr2
bf wrong2
_clrpr
 
# sqrt(1.0) = 1.0.
fldi1 fr0
_s2d fr0, dr0
_setpr
fsqrt dr0
_clrpr
fldi1 fr2
_s2d fr2, dr2
_setpr
fcmp/eq fr0, fr2
bf wrong2
_clrpr
 
# sqrt(4.0) = 2.0.
fldi1 fr0
# Double it.
fadd fr0, fr0
# Double it again.
fadd fr0, fr0
_s2d fr0, dr0
_setpr
fsqrt dr0
_clrpr
fldi1 fr2
# Double it.
fadd fr2, fr2
_s2d fr2, dr2
_setpr
fcmp/eq fr0, fr2
bf wrong2
_clrpr
 
okay:
pass
 
wrong2:
fail
/stsl-macl.cgs
0,0 → 1,42
# sh testcase for sts.l macl, @-$rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global stsl_macl
stsl_macl:
# Build up a distinctive bit pattern.
mov #1, r0
shll8 r0
add #12, r0
shll8 r0
add #85, r0
shll8 r0
add #170, r0
lds r0, macl
mov #40, r2
shll8 r2
# Preserve r2.
mov r2, r7
sts.l macl, @-r2
 
# check results.
mov.l @r2, r3
cmp/eq r0, r3
bf wrong
 
# Ensure decrement occurred.
add #4, r2
cmp/eq r2, r7
bf wrong
 
okay:
pass
wrong:
fail
/stsl-fpscr.cgs
0,0 → 1,28
# sh testcase for sts.l fpscr, @-$rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global stsl_fpscr
stsl_fpscr:
mov #40, r0
shll8 r0
# Preserve r0.
mov r0, r7
sts.l fpscr, @-r0
 
check:
# Ensure r0 is decremented.
add #4, r0
cmp/eq r0, r7
bf wrong
 
okay:
pass
wrong:
fail
/stc-gbr.cgs
0,0 → 1,21
# sh testcase for stc gbr, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global stc_gbr
stc_gbr:
stc gbr, r1
mov #42, r1
ldc r1, gbr
stc gbr, r2
cmp/eq r1, r2
bf wrong
okay:
pass
wrong:
fail
/shll.cgs
0,0 → 1,57
# sh testcase for shll $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global shll
shll:
mov #1, r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
shll r1
assert r1, #0
another:
mov #1, r1
shll r1
shll r1
shll r1
assert r1, #8
 
okay:
pass
wrong:
fail
/fmul.cgs
0,0 → 1,121
# sh testcase for fmul -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
.macro init
fldi0 fr0
fldi1 fr1
fldi1 fr2
fadd fr2, fr2
fldi0 fr7
fldi1 fr8
.endm
 
start
 
# 0.0 * 0.0 = 0.0.
init
fmul fr0, fr0
fcmp/eq fr7, fr0
bf wrong
 
# 0.0 * 1.0 = 0.0.
init
fmul fr1, fr0
fcmp/eq fr7, fr0
bf wrong
 
# 1.0 * 0.0 = 0.0.
init
fmul fr0, fr1
fcmp/eq fr7, fr1
bf wrong
 
# 1.0 * 1.0 = 1.0.
init
fmul fr1, fr1
fcmp/eq fr8, fr1
bf wrong
 
# 2.0 * 1.0 = 2.0.
init
fmul fr2, fr1
fcmp/eq fr2, fr1
bf wrong
 
bra double
nop
 
wrong:
fail
.macro dinit
fldi0 fr0
fldi1 fr2
fldi1 fr4
fadd fr4, fr4
fldi0 fr8
fldi1 fr10
_s2d fr0, dr0
_s2d fr2, dr2
_s2d fr4, dr4
_s2d fr8, dr8
_s2d fr10, dr10
.endm
double:
# 0.0 * 0.0 = 0.0.
dinit
_setpr
fmul dr0, dr0
fcmp/eq dr8, dr0
bf wrong
_clrpr
 
# 0.0 * 1.0 = 0.0.
dinit
_setpr
fmul dr2, dr0
fcmp/eq dr8, dr0
bf wrong2
_clrpr
 
# 1.0 * 0.0 = 0.0.
dinit
_setpr
fmul dr0, dr2
fcmp/eq dr8, dr2
bf wrong2
_clrpr
 
bra next
nop
 
wrong2:
fail
 
next:
# 1.0 * 1.0 = 1.0.
dinit
_setpr
fmul dr2, dr2
fcmp/eq dr10, dr2
bf wrong3
_clrpr
 
# 2.0 * 1.0 = 2.0.
dinit
_setpr
fmul dr4, dr2
fcmp/eq dr4, dr2
bf wrong3
_clrpr
 
okay:
pass
 
wrong3:
fail
/shlr.cgs
0,0 → 1,33
# sh testcase for shlr $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global shlr
shlr:
mov #0, r0
or #192, r0
shlr r0
shlr r0
shlr r0
shlr r0
shlr r0
shlr r0
# Make sure a bit is shifted into T.
shlr r0
bf wrong
# Ditto.
shlr r0
bf wrong
shlr r0
assert r0, #0
 
okay:
pass
 
wrong:
fail
/rts.cgs
0,0 → 1,24
# sh testcase for rts -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
.global rts
rts:
bsr subroutine
slot:
nop
return:
pass
fail
 
subroutine:
rts
rts_slot:
nop
bad:
fail
/cmpgt.cgs
0,0 → 1,69
# sh testcase for cmp/gt $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32
 
.include "compact/testutils.inc"
 
start
 
zero:
mov #0, r0
mov #0, r1
cmp/gt r0, r1
bt wrong
 
onezero:
mov #1, r0
mov #0, r1
cmp/gt r0, r1
bt wrong
 
zeroone:
mov #0, r0
mov #1, r1
cmp/gt r0, r1
bf wrong
equal:
mov #192, r0
mov #192, r1
cmp/gt r0, r1
bt wrong
 
eqlarge:
mov #1, r0
rotr r0
add #85, r0
mov #1, r1
rotr r1
add #85, r1
cmp/gt r0, r1
bt wrong
large2:
mov #1, r0
rotr r0
add #85, r0
mov #1, r1
rotr r1
add #84, r1
cmp/gt r0, r1
bt wrong
 
large3:
mov #1, r0
rotr r0
add #84, r0
mov #1, r1
rotr r1
add #85, r1
cmp/gt r0, r1
bf wrong
 
okay:
pass
 
wrong:
fail
/ChangeLog
0,0 → 1,26
2002-01-09 Ben Elliston <bje@redhat.com>
 
* macl.cgs: For good measure, clear the S bit at startup.
 
2001-01-11 Ben Elliston <bje@redhat.com>
 
* fmov.cgs (f13b): Compare R0 with R1, not R2, when testing that
the source register was correctly post-incremented.
 
2000-12-01 Ben Elliston <bje@redhat.com>
 
* *.cgs (ld): Link tests with -m shelf32.
 
2000-11-24 Ben Elliston <bje@redhat.com>
 
* fmov.cgs: New test case.
* ftrv.cgs: Populate the matrix with meaningful values.
 
2000-11-22 Ben Elliston <bje@redhat.com>
 
* *.cgs (as): Assemble tests with -isa=shcompact.
 
2000-11-16 Ben Elliston <bje@redhat.com>
 
* *.cgs: New test cases.
 
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: extuw.cgs =================================================================== --- extuw.cgs (nonexistent) +++ extuw.cgs (revision 33) @@ -0,0 +1,31 @@ +# sh testcase for extu.w $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global extuw +extuw: + mov #42, r1 + extu.w r1, r2 + assert r2, #42 + +another: + mov #0, r0 + or #255, r0 + shll8 r0 + extu.w r0, r1 + mov #0, r0 + or #255, r0 + shll8 r0 + cmp/eq r0, r1 + bf wrong + +okay: + pass + +wrong: + fail Index: shad.cgs =================================================================== --- shad.cgs (nonexistent) +++ shad.cgs (revision 33) @@ -0,0 +1,58 @@ +# sh testcase for shad $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global null +null: + mov #1, r0 + mov #0, r1 + shad r1, r0 + # no shift is performed. + assert r0, #1 + + .global gt0 +gt0: + mov #4, r0 + mov #3, r1 + shad r1, r0 + # shift left 3 bits. + assert r0, #32 + + .global lt0 +lt0: + mov #32, r0 + mov #3, r1 + neg r1, r1 + shad r1, r0 + # shift right 3 bits. + assert r0, #4 + + .global fillpos +fillpos: + mov #1, r0 + mov #1, r1 + rotr r1 + shad r1, r0 + # check result. + assert r0, #0 + + .global fillneg +fillneg: + mov #1, r0 + neg r0, r0 + mov #1, r1 + rotr r1 + shad r1, r0 + # check result. + not r0, r0 + assert r0, #0 + +okay: + pass +wrong: + fail Index: fcnvsd.cgs =================================================================== --- fcnvsd.cgs (nonexistent) +++ fcnvsd.cgs (revision 33) @@ -0,0 +1,27 @@ +# sh testcase for fcnvsd -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + fldi1 fr0 + flds fr0, fpul + _setpr + fcnvsd fpul, dr2 + _clrpr + + # Convert back. + _setpr + fcnvds dr2, fpul + _clrpr + fsts fpul, fr1 + fcmp/eq fr0, fr1 + bf wrong + +okay: + pass + +wrong: + fail Index: jmp.cgs =================================================================== --- jmp.cgs (nonexistent) +++ jmp.cgs (revision 33) @@ -0,0 +1,29 @@ +# sh testcase for jmp @$rn +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global jmp +jmp: + # Load 0x1010 into r0. + mov #1, r0 + shll8 r0 + shll2 r0 + shll2 r0 + add #16, r0 + jmp @r0 +slot: + nop +bad: + fail +okay: + pass +alsobad: + fail + fail + fail + Index: shal.cgs =================================================================== --- shal.cgs (nonexistent) +++ shal.cgs (revision 33) @@ -0,0 +1,57 @@ +# sh testcase for shal $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shal +shal: + mov #1, r1 + shal r1 + assert r1, #2 + shal r1 + assert r1, #4 + shal r1 + assert r1, #8 + shal r1 + assert r1, #16 + shal r1 + assert r1, #32 + shal r1 + assert r1, #64 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + shal r1 + assert r1, #0 + +okay: + pass +wrong: + fail + Index: lds-mach.cgs =================================================================== --- lds-mach.cgs (nonexistent) +++ lds-mach.cgs (revision 33) @@ -0,0 +1,23 @@ +# sh testcase for lds $rn, mach +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global lds_mach +lds_mach: + mov #41, r0 + shll8 r0 + lds r0, mach +readback: + sts mach, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: flds.cgs =================================================================== --- flds.cgs (nonexistent) +++ flds.cgs (revision 33) @@ -0,0 +1,26 @@ +# sh testcase for flds -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + fldi0 fr0 + flds fr0, fpul + fsts fpul, fr1 + fcmp/eq fr0, fr1 + bf wrong + + fldi1 fr0 + flds fr0, fpul + fsts fpul, fr1 + fcmp/eq fr0, fr1 + bf wrong + +okay: + pass + +wrong: + fail Index: movw10.cgs =================================================================== --- movw10.cgs (nonexistent) +++ movw10.cgs (revision 33) @@ -0,0 +1,32 @@ +# sh testcase for mov.w @($imm8x2, pc), $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + + # Store to memory. + mov #16, r1 + shll8 r1 + add #32, r1 + mov.w r2, @r1 + +check: + # Read it back. + mov.w @(18, pc), r0 + shll16 r0 + shll16 r2 + cmp/eq r0, r2 + bf wrong + +okay: + pass +wrong: + fail Index: lds-macl.cgs =================================================================== --- lds-macl.cgs (nonexistent) +++ lds-macl.cgs (revision 33) @@ -0,0 +1,23 @@ +# sh testcase for lds $rn, macl +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global lds_macl +lds_macl: + mov #42, r0 + shll8 r0 + lds r0, macl +readback: + sts macl, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: bsrf.cgs =================================================================== --- bsrf.cgs (nonexistent) +++ bsrf.cgs (revision 33) @@ -0,0 +1,22 @@ +# sh testcase for bsrf $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +bsrf: + mov #4, r0 + bsrf r0 +slot: + nop +bad: + fail + fail +okay: + pass +alsobad: + fail + fail Index: shar.cgs =================================================================== --- shar.cgs (nonexistent) +++ shar.cgs (revision 33) @@ -0,0 +1,40 @@ +# sh testcase for shar $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shar +shar: + mov #0, r0 + or #192, r0 + shar r0 + bt wrong + shar r0 + bt wrong + shar r0 + bt wrong + shar r0 + bt wrong + shar r0 + bt wrong + shar r0 + bt wrong + shar r0 + bf wrong + shar r0 + bf wrong + shar r0 + bt wrong + shar r0 + bt wrong + assert r0, #0 + +okay: + pass +wrong: + fail + Index: fldi0.cgs =================================================================== --- fldi0.cgs (nonexistent) +++ fldi0.cgs (revision 33) @@ -0,0 +1,17 @@ +# sh testcase for fldi0 $frn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + fldi0 fr0 + fldi0 fr2 + fldi0 fr4 + fldi0 fr6 + fldi0 fr8 + fldi0 fr10 + fldi0 fr12 + fldi0 fr14 + pass Index: cmphi.cgs =================================================================== --- cmphi.cgs (nonexistent) +++ cmphi.cgs (revision 33) @@ -0,0 +1,68 @@ +# sh testcase for cmp/hi $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +zero: + mov #0, r0 + mov #0, r0 + cmp/hi r0, r1 + bt wrong + +equal: + mov #1, r0 + rotr r0 + add #3, r0 + + mov #1, r1 + rotr r1 + add #3, r1 + + cmp/hi r0, r1 + bt wrong + +gt: + mov #10, r0 + mov #12, r1 + cmp/hi r0, r1 + bf wrong + +lt: + mov #12, r0 + mov #10, r1 + cmp/hi r0, r1 + bt wrong + +gtneg: + mov #1, r0 + rotr r0 + add #1, r0 + + mov #1, r1 + rotr r1 + add #3, r1 + + cmp/hi r0, r1 + bf wrong + +ltneg: + mov #1, r0 + rotr r0 + add #3, r0 + + mov #1, r1 + rotr r1 + add #1, r1 + + cmp/hi r0, r1 + bt wrong + +okay: + pass + +wrong: + fail Index: div1.cgs =================================================================== --- div1.cgs (nonexistent) +++ div1.cgs (revision 33) @@ -0,0 +1,52 @@ +# sh testcase for div1 $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #10, r0 + mov #2, r1 + div0s r0,r1 + + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + div1 r0, r1 + + pass Index: mulsw.cgs =================================================================== --- mulsw.cgs (nonexistent) +++ mulsw.cgs (revision 33) @@ -0,0 +1,91 @@ +# sh testcase for muls.w $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + sts mach, r7 + + .global mulsw +zero: + mov #0, r0 + mov #1, r1 + muls.w r0, r1 + + # Check the result. + sts macl, r3 + mov #0, r4 + cmp/eq r3, r4 + bf wrong + +sxs: + # Small * small. + mov #1, r0 + mov #2, r1 + muls.w r0, r1 + + # Check the result. + sts macl, r3 + mov #2, r4 + cmp/eq r3, r4 + bf wrong + +sxl: + # Small * large. + mov #1, r0 + mov #255, r1 + shll8 r1 + muls.w r0, r1 + + # Check the result. + sts macl, r3 + mov #0, r4 + not r4, r4 + shll8 r4 + cmp/eq r3, r4 + bf wrong + +lxs: + # Large * small. + mov #255, r0 + shll8 r0 + mov #1, r1 + muls.w r0, r1 + + # Check the result. + sts macl, r3 + mov #0, r4 + not r4, r4 + shll8 r4 + cmp/eq r3, r4 + bf wrong + +lxl: + # Large * large. + mov #255, r0 + shll8 r0 + mov #255, r1 + shll8 r1 + muls.w r0, r1 + + # Check the result. + sts macl, r3 + mov #1, r4 + shll16 r4 + cmp/eq r3, r4 + bf wrong + +invariant: + # Ensure MACH is invariant. + sts mach, r8 + cmp/eq r7, r8 + bf wrong + +okay: + pass + +wrong: + fail Index: movw2.cgs =================================================================== --- movw2.cgs (nonexistent) +++ movw2.cgs (revision 33) @@ -0,0 +1,36 @@ +# sh testcase for mov.w $rm, @-$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #30, r1 + shll8 r1 + # Preserve. + mov r1, r7 +init: + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 +store: + mov.w r2, @-r1 +check: + # Read it back. + mov.w @r1, r3 + shll16 r2 + shll16 r3 + cmp/eq r2, r3 + bf wrong +dec: + add #2, r1 + cmp/eq r7, r1 + bf wrong + +okay: + pass +wrong: + fail Index: ldc-gbr.cgs =================================================================== --- ldc-gbr.cgs (nonexistent) +++ ldc-gbr.cgs (revision 33) @@ -0,0 +1,22 @@ +# sh testcase for ldc $rn, gbr -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ldc +ldc: + mov #40, r0 + shll8 r0 + ldc r0, gbr + stc gbr, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: bfs.cgs =================================================================== --- bfs.cgs (nonexistent) +++ bfs.cgs (revision 33) @@ -0,0 +1,28 @@ +# sh testcase for bf/s $disp8 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global taken +taken: + clrt + bf/s ntaken +slot1: + nop + fail + .global ntaken +ntaken: + sett + bf/s bad +slot2: + nop + pass +bad: + fail + fail + fail + fail Index: cmphs.cgs =================================================================== --- cmphs.cgs (nonexistent) +++ cmphs.cgs (revision 33) @@ -0,0 +1,59 @@ +# sh testcase for cmp/hs $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +zero: + mov #0, r0 + mov #0, r0 + cmp/hs r0, r1 + +equal: + mov #1, r0 + rotr r0 + add #3, r0 + + mov #1, r1 + rotr r1 + add #3, r1 + + cmp/hs r0, r1 + +gt: + mov #10, r0 + mov #12, r1 + cmp/hs r0, r1 + +lt: + mov #12, r0 + mov #10, r1 + cmp/hs r0, r1 + +gtneg: + mov #1, r0 + rotr r0 + add #1, r0 + + mov #1, r1 + rotr r1 + add #3, r1 + + cmp/hs r0, r1 + +ltneg: + mov #1, r0 + rotr r0 + add #3, r0 + + mov #1, r1 + rotr r1 + add #1, r1 + + cmp/hs r0, r1 + +okay: + pass Index: andi.cgs =================================================================== --- andi.cgs (nonexistent) +++ andi.cgs (revision 33) @@ -0,0 +1,43 @@ +# sh testcase for and #$imm8, r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global andi +andi: + mov #0, r0 + or #255, r0 + and #0, r0 + assert r0, #0 + +large: + mov #0, r0 + or #255, r0 + shll8 r0 + or #255, r0 + shll8 r0 + or #255, r0 + shll8 r0 + or #255, r0 + +mask: + and #255, r0 + mov r0, r1 + mov #0, r0 + or #255, r0 + cmp/eq r0, r1 + bf wrong + +mask0: + and #0, r0 + assert r0, #0 + +okay: + pass + +wrong: + fail Index: swapb.cgs =================================================================== --- swapb.cgs (nonexistent) +++ swapb.cgs (revision 33) @@ -0,0 +1,44 @@ +# sh testcase for swap.b $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +init: + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + shll8 r0 + add #85, r0 + shll8 r0 + add #70, r0 + +test: + # Swap the lower two bytes into a different register. + swap.b r0, r1 + mov #1, r7 + shll8 r7 + add #12, r7 + shll8 r7 + add #70, r7 + shll8 r7 + add #85, r7 + cmp/eq r1, r7 + bf wrong + +swapback: + # Swap the lower two bytes into the same registers. + # R0 should now equal R1. + swap.b r1, r2 + cmp/eq r0, r2 + bf wrong + +okay: + pass + +wrong: + fail Index: tstb.cgs =================================================================== --- tstb.cgs (nonexistent) +++ tstb.cgs (revision 33) @@ -0,0 +1,30 @@ +# sh testcase for tst.b #$imm8, @(r0, gbr) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global orb +init: + # Init GBR and R0. + mov #30, r0 + ldc r0, gbr + mov #40, r0 + +orb: + tst.b #0, @(r0, gbr) + bf wrong + tst.b #170, @(r0, gbr) + bf wrong + tst.b #0, @(r0, gbr) + bf wrong + tst.b #255, @(r0, gbr) + +okay: + pass +wrong: + fail + Index: movw4.cgs =================================================================== --- movw4.cgs (nonexistent) +++ movw4.cgs (revision 33) @@ -0,0 +1,31 @@ +# sh testcase for mov.w r0, @($imm8x2, gbr) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #30, r0 + shll8 r0 + ldc r0, gbr + +init: + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + # Preserve r0. + mov r0, r7 + mov.w r0, @(12, gbr) +check: + mov.w @(12, gbr), r0 + cmp/eq r0, r7 + bf wrong + +okay: + pass +wrong: + fail + Index: addv.cgs =================================================================== --- addv.cgs (nonexistent) +++ addv.cgs (revision 33) @@ -0,0 +1,48 @@ +# sh testcase for addv $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start +zero: + mov #0, r0 + mov #0, r1 + addv r0, r1 + # Assert !T and #0. + bt wrong + assert r1, #0 + +one: + mov #0, r0 + mov #1, r1 + addv r0, r1 + # Assert !T and #1. + bt wrong + assert r1, #1 + +large: + # Produce MAXINT in R0. + mov #0, r0 + not r0, r0 + shlr r0 + + # Put #3 into R1. + mov #3, r1 + + # Add them and overflow. + addv r0, r1 + + # Assert T and overflowed value. + bf wrong + mov #1, r7 + rotr r7 + add #2, r7 + cmp/eq r1, r7 + bf wrong + +okay: + pass +wrong: + fail Index: movw6.cgs =================================================================== --- movw6.cgs (nonexistent) +++ movw6.cgs (revision 33) @@ -0,0 +1,30 @@ +# sh testcase for mov.w @$rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #30, r0 + shll8 r0 + + # Store something first. + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + mov.w r2, @r0 + +check: + # Read it back. + mov.w @r0, r1 + cmp/eq r1, r2 + bf wrong + +okay: + pass +wrong: + fail + Index: fneg.cgs =================================================================== --- fneg.cgs (nonexistent) +++ fneg.cgs (revision 33) @@ -0,0 +1,83 @@ +# sh testcase for fneg -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + # neg(0.0) = 0.0. + fldi0 fr0 + fldi0 fr1 + fneg fr0 + fcmp/eq fr0, fr1 + bf wrong + + # neg(1.0) = fsub(0,1) + fldi1 fr0 + fneg fr0 + fldi0 fr1 + fldi1 fr2 + fsub fr2, fr1 + fcmp/eq fr0, fr1 + bf wrong + + # neg(neg(1.0)) = 1.0. + fldi1 fr0 + fldi1 fr1 + fneg fr0 + fneg fr0 + fcmp/eq fr0, fr1 + bf wrong + + bra double + nop + +wrong: + fail + +double: + # neg(0.0) = 0.0. + fldi0 fr0 + fldi0 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fneg dr0 + fcmp/eq dr0, dr2 + bf wrong2 + _clrpr + + # neg(1.0) = fsub(0,1) + fldi1 fr0 + _s2d fr0, dr0 + _setpr + fneg dr0 + _clrpr + fldi0 fr2 + fldi1 fr3 + fsub fr3, fr2 + _s2d fr2, dr2 + _setpr + fcmp/eq fr0, fr2 + bf wrong2 + _clrpr + + # neg(neg(1.0)) = 1.0. + fldi1 fr0 + _s2d fr0, dr0 + fldi1 fr2 + _s2d fr2, dr2 + _setpr + fneg dr0 + fneg dr2 + fcmp/eq dr0, dr2 + bf wrong2 + _clrpr + +okay: + pass + +wrong2: + fail Index: fcmpgt.cgs =================================================================== --- fcmpgt.cgs (nonexistent) +++ fcmpgt.cgs (revision 33) @@ -0,0 +1,95 @@ +# sh testcase for fcmpgt -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + # 1.0 !> 1.0. + fldi1 fr0 + fldi1 fr1 + fcmp/gt fr0, fr1 + bt wrong + + # 0.0 !> 1.0. + fldi0 fr0 + fldi1 fr1 + fcmp/gt fr0, fr1 + bf wrong + + # 1.0 > 0.0. + fldi1 fr0 + fldi0 fr1 + fcmp/gt fr0, fr1 + bt wrong + + # 2.0 > 1.0 + fldi1 fr0 + fadd fr0, fr0 + fldi1 fr1 + fcmp/gt fr0, fr1 + bt wrong + + bra double + nop + +wrong: + fail + +double: + # double precision tests. + # 1.0 !> 1.0. + fldi1 fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/gt dr0, dr2 + bt wrong2 + _clrpr + + # 0.0 !> 1.0. + fldi0 fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/gt dr0, dr2 + bf wrong2 + _clrpr + + bra next + nop + +wrong2: + fail + +next: + # 1.0 > 0.0. + fldi1 fr0 + fldi0 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/gt dr0, dr2 + bt wrong2 + _clrpr + + # 2.0 > 1.0. + fldi1 fr0 + fadd fr0, fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/gt dr0, dr2 + bt wrong2 + _clrpr + +okay: + pass + +wrong3: + fail Index: movw8.cgs =================================================================== --- movw8.cgs (nonexistent) +++ movw8.cgs (revision 33) @@ -0,0 +1,31 @@ +# sh testcase for mov.w @(r0, $rm), $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r0 + shll8 r0 + mov #10, r1 + + # Store something first. + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + + mov.w r2, @(r0, r1) +check: + # Read it back. + mov.w @(r0, r1), r3 + shll16 r2 + shll16 r3 + cmp/eq r2, r3 + bf wrong + +okay: + pass +wrong: + fail Index: fcnvds.cgs =================================================================== --- fcnvds.cgs (nonexistent) +++ fcnvds.cgs (revision 33) @@ -0,0 +1,13 @@ +# sh testcase for fcnvds -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + _setpr + fcnvds dr0, fpul + _clrpr +okay: + pass Index: extsb.cgs =================================================================== --- extsb.cgs (nonexistent) +++ extsb.cgs (revision 33) @@ -0,0 +1,29 @@ +# sh testcase for exts.b $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global extsb +extsb: + mov #42, r1 + exts.b r1, r2 + assert r2, #42 +signed: + mov #0, r0 + or #255, r0 + exts.b r0, r1 + mov #0, r7 + not r7, r7 + cmp/eq r1, r7 + bf wrong + +okay: + pass + +wrong: + fail + Index: bf.cgs =================================================================== --- bf.cgs (nonexistent) +++ bf.cgs (revision 33) @@ -0,0 +1,24 @@ +# sh testcase for bf $disp8 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global taken +taken: + clrt + bf ntaken + fail + .global ntaken +ntaken: + sett + bf bad + pass +bad: + fail + fail + fail + fail Index: fadd.cgs =================================================================== --- fadd.cgs (nonexistent) +++ fadd.cgs (revision 33) @@ -0,0 +1,31 @@ +# sh testcase for fadd +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + _clrpr + + fldi1 fr0 + fldi1 fr1 + fadd fr0, fr1 + + fldi0 fr0 + fldi1 fr1 + fadd fr0, fr1 + + fldi1 fr0 + fldi0 fr1 + fadd fr0, fr1 + + _setpr +double: + fldi1 fr0 + fldi1 fr1 + _s2d fr0, dr4 + _s2d fr1, dr6 + fadd dr4, dr6 + + pass Index: movl2.cgs =================================================================== --- movl2.cgs (nonexistent) +++ movl2.cgs (revision 33) @@ -0,0 +1,43 @@ +# sh testcase for mov.l $rm, @-$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #30, r1 + shll8 r1 + # Save address. + mov r1, r7 + +init: + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + shll8 r2 + add #85, r2 + shll8 r2 + add #170, r2 + mov.l r2, @-r1 + +check: + # Compare the value loaded into another reg. + mov.l @r1, r3 + cmp/eq r2, r3 + bf wrong + +dec: + # Ensure address is decremented. + mov #4, r6 + sub r6, r7 + cmp/eq r1, r7 + bf wrong + +okay: + pass + +wrong: + fail Index: movl4.cgs =================================================================== --- movl4.cgs (nonexistent) +++ movl4.cgs (revision 33) @@ -0,0 +1,38 @@ +# sh testcase for mov.l r0, @($imm8x4, gbr) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +setaddr: + mov #30, r1 + shll8 r1 + ldc r1, gbr + +init: + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + shll8 r0 + add #85, r0 + shll8 r0 + add #170, r0 + # Preserve. + mov r0, r7 + + mov.l r0, @(4, gbr) +check: + # Load it back. + mov.l @(4, gbr), r0 + cmp/eq r0, r7 + bf wrong + +okay: + pass +wrong: + fail + Index: movl6.cgs =================================================================== --- movl6.cgs (nonexistent) +++ movl6.cgs (revision 33) @@ -0,0 +1,25 @@ +# sh testcase for mov.l @$rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #30, r0 + shll8 r0 + # Store something there first. + mov #170, r1 + mov.l r1, @r0 +check: + # Load it back. + mov.l @r0, r3 + cmp/eq r1, r3 + bf wrong + +okay: + pass +wrong: + fail + Index: clrs.cgs =================================================================== --- clrs.cgs (nonexistent) +++ clrs.cgs (revision 33) @@ -0,0 +1,14 @@ +# sh testcase for clrs -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global clrs +clrs: + clrs + # Somehow ensure that S is set. + pass Index: xtrct.cgs =================================================================== --- xtrct.cgs (nonexistent) +++ xtrct.cgs (revision 33) @@ -0,0 +1,46 @@ +# sh testcase for xtrct $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +init: + mov #170, r0 + shll8 r0 + add #1, r0 + shll8 r0 + add #66, r0 + shll8 r0 + mov r0, r1 + + mov #85, r0 + shll8 r0 + add #2, r0 + shll8 r0 + add #42, r0 + shll8 r0 + add #3, r0 + +copy: + mov r0, r3 + mov r1, r4 + +xtrct: + xtrct r0, r1 + +check: + # Lower r3, upper r4. + shll16 r3 + shlr16 r4 + or r3, r4 + cmp/eq r1, r4 + bf wrong + +okay: + pass +wrong: + fail + Index: movb10.cgs =================================================================== --- movb10.cgs (nonexistent) +++ movb10.cgs (revision 33) @@ -0,0 +1,25 @@ +# sh testcase for mov.b @($imm4, $rm), r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r1 + shll8 r1 + # Store something there first. + mov #0, r0 + or #170, r0 + mov r0, r7 + mov.b r0, @(3, r1) + # Load it back. + mov.b @(3, r1), r0 + and #255, r0 + cmp/eq r0, r7 + bf wrong + +okay: + pass +wrong: + fail Index: bt.cgs =================================================================== --- bt.cgs (nonexistent) +++ bt.cgs (revision 33) @@ -0,0 +1,24 @@ +# sh testcase for bt $disp8 +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global taken +taken: + sett + bt ntaken + fail + .global ntaken +ntaken: + clrt + bt bad + pass +bad: + fail + fail + fail + fail Index: movl8.cgs =================================================================== --- movl8.cgs (nonexistent) +++ movl8.cgs (revision 33) @@ -0,0 +1,24 @@ +# sh testcase for mov.l @(r0, $rm), $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #0, r0 + mov #30, r1 + shll8 r1 + # Store something there first. + mov #170, r3 + mov.l r3, @(r0, r1) +check: + # Load it back. + mov.l @(r0, r1), r2 + cmp/eq r2, r3 + bf wrong + +okay: + pass +wrong: + fail Index: cmpeq.cgs =================================================================== --- cmpeq.cgs (nonexistent) +++ cmpeq.cgs (revision 33) @@ -0,0 +1,52 @@ +# sh testcase for cmp/eq $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +zeroes: + mov #0, r1 + mov #0, r2 + cmp/eq r1, r2 + bf wrong + +zero1: + mov #0, r1 + mov #1, r2 + cmp/eq r1, r2 + bt wrong + +zero2: + mov #0, r2 + mov #1, r1 + cmp/eq r2, r1 + bt wrong + +equal: + mov #192, r1 + mov #192, r2 + cmp/eq r1, r2 + bf wrong + +noteq: + mov #192, r1 + mov #193, r2 + cmp/eq r1, r2 + bt wrong + +large: + mov #1, r1 + rotr r1 + mov #1, r2 + rotr r2 + cmp/eq r1, r2 + bf wrong + +okay: + pass + +wrong: + fail Index: fmov.cgs =================================================================== --- fmov.cgs (nonexistent) +++ fmov.cgs (revision 33) @@ -0,0 +1,273 @@ +# sh testcase for all fmov instructions +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + .macro init + fldi0 fr0 + fldi1 fr2 + .endm + + # Set the SZ (SiZe) bit in the fpscr. + .macro _setsz + sts fpscr, r7 + mov #16, r8 + shll16 r8 + or r8, r7 + lds r7, fpscr + .endm + + # Clear the SZ bit. + .macro _clrsz + sts fpscr, r7 + mov #16, r8 + shll16 r8 + not r8, r8 + and r8, r7 + lds r7, fpscr + .endm + start + +fmov1: # Test fr -> fr. + init + _clrpr + _clrsz + fmov fr0, fr10 + # Ensure fr0 and fr10 are now equal. + fcmp/eq fr0, fr10 + bt fmov2 + fail + +fmov2: # Test dr -> dr. + init + _setpr + _setsz + fmov dr0, dr2 + # Ensure dr0 and dr2 are now equal. + fcmp/eq dr0, dr2 + bt fmov3 + fail + +fmov3: # Test dr -> xd and xd -> dr. + init + _setsz + fmov dr0, xd0 + # Ensure dr0 and xd0 are now equal. + fmov xd0, dr2 + fcmp/eq dr0, dr2 + bt fmov4 + fail + +fmov4: # Test xd -> xd. + init + _setsz + _setpr + fmov dr0, xd0 + fmov xd0, xd2 + fmov xd2, dr2 + # Ensure dr0 and dr2 are now equal. + fcmp/eq dr0, dr2 + bt fmov5 + fail + +fmov5: # Test fr -> @rn and @rn -> fr. + init + _clrsz + _clrpr + mov #40, r0 + shll8 r0 + fmov fr0, @r0 + fmov @r0, fr1 + fcmp/eq fr0, fr1 + bt fmov6 + fail + +fmov6: # Test dr -> @rn and @rn -> dr. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + fmov dr0, @r0 + fmov @r0, dr2 + fcmp/eq dr0, dr2 + bt fmov7 + fail + +fmov7: # Test xd -> @rn and @rn -> xd. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + fmov dr0, xd0 + fmov xd0, @r0 + fmov @r0, xd2 + fmov xd2, dr2 + fcmp/eq dr0, dr2 + bt fmov8 + fail + +fmov8: # Test fr -> @-rn. + init + _clrsz + _clrpr + mov #40, r0 + shll8 r0 + # Preserve. + mov r0, r1 + fmov fr0, @-r0 + fmov @r0, fr2 + fcmp/eq fr0, fr2 + bt f8b + fail +f8b: # check pre-dec. + add #4, r0 + cmp/eq r0, r1 + bt fmov9 + fail + +fmov9: # Test dr -> @-rn. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + # Preserve r0. + mov r0, r1 + fmov dr0, @-r0 + fmov @r0, dr2 + fcmp/eq dr0, dr2 + bt f9b + fail +f9b: # check pre-dec. + add #8, r0 + cmp/eq r0, r1 + bt fmov10 + fail + +fmov10: # Test xd -> @-rn. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + # Preserve r0. + mov r0, r1 + fmov dr0, xd0 + fmov xd0, @-r0 + fmov @r0, xd2 + fmov xd2, dr2 + fcmp/eq dr0, dr2 + bt f10b + fail +f10b: # check pre-dec. + add #8, r0 + cmp/eq r0, r1 + bt fmov11 + fail + +fmov11: # Test @rn+ -> fr. + init + _clrsz + _clrpr + mov #40, r0 + shll8 r0 + # Preserve r0. + mov r0, r1 + fmov fr0, @r0 + fmov @r0+, fr2 + fcmp/eq fr0, fr2 + bt f11b + fail +f11b: # check post-inc. + add #4, r1 + cmp/eq r0, r1 + bt fmov12 + fail + +fmov12: # Test @rn+ -> dr. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + # preserve r0. + mov r0, r1 + fmov dr0, @r0 + fmov @r0+, dr2 + fcmp/eq dr0, dr2 + bt f12b + fail +f12b: # check post-inc. + add #8, r1 + cmp/eq r0, r1 + bt fmov13 + fail + +fmov13: # Test @rn -> xd. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + # Preserve r0. + mov r0, r1 + fmov dr0, xd0 + fmov xd0, @r0 + fmov @r0+, xd2 + fmov xd2, dr2 + fcmp/eq dr0, dr2 + bt f13b + fail +f13b: + add #8, r1 + cmp/eq r0, r1 + bt fmov14 + fail + +fmov14: # Test fr -> @(r0,rn), @(r0, rn) -> fr. + init + _clrsz + _clrpr + mov #40, r0 + shll8 r0 + mov #0, r1 + fmov fr0, @(r0, r1) + fmov @(r0, r1), fr1 + fcmp/eq fr0, fr1 + bt fmov15 + fail + +fmov15: # Test dr -> @(r0, rn), @(r0, rn) -> dr. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + mov #0, r1 + fmov dr0, @(r0, r1) + fmov @(r0, r1), dr2 + fcmp/eq dr0, dr2 + bt fmov16 + fail + +fmov16: # Test xd -> @(r0, rn), @(r0, rn) -> xd. + init + _setsz + _setpr + mov #40, r0 + shll8 r0 + mov #0, r1 + fmov dr0, xd0 + fmov xd0, @(r0, r1) + fmov @(r0, r1), xd2 + fmov xd2, dr2 + fcmp/eq dr0, dr2 + bt okay + fail + +okay: + pass Index: trapa.cgs =================================================================== --- trapa.cgs (nonexistent) +++ trapa.cgs (revision 33) @@ -0,0 +1,13 @@ +# sh testcase for trapa #$imm8 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global trapa +trapa: + # pass is a macro for "trapa #253". + trapa #253 Index: sts-fpul.cgs =================================================================== --- sts-fpul.cgs (nonexistent) +++ sts-fpul.cgs (revision 33) @@ -0,0 +1,14 @@ +# sh testcase for sts fpul, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sts_fpul +sts_fpul: + # This is properly exercised by the lds-fpul test case. + sts fpul, r1 + pass Index: sets.cgs =================================================================== --- sets.cgs (nonexistent) +++ sets.cgs (revision 33) @@ -0,0 +1,13 @@ +# sh testcase for sets -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sets +sets: + sets + pass Index: movl11.cgs =================================================================== --- movl11.cgs (nonexistent) +++ movl11.cgs (revision 33) @@ -0,0 +1,32 @@ +# sh testcase for mov.l @($imm4x4, $rm), $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r0 + shll8 r0 + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + shll8 r2 + add #85, r2 + shll8 r2 + add #170, r2 + # Store something first. + mov.l r2, @(12, r0) + +check: + # Read it back. + mov.l @(12, r0), r1 + cmp/eq r2, r1 + bf wrong + +okay: + pass +wrong: + fail + Index: shlr16.cgs =================================================================== --- shlr16.cgs (nonexistent) +++ shlr16.cgs (revision 33) @@ -0,0 +1,14 @@ +# sh testcase for shlr16 $rn +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shrl16 +shrl16: + shlr16 r0 + + pass Index: rotcl.cgs =================================================================== --- rotcl.cgs (nonexistent) +++ rotcl.cgs (revision 33) @@ -0,0 +1,121 @@ +# sh testcase for rotcl $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global rotcl + +rotcl: + clrt + mov #1, r1 + rotcl r1 + assert r1, #2 + clrt + rotcl r1 + assert r1, #4 + clrt + rotcl r1 + assert r1, #8 + clrt + rotcl r1 + assert r1, #16 + clrt + rotcl r1 + assert r1, #32 + clrt + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + bf wrong + rotcl r1 + assert r1, #1 + + bra trotcl + nop + +wrong: + fail + +trotcl: + sett + mov #1, r1 + rotcl r1 + assert r1, #3 + clrt + rotcl r1 + assert r1, #6 + clrt + rotcl r1 + assert r1, #12 + clrt + rotcl r1 + assert r1, #24 + clrt + rotcl r1 + assert r1, #48 + clrt + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + rotcl r1 + bf wrong2 + assert r1, #1 + rotcl r1 + rotcl r1 + +okay: + pass +wrong2: + fail Index: sts-fpscr.cgs =================================================================== --- sts-fpscr.cgs (nonexistent) +++ sts-fpscr.cgs (revision 33) @@ -0,0 +1,23 @@ +# sh testcase for sts fpscr, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sts_fpscr +sts_fpscr: + sts fpscr, r0 + mov #42, r0 + lds r0, fpscr + sts fpscr, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail + Index: movt.cgs =================================================================== --- movt.cgs (nonexistent) +++ movt.cgs (revision 33) @@ -0,0 +1,28 @@ +# sh testcase for movt $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global movt +init: + sett + movt r1 + assert r1, #1 +clear: + clrt + movt r1 + assert r1, #0 +set: + sett + movt r1 + assert r1, #1 + +okay: + pass +wrong: + fail + Index: macw.cgs =================================================================== --- macw.cgs (nonexistent) +++ macw.cgs (revision 33) @@ -0,0 +1,70 @@ +# sh testcase for mac.w @${rm}+, @${rn}+ +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + # Store some magic numbers in memory. + mov #40, r1 + shll8 r1 + mov #85, r0 + mov.l r0, @r1 + # Keep for later. + mov r1, r10 +store2: + mov #40, r1 + shll8 r1 + add #12, r1 + mov #17, r0 + mov.l r0, @r1 + # Keep for later. + mov r1, r11 + +init: + # Set up addresses. + mov #40, r1 + shll8 r1 + mov #40, r2 + shll8 r2 + add #12, r2 + + # Prime {MACL, MACH} to #1. + mov #1, r3 + dmulu.l r3, r3 + +test: + mac.w @r1+, @r2+ + +check: + # Check result. + sts mach, r5 + assert r5, #0 + + sts macl, r6 + assert r6, #1 + + # Ensure post-increment occurred. + add #2, r10 + cmp/eq r10, r1 + bf wrong + + add #2, r11 + cmp/eq r11, r2 + bf wrong + +doubleinc: + mov #40, r0 + shll8 r0 + mov r0, r1 + mac.w @r0+, @r0+ + add #8, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: sts-pr.cgs =================================================================== --- sts-pr.cgs (nonexistent) +++ sts-pr.cgs (revision 33) @@ -0,0 +1,22 @@ +# sh testcase for sts pr, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sts_pr +sts_pr: + mov #42, r0 + lds r0, pr + sts pr, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail + Index: rotcr.cgs =================================================================== --- rotcr.cgs (nonexistent) +++ rotcr.cgs (revision 33) @@ -0,0 +1,103 @@ +# sh testcase for rotcr $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global rotcr +rotcr: + clrt + mov #1, r1 + rotcr r1 + bf wrong + assert r1, #0 + sett + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + assert r1, #1 + rotcr r1 + bf wrong + +trotcr: + sett + mov #1, r1 + rotcr r1 + bf wrong + sett + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + rotcr r1 + bf wrong + assert r1, #1 + rotcr r1 + bf wrong + rotcr r1 + +okay: + pass +wrong: + fail + + Index: shlr2.cgs =================================================================== --- shlr2.cgs (nonexistent) +++ shlr2.cgs (revision 33) @@ -0,0 +1,14 @@ +# sh testcase for shlr2 $rn +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shrl2 +shrl2: + shlr2 r0 + + pass Index: nop.cgs =================================================================== --- nop.cgs (nonexistent) +++ nop.cgs (revision 33) @@ -0,0 +1,13 @@ +# sh testcase for nop +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global nop +nop: + nop + pass Index: not.cgs =================================================================== --- not.cgs (nonexistent) +++ not.cgs (revision 33) @@ -0,0 +1,47 @@ +# sh testcase for not $rm64, $rn64 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global not +not: + mov #0, r0 + or #192, r0 + not r0, r1 + + mov #0, r0 + or #255, r0 + shll8 r0 + or #255, r0 + shll8 r0 + or #255, r0 + shll8 r0 + or #63, r0 + + cmp/eq r0, r1 + bf wrong + +ones: + mov #0, r1 + not r1, r2 + + mov #0, r0 + or #255, r0 + shll8 r0 + or #255, r0 + shll8 r0 + or #255, r0 + shll8 r0 + or #255, r0 + cmp/eq r0, r2 + bf wrong + +okay: + pass + +wrong: + fail Index: shlr8.cgs =================================================================== --- shlr8.cgs (nonexistent) +++ shlr8.cgs (revision 33) @@ -0,0 +1,14 @@ +# sh testcase for shlr8 $rn +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shrl8 +shrl8: + shlr8 r0 + + pass Index: lds-pr.cgs =================================================================== --- lds-pr.cgs (nonexistent) +++ lds-pr.cgs (revision 33) @@ -0,0 +1,23 @@ +# sh testcase for lds $rn, pr +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global lds_pr +lds_pr: + mov #40, r0 + shll8 r0 + lds r0, pr +readback: + sts pr, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: ldsl-mach.cgs =================================================================== --- ldsl-mach.cgs (nonexistent) +++ ldsl-mach.cgs (revision 33) @@ -0,0 +1,26 @@ +# sh testcase for lds.l @${rn}+, mach -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ldsl_mach +ldsl_mach: + mov #40, r0 + shll8 r0 + # save address for later examination. + mov r0, r1 + + lds.l @r0+, mach + + add #4, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: ldsl-macl.cgs =================================================================== --- ldsl-macl.cgs (nonexistent) +++ ldsl-macl.cgs (revision 33) @@ -0,0 +1,26 @@ +# sh testcase for lds.l @${rn}+, macl -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ldsl_macl +ldsl_macl: + mov #40, r0 + shll8 r0 + # save address for later examination. + mov r0, r1 + + lds.l @r0+, macl + + add #4, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: muluw.cgs =================================================================== --- muluw.cgs (nonexistent) +++ muluw.cgs (revision 33) @@ -0,0 +1,96 @@ +# sh testcase for mulu.w $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + sts mach, r7 + + .global mulsw +zero: + mov #0, r0 + mov #1, r1 + mulu.w r0, r1 + + # Check the result. + sts macl, r1 + mov #0, r0 + cmp/eq r0, r1 + bf wrong + +sxs: + # Small * small. + mov #1, r0 + mov #2, r1 + mulu.w r0, r1 + + # Check the result. + sts macl, r1 + mov #2, r0 + cmp/eq r0, r1 + bf wrong + +sxl: + # Small * large. + mov #1, r1 + mov #0, r0 + or #255, r0 + shll8 r0 + mulu.w r1, r0 + + # Check the result. + sts macl, r1 + mov #0, r0 + or #255, r0 + shll8 r0 + cmp/eq r0, r1 + bf wrong + +lxs: + # Large * small. + mov #0, r0 + or #255, r0 + shll8 r0 + mov #1, r1 + mulu.w r0, r1 + + # Check the result. + sts macl, r1 + mov #0, r0 + or #255, r0 + shll8 r0 + cmp/eq r0, r1 + bf wrong + +lxl: + # Large * large. + mov #0, r0 + or #255, r0 + shll8 r0 + mov r0, r1 + mulu.w r0, r1 + + # Check the result. + sts macl, r1 + mov #0, r0 + or #254, r0 + shll8 r0 + or #1, r0 + shll16 r0 + cmp/eq r0, r1 + bf wrong + +invariant: + # Ensure MACH is invariant. + sts mach, r8 + cmp/eq r7, r8 + bf wrong + +okay: + pass + +wrong: + fail Index: tst.cgs =================================================================== --- tst.cgs (nonexistent) +++ tst.cgs (revision 33) @@ -0,0 +1,62 @@ +# sh testcase for tst $rm, $rn +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global tst1 +tst1: + mov #0, r0 + mov #0, r1 + tst r0, r0 + bf wrong + +test2: + mov #0, r0 + mov #1, r1 + tst r0, r1 + bf wrong + +test3: + mov #0, r0 + mov #1, r1 + tst r1, r0 + bf wrong + +test4: + mov #1, r0 + mov #1, r1 + tst r0, r1 + bt wrong + +test5: + mov #1, r0 + rotr r0 + add #85, r0 + shll16 r0 + add #12, r0 + mov #1, r1 + rotr r1 + add #85, r1 + shll16 r1 + add #12, r1 + tst r0, r1 + bt wrong + +test6: + mov #1, r0 + rotr r0 + add #85, r0 + shll16 r0 + add #12, r0 + mov #1, r1 + tst r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: xorb.cgs =================================================================== --- xorb.cgs (nonexistent) +++ xorb.cgs (revision 33) @@ -0,0 +1,24 @@ +# sh testcase for xor.b #$imm8, @(r0, gbr) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global orb +init: + # Init GBR and R0. + mov #30, r0 + ldc r0, gbr + mov #40, r0 + +orb: + xor.b #0, @(r0, gbr) + xor.b #170, @(r0, gbr) + xor.b #0, @(r0, gbr) + xor.b #255, @(r0, gbr) + +okay: + pass Index: fcmpeq.cgs =================================================================== --- fcmpeq.cgs (nonexistent) +++ fcmpeq.cgs (revision 33) @@ -0,0 +1,88 @@ +# sh testcase for fcmpeq -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + # 1.0 == 1.0. + fldi1 fr0 + fldi1 fr1 + fcmp/eq fr0, fr1 + bf wrong + + # 0.0 != 1.0. + fldi0 fr0 + fldi1 fr1 + fcmp/eq fr0, fr1 + bt wrong + + # 1.0 != 0.0. + fldi1 fr0 + fldi0 fr1 + fcmp/eq fr0, fr1 + bt wrong + + # 2.0 != 1.0 + fldi1 fr0 + fadd fr0, fr0 + fldi1 fr1 + fcmp/eq fr0, fr1 + bt wrong + + bra double + # delay slot + nop + +wrong: + fail + +double: + # 1.0 == 1.0 + fldi1 fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/eq dr0, dr2 + bf wrong + _clrpr + + # 0.0 != 1.0 + fldi0 fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/eq dr0, dr2 + bt wrong + _clrpr + + # 1.0 != 0.0 + fldi1 fr0 + fldi0 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/eq dr0, dr2 + bt wrong2 + _clrpr + + # 2.0 != 1.0 + fldi1 fr0 + fadd fr0, fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fcmp/eq dr0, dr2 + bt wrong2 + _clrpr + +okay: + pass + +wrong2: + fail Index: fsts.cgs =================================================================== --- fsts.cgs (nonexistent) +++ fsts.cgs (revision 33) @@ -0,0 +1,11 @@ +# sh testcase for fsts fpul, $frn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + fsts fpul, fr0 + fsts fpul, fr1 + pass Index: or.cgs =================================================================== --- or.cgs (nonexistent) +++ or.cgs (revision 33) @@ -0,0 +1,43 @@ +# sh testcase for or $rm64, $rn64 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global or +or: + mov #1, r0 + rotr r0 + mov #1, r1 + or r0, r1 + + mov #1, r7 + rotr r7 + add #1, r7 + cmp/eq r7, r1 + bf wrong + + .global or2 +or2: + mov #85, r0 + shll16 r0 + shll8 r0 + mov #85, r1 + shll8 r1 + or r0, r1 + + mov #85, r7 + shll16 r7 + add #85 ,r7 + shll8 r7 + cmp/eq r1, r7 + bf wrong + +okay: + pass + +wrong: + fail Index: rotl.cgs =================================================================== --- rotl.cgs (nonexistent) +++ rotl.cgs (revision 33) @@ -0,0 +1,62 @@ +# sh testcase for rotl $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global rotl +rotl: + mov #1, r1 + rotl r1 + assert r1, #2 + rotl r1 + assert r1, #4 + rotl r1 + assert r1, #8 + rotl r1 + assert r1, #16 + rotl r1 + assert r1, #32 + rotl r1 + assert r1, #64 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + rotl r1 + bf wrong + assert r1, #1 + rotl r1 + rotl r1 + rotl r1 + assert r1, #8 + +okay: + pass + +wrong: + fail Index: ftrv.cgs =================================================================== --- ftrv.cgs (nonexistent) +++ ftrv.cgs (revision 33) @@ -0,0 +1,74 @@ +# sh testcase for ftrv xmtrx, $fvn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + # set the fr bit in the fpscr + .macro _setfr + sts fpscr, r7 + mov #32, r8 + shll16 r8 + or r8, r7 + lds r7, fpscr + .endm + + # clear the fr bit + .macro _clrfr + sts fpscr, r7 + mov #32, r8 + shll16 r8 + not r8, r8 + and r8, r7 + lds r7, fpscr + .endm + + .macro incr old new + fldi1 \new + fadd \old, \new + .endm + + start + _setfr +popmtrx: + # 1.0. + fldi1 fr0 + # 2.0. + fldi1 fr1 + fadd fr1, fr1 + + incr fr1, fr2 + incr fr2, fr3 + incr fr3, fr4 + incr fr4, fr5 + incr fr5, fr6 + incr fr6, fr7 + incr fr7, fr8 + incr fr8, fr9 + incr fr9, fr10 + incr fr10, fr11 + incr fr11, fr12 + incr fr12, fr13 + incr fr13, fr14 + incr fr14, fr15 + +popvect: + # Swtich fp banks. + _clrfr + fldi1 fr4 + fldi1 fr5 + fadd fr5, fr5 + fldi1 fr6 + fadd fr5, fr6 + fldi1 fr7 + fadd fr6, fr7 + +ftrv: + # fr[4,7] should contain the results: + # { 30, 70, 110, 150 }. + ftrv xmtrx, fv4 + +okay: + pass + Index: movcal.cgs =================================================================== --- movcal.cgs (nonexistent) +++ movcal.cgs (revision 33) @@ -0,0 +1,28 @@ +# sh testcase for movca.l r0, @$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global movcal +movcal: + mov #1, r0 + rotr r0 + add #128, r0 + mov #40, r1 + shll8 r1 + movca.l r0, @r1 + + # Load the word back in. + mov.l @r1, r3 + cmp/eq r0, r3 + bf wrong + +okay: + pass +wrong: + fail + Index: ocbp.cgs =================================================================== --- ocbp.cgs (nonexistent) +++ ocbp.cgs (revision 33) @@ -0,0 +1,15 @@ +# sh testcase for ocbp @$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ocbp +ocbp: + ocbp @r0 + ocbp @r1 + ocbp @r15 + pass Index: movb1.cgs =================================================================== --- movb1.cgs (nonexistent) +++ movb1.cgs (revision 33) @@ -0,0 +1,27 @@ +# sh testcase for mov.b $rm, @$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #55, r1 + mov #40, r2 + shll8 r2 + mov.b r1, @r2 + + # Load it back into r3. + mov #40, r2 + shll8 r2 + mov.b @r2, r3 + + # Make sure r1 and r3 match. + cmp/eq r1, r3 + bf wrong + +okay: + pass + +wrong: + fail Index: rotr.cgs =================================================================== --- rotr.cgs (nonexistent) +++ rotr.cgs (revision 33) @@ -0,0 +1,55 @@ +# sh testcase for rotr $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global rotr +rotr: + mov #1, r1 + rotr r1 + bf wrong + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + rotr r1 + assert r1, #1 + rotr r1 + rotr r1 + rotr r1 + +okay: + pass + +wrong: + fail Index: movb3.cgs =================================================================== --- movb3.cgs (nonexistent) +++ movb3.cgs (revision 33) @@ -0,0 +1,30 @@ +# sh testcase for mov.b $rm, @(r0,$rn) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #40, r2 + shll8 r2 + mov #3, r1 + mov #0, r0 + or #170, r0 + mov r0, r3 + mov r2, r0 + mov.b r3, @(r0, r1) + + # Load the value back into a different register. + mov.b @(r0, r1), r4 + # Check the lowest order byte matches the stored value. + mov r4, r0 + and #255, r0 + cmp/eq r0, r3 + bf wrong + +okay: + pass + +wrong: + fail Index: extub.cgs =================================================================== --- extub.cgs (nonexistent) +++ extub.cgs (revision 33) @@ -0,0 +1,31 @@ +# sh testcase for extu.b $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global extub +extub: + mov #42, r1 + extu.b r1, r2 + assert r2, #42 + +another: + mov #0, r0 + or #255, r0 + extu.b r0, r1 + + mov #0, r0 + or #255, r0 + cmp/eq r0, r1 + bf wrong + +okay: + pass + +wrong: + fail + Index: movb5.cgs =================================================================== --- movb5.cgs (nonexistent) +++ movb5.cgs (revision 33) @@ -0,0 +1,25 @@ +# sh testcase for mov.b r0, @($imm4, rm) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #0, r0 + or #170, r0 + mov r0, r3 + mov #30, r2 + mov.b r0, @(3, r2) + + # Load the value back into a different register. + mov.b @(3, r2), r0 + and #255, r0 + cmp/eq r3, r0 + bf wrong + +okay: + pass +wrong: + fail + Index: stsl-fpul.cgs =================================================================== --- stsl-fpul.cgs (nonexistent) +++ stsl-fpul.cgs (revision 33) @@ -0,0 +1,27 @@ +# sh testcase for sts.l fpul, @-$rn -*- Asm -*_ +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global stsl_fpul +stsl_fpul: + mov #40, r0 + shll8 r0 + # Preserve r0. + mov r0, r7 + sts.l fpul, @-r0 + +dec: + # Check for proper pre-decrementing. + add #4, r0 + cmp/eq r0, r7 + bf wrong + +okay: + pass +wrong: + fail Index: ori.cgs =================================================================== --- ori.cgs (nonexistent) +++ ori.cgs (revision 33) @@ -0,0 +1,40 @@ +# sh testcase for or #$imm8, r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ori +ori: + mov #1, r0 + rotr r0 + or #1, r0 + + mov #1, r7 + rotr r7 + add #1, r7 + cmp/eq r0, r7 + bf wrong + + .global ori2 +ori2: + mov #85, r0 + shll16 r0 + shll8 r0 + or #85, r0 + + mov #85, r7 + shll16 r7 + shll8 r7 + add #85, r7 + cmp/eq r0, r7 + bf wrong + +okay: + pass + +wrong: + fail Index: movb7.cgs =================================================================== --- movb7.cgs (nonexistent) +++ movb7.cgs (revision 33) @@ -0,0 +1,35 @@ +# sh testcase for mov.b @${rm}+, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r1 + shll8 r1 + # Store addr. + mov r1, r8 + + # Store something there first. + mov #0, r0 + or #170, r0 + mov r0, r7 + mov.b r7, @r1 + # Load it back. + mov.b @r1+, r2 + mov r2, r0 + and #255, r0 + cmp/eq r7, r0 + bf wrong + + # Test address for post-incrementing. + add #1, r8 + cmp/eq r8, r1 + bf wrong + +okay: + pass +wrong: + fail + Index: cmpge.cgs =================================================================== --- cmpge.cgs (nonexistent) +++ cmpge.cgs (revision 33) @@ -0,0 +1,69 @@ +# sh testcase for cmp/ge $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +zero: + mov #0, r0 + mov #0, r1 + cmp/ge r0, r1 + bf wrong + +onezero: + mov #1, r0 + mov #0, r1 + cmp/ge r0, r1 + bt wrong + +zeroone: + mov #0, r0 + mov #1, r1 + cmp/ge r0, r1 + bf wrong + +equal: + mov #192, r0 + mov #192, r1 + cmp/ge r0, r1 + bf wrong + +eqlarge: + mov #1, r0 + rotr r0 + add #85, r0 + mov #1, r1 + rotr r1 + add #85, r1 + cmp/ge r0, r1 + bf wrong + +large2: + mov #1, r0 + rotr r0 + add #85, r0 + mov #1, r1 + rotr r1 + add #84, r1 + cmp/ge r0, r1 + bt wrong + +large3: + mov #1, r0 + rotr r0 + add #84, r0 + mov #1, r1 + rotr r1 + add #85, r1 + cmp/ge r0, r1 + bf wrong + +okay: + pass + +wrong: + fail + Index: movb9.cgs =================================================================== --- movb9.cgs (nonexistent) +++ movb9.cgs (revision 33) @@ -0,0 +1,27 @@ +# sh testcase for mov.b @($imm8, gbr), r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r0 + shll8 r0 + ldc r0, gbr + # Store something there first. + mov #0, r0 + or #170, r0 + mov r0, r7 + mov.b r0, @(3, gbr) + # Load it back. + mov.b @(3, gbr), r0 + and #255, r0 + cmp/eq r7, r0 + bf wrong + +okay: + pass + +wrong: + fail Index: pref.cgs =================================================================== --- pref.cgs (nonexistent) +++ pref.cgs (revision 33) @@ -0,0 +1,15 @@ +# sh testcase for pref @$rn +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global pref +pref: + pref @r0 + pref @r1 + pref @r15 + pass Index: fsub.cgs =================================================================== --- fsub.cgs (nonexistent) +++ fsub.cgs (revision 33) @@ -0,0 +1,120 @@ +# sh testcase for fmul -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + # 0.0 - 0.0 = 0.0. + fldi0 fr0 + fldi0 fr1 + fsub fr0, fr1 + fldi0 fr2 + fcmp/eq fr1, fr2 + bf wrong + + # 1.0 - 0.0 = 1.0. + fldi0 fr0 + fldi1 fr1 + fsub fr0, fr1 + fldi1 fr2 + fcmp/eq fr1, fr2 + bf wrong + + # 1.0 - 1.0 = 0.0. + fldi1 fr0 + fldi1 fr1 + fsub fr0, fr1 + fldi0 fr2 + fcmp/eq fr1, fr2 + bf wrong + + # 0.0 - 1.0 = -1.0. + fldi1 fr0 + fldi0 fr1 + fsub fr0, fr1 + fldi1 fr2 + fneg fr2 + fcmp/eq fr1, fr2 + bf wrong + + bra double + nop + +wrong: + fail + +double: + # 0.0 - 0.0 = 0.0. + fldi0 fr0 + fldi0 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fsub dr0, dr2 + _clrpr + fldi0 fr4 + _s2d fr4, dr4 + _setpr + fcmp/eq dr2, dr4 + bf wrong + _clrpr + +onezero: + # 1.0 - 0.0 = 1.0. + fldi0 fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fsub dr0, dr2 + _clrpr + fldi1 fr4 + _s2d fr4, dr4 + _setpr + fcmp/eq dr2, dr4 + bf wrong2 + _clrpr + +oneone: + # 1.0 - 1.0 = 0.0. + fldi1 fr0 + fldi1 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fsub dr0, dr2 + _clrpr + fldi0 fr4 + _s2d fr4, dr4 + _setpr + fcmp/eq dr2, dr4 + bf wrong2 + _clrpr + + bra zeroone + nop + +wrong2: + fail + +zeroone: + # 0.0 - 1.0 = -1.0. + fldi1 fr0 + fldi0 fr2 + _s2d fr0, dr0 + _s2d fr2, dr2 + _setpr + fsub dr0, dr2 + _clrpr + fldi1 fr4 + fneg fr4 + _s2d fr4, dr4 + _setpr + fcmp/eq dr2, dr4 + bf wrong2 + _clrpr + +okay: + pass Index: dmulsl.cgs =================================================================== --- dmulsl.cgs (nonexistent) +++ dmulsl.cgs (revision 33) @@ -0,0 +1,115 @@ +# sh testcase for dmuls.l $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #0, r0 + mov #0, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + assert r3, #0 + assert r4, #0 + +test2: + mov #0, r0 + mov #5, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + assert r3, #0 + assert r4, #0 + +test3: + mov #5, r0 + mov #0, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + assert r3, #0 + assert r4, #0 + +test4: + mov #1, r0 + mov #5, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + assert r3, #0 + assert r4, #5 + +test5: + mov #5, r0 + mov #1, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + assert r3, #0 + assert r4, #5 + + bra test6 + nop + +wrong: + fail + +test6: + mov #2, r0 + mov #2, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + assert r3, #0 + assert r4, #4 + +test7: + mov #1, r0 + neg r0, r0 + mov #2, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + + mov #0, r8 + not r8, r9 + not r8, r10 + shll r10 + cmp/eq r3, r9 + bf wrong + cmp/eq r4, r10 + bf wrong + +test8: + mov #1, r0 + neg r0, r0 + mov #1, r1 + neg r1, r1 + dmuls.l r0, r1 + # check result + sts mach, r3 + sts macl, r4 + assert r3, #0 + assert r4, #1 + +test9: + mov #1, r0 + neg r0, r0 + shlr r0 + mov #1, r1 + neg r1, r1 + shlr r1 + dmuls.l r0, r1 + +okay: + pass Index: stsl-pr.cgs =================================================================== --- stsl-pr.cgs (nonexistent) +++ stsl-pr.cgs (revision 33) @@ -0,0 +1,42 @@ +# sh testcase for sts.l pr, @-$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global stsl_pr +stsl_pr: + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + shll8 r0 + add #85, r0 + shll8 r0 + add #170, r0 + + lds r0, pr + mov #40, r2 + shll8 r2 + # Preserve r2. + mov r2, r7 + sts.l pr, @-r2 + + # check results. + mov.l @r2, r3 + cmp/eq r0, r3 + bf wrong + + # Ensure decrement occurred. + add #4, r2 + cmp/eq r2, r7 + bf wrong + +okay: + pass +wrong: + fail + Index: dt.cgs =================================================================== --- dt.cgs (nonexistent) +++ dt.cgs (revision 33) @@ -0,0 +1,42 @@ +# sh testcase for dt $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global dt +dt: + mov #3, r0 + dt r0 + bt wrong + assert r0, #2 + + mov #1, r0 + dt r0 + bf wrong + assert r0, #0 + + mov #0, r0 + dt r0 + bt wrong + mov #0, r7 + not r7, r7 + cmp/eq r7, r0 + bf wrong + + mov #1, r0 + neg r0, r0 + dt r0 + mov #1, r7 + not r7, r7 + cmp/eq r7, r0 + bf wrong + +okay: + pass + +wrong: + fail Index: ldsl-fpscr.cgs =================================================================== --- ldsl-fpscr.cgs (nonexistent) +++ ldsl-fpscr.cgs (revision 33) @@ -0,0 +1,43 @@ +# sh testcase for lds.l @${rn}+, fpscr -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #40, r0 + shll8 r0 + # save address for later examination. + mov r0, r1 + + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + shll8 r2 + add #85, r2 + shll8 r2 + add #170, r2 + # Store it in memory. + mov.l r2, @r0 + + lds.l @r0+, fpscr + +check: + # Read it back. + sts fpscr, r3 + cmp/eq r2, r3 + bf wrong + +inc: + # Test for proper post-increment. + add #4, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: mull.cgs =================================================================== --- mull.cgs (nonexistent) +++ mull.cgs (revision 33) @@ -0,0 +1,64 @@ +# sh testcase for mul.l $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global mull +mull: + mov #3, r0 + mov #5, r1 + mul.l r0, r1 + + # Check the result. + sts macl, r3 + mov #15, r4 + cmp/eq r3, r4 + bf wrong + +lxs: + # Large * small. + mov #255, r0 + mov #0, r1 + mul.l r0, r1 + + # Check the result. + sts macl, r3 + mov #0, r4 + cmp/eq r3, r4 + bf wrong + +sxl: + # Small * large. + mov #0, r0 + mov #255, r1 + mul.l r0, r1 + + # Check the result. + sts macl, r3 + mov #0, r4 + cmp/eq r3, r4 + bf wrong + +lxl: + # Large * large. + mov #1, r0 + neg r0, r0 + mov #2, r1 + mul.l r0, r1 + + # Check the result. + sts macl, r3 + mov #2, r4 + neg r4, r4 + cmp/eq r3, r4 + bf wrong + +okay: + pass + +wrong: + fail Index: neg.cgs =================================================================== --- neg.cgs (nonexistent) +++ neg.cgs (revision 33) @@ -0,0 +1,55 @@ +# sh testcase for neg $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + .macro signbit sign + shlr16 r1 + shlr8 r1 + shlr r1 + shlr r1 + shlr r1 + shlr r1 + shlr r1 + shlr r1 + shlr r1 + assert r1, \sign + .endm + start + + .global neg +neg: + mov #0, r0 + neg r0, r1 + signbit #0 + + mov #42, r0 + neg r0, r1 + signbit #1 + + mov #0, r0 + or #25, r0 + neg r0, r1 + signbit #1 + + # neg(0) is 0. + mov #0, r0 + neg r0, r1 + signbit #0 + + # neg(neg(x)) = x. + mov #42, r0 + neg r0, r1 + signbit #1 + mov #42, r0 + neg r0, r2 + neg r2, r1 + signbit #0 + +okay: + pass + +wrong: + fail Index: fabs.cgs =================================================================== --- fabs.cgs (nonexistent) +++ fabs.cgs (revision 33) @@ -0,0 +1,88 @@ +# sh testcase for fabs -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + _clrpr + # fabs(0.0) = 0.0. + fldi0 fr0 + fabs fr0 + fldi0 fr1 + fcmp/eq fr0, fr1 + bf wrong + + # fabs(1.0) = 1.0. + fldi1 fr0 + fabs fr0 + fldi1 fr1 + fcmp/eq fr0, fr1 + bf wrong + + # fabs(-1.0) = 1.0. + fldi1 fr0 + fneg fr0 + fabs fr0 + fldi1 fr1 + fcmp/eq fr0, fr1 + bf wrong + + bra double + nop + +wrong: + fail + +double: + # double precision tests. + # fabs(0.0) = 0.0. + fldi0 fr0 + _s2d fr0, dr0 + _setpr + fabs dr0 + _clrpr + # check. + fldi0 fr2 + _s2d fr2, dr2 + _setpr + fcmp/eq dr0, dr2 + bf wrong + _clrpr + +one: + # fabs(1.0) = 1.0. + fldi1 fr0 + _s2d fr0, dr0 + _setpr + fabs dr0 + _clrpr + # check. + fldi1 fr2 + _s2d fr2, dr2 + _setpr + fcmp/eq dr0, dr2 + bf wrong2 + _clrpr + +minusone: + # fabs(-1.0) = 1.0. + fldi1 fr0 + fneg fr0 + _s2d fr0, dr0 + _setpr + fabs dr0 + _clrpr + # check. + fldi1 fr2 + _s2d fr2, dr2 + _setpr + fcmp/eq dr0, dr2 + bf wrong2 + _clrpr + +okay: + pass +wrong2: + fail Index: subv.cgs =================================================================== --- subv.cgs (nonexistent) +++ subv.cgs (revision 33) @@ -0,0 +1,55 @@ +# sh testcase for subv $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start +zero: + mov #0, r0 + mov #0, r1 + subv r0, r1 + bt wrong + assert r1, #0 + +one: + mov #10, r0 + mov #0, r1 + subv r0, r1 + bt wrong + not r1, r1 + assert r1, #9 + +large: + # Produce MAXINT in R0. + mov #0, r0 + not r0, r0 + shlr r0 + + # Put -3 into R1. + mov #3, r1 + neg r1, r1 + + # Subtract them and underflow. + subv r0, r1 + bf wrong + +another: + # Produce MAXINT in R0. + mov #0, r0 + not r0, r0 + shlr r0 + + # Put -3 into R1. + mov #3, r1 + neg r1, r1 + + # Subtract them and overflow. + subv r1, r0 + bf wrong + +okay: + pass +wrong: + fail Index: shll2.cgs =================================================================== --- shll2.cgs (nonexistent) +++ shll2.cgs (revision 33) @@ -0,0 +1,40 @@ +# sh testcase for shll2 $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shll2 +shll2: + mov #1, r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + shll2 r1 + assert r1, #0 + +another: + mov #1, r1 + shll2 r1 + assert r1, #4 + +okay: + pass + +wrong: + fail Index: lds-fpul.cgs =================================================================== --- lds-fpul.cgs (nonexistent) +++ lds-fpul.cgs (revision 33) @@ -0,0 +1,17 @@ +# sh testcase for lds $rn, fpul -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global lds_fpul +lds_fpul: + mov #63, r0 + shll8 r0 + add #128, r0 + shll16 r0 + lds r0, fpul + pass Index: add.cgs =================================================================== --- add.cgs (nonexistent) +++ add.cgs (revision 33) @@ -0,0 +1,55 @@ +# sh testcase for add $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start +init: + # Initialise some registers with values which help us to verify + # that the correct source registers are used by the ADD instruction. + mov #0, r0 + mov #1, r1 + mov #2, r2 + mov #3, r3 + mov #5, r5 + mov #15, r15 + +add: + # 0 + 0 = 0. + add r0, r0 + assert r0, #0 + + # 0 + 1 = 1. + add r0, r1 + assert r1, #1 + + # 1 + 2 = 3. + add r1, r2 + assert r2, #3 + + # 3 + 5 = 8. + add r3, r5 + assert r5, #8 + + # 8 + 8 = 16. + add r5, r5 + assert r5, #16 + + # 15 + 1 = 16. + add r15, r1 + assert r1, #16 + +neg: + mov #1, r0 + neg r0, r0 + mov #2, r1 + add r0, r1 + assert r1, #1 + +okay: + pass + +wrong: + fail Index: movw11.cgs =================================================================== --- movw11.cgs (nonexistent) +++ movw11.cgs (revision 33) @@ -0,0 +1,35 @@ +# sh testcase for mov.w @($imm4x2, $rm), r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r1 + shll8 r1 + + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + + # Preserve r0. + mov r0, r3 + + # Store something first. + mov.w r0, @(12, r1) + +check: + # Read it back. + mov.w @(12, r1), r0 + shll16 r0 + shll16 r3 + cmp/eq r0, r3 + bf wrong + +okay: + pass +wrong: + fail + Index: shll8.cgs =================================================================== --- shll8.cgs (nonexistent) +++ shll8.cgs (revision 33) @@ -0,0 +1,38 @@ +# sh testcase for shll8 $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shll8 +shll8: + mov #1, r1 + shll8 r1 + shll8 r1 + shll8 r1 + shll8 r1 + assert r1, #0 + +another: + mov #1, r1 + shll8 r1 + mov #1, r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + cmp/eq r1, r7 + bf wrong + +okay: + pass + +wrong: + fail Index: fschg.cgs =================================================================== --- fschg.cgs (nonexistent) +++ fschg.cgs (revision 33) @@ -0,0 +1,13 @@ +# sh testcase for fschg +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + fschg + fschg + fschg + fschg + pass Index: addc.cgs =================================================================== --- addc.cgs (nonexistent) +++ addc.cgs (revision 33) @@ -0,0 +1,90 @@ +# sh testcase for addc $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + # Initialise some registers with values which help us to verify + # that the correct source registers are used by the ADDC instruction. + + .macro init + mov #0, r0 + mov #1, r1 + mov #2, r2 + mov #3, r3 + mov #5, r5 + mov #15, r15 + .endm + + start + + init +add: + clrt + addc r0, r0 + assert r0, #0 + clrt + addc r0, r1 + assert r1, #1 + clrt + addc r1, r2 + assert r2, #3 + clrt + addc r3, r5 + assert r5, #8 + clrt + addc r5, r5 + assert r5, #16 + clrt + addc r15, r1 + assert r1, #16 + + init +addt: + sett + addc r0, r0 + assert r0, #1 + sett + addc r0, r1 + assert r1, #3 + sett + addc r1, r2 + assert r2, #6 + sett + addc r3, r5 + assert r5, #9 + sett + addc r5, r5 + assert r5, #19 + sett + addc r15, r1 + assert r1, #19 + + bra next + nop + +wrong: + fail + +next: + init +large: + clrt + mov #1, r0 + neg r0, r0 + mov #2, r1 + addc r0, r1 + assert r1, #1 + + init +larget: + sett + mov #1, r0 + neg r0, r0 + mov #2, r1 + addc r0, r1 + assert r1, #2 + +okay: + pass Index: fldi1.cgs =================================================================== --- fldi1.cgs (nonexistent) +++ fldi1.cgs (revision 33) @@ -0,0 +1,17 @@ +# sh testcase for fldi1 $frn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + fldi1 fr1 + fldi1 fr3 + fldi1 fr5 + fldi1 fr7 + fldi1 fr9 + fldi1 fr11 + fldi1 fr13 + fldi1 fr15 + pass Index: addi.cgs =================================================================== --- addi.cgs (nonexistent) +++ addi.cgs (revision 33) @@ -0,0 +1,46 @@ +# sh testcase for add #$imm8, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start +init: + # Initialise some registers with values which help us to verify + # that the correct source registers are used by the ADD instruction. + mov #0, r0 + mov #1, r1 + mov #2, r2 + mov #3, r3 + mov #5, r5 + mov #15, r15 + +addi: + # 0 + 0 = 0. + add #0, r0 + assert r0, #0 + + # 0 + 1 = 1. + add #0, r1 + assert r1, #1 + + # 2 + 2 = 4. + add #2, r2 + assert r2, #4 + + # 120 + 5 = 125. + add #120, r5 + assert r5, #125 + +large: + mov #1, r0 + neg r0, r0 + add #2, r0 + assert r0, #1 + +okay: + pass + +wrong: + fail Index: mov.cgs =================================================================== --- mov.cgs (nonexistent) +++ mov.cgs (revision 33) @@ -0,0 +1,40 @@ +# sh testcase for mov $rm64, $rn64 +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global mov +mov: + mov #1, r0 + rotr r0 + mov #0, r15 + mov #10, r0 + + mov r0, r1 + mov r1, r2 + mov r2, r3 + mov r3, r4 + mov r4, r5 + mov r5, r6 + mov r6, r7 + mov r7, r8 + mov r8, r9 + mov r9, r10 + mov r10, r11 + mov r11, r12 + mov r12, r13 + mov r13, r14 + mov r14, r15 + + cmp/eq r0, r15 + bf wrong + +okay: + pass + +wrong: + fail Index: clrmac.cgs =================================================================== --- clrmac.cgs (nonexistent) +++ clrmac.cgs (revision 33) @@ -0,0 +1,13 @@ +# sh testcase for clrmac -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global clrmac +clrmac: + clrmac + pass Index: andb.cgs =================================================================== --- andb.cgs (nonexistent) +++ andb.cgs (revision 33) @@ -0,0 +1,24 @@ +# sh testcase for and.b #$imm8, @(r0, gbr) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global orb +init: + # Init GBR and R0. + mov #30, r0 + ldc r0, gbr + mov #40, r0 + +orb: + and.b #255, @(r0, gbr) + and.b #170, @(r0, gbr) + and.b #255, @(r0, gbr) + and.b #0, @(r0, gbr) + +okay: + pass Index: bra.cgs =================================================================== --- bra.cgs (nonexistent) +++ bra.cgs (revision 33) @@ -0,0 +1,23 @@ +# sh testcase for bra $disp12 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global bra +bra: + bra okay +slot: + nop +bad: + fail + fail + fail + .global okay +okay: + pass + fail + Index: float.cgs =================================================================== --- float.cgs (nonexistent) +++ float.cgs (revision 33) @@ -0,0 +1,80 @@ +# sh testcase for float -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +pos: + mov #3, r0 + lds r0, fpul + float fpul, fr7 + + # Check the result. + fldi1 fr0 + fldi1 fr1 + fadd fr0, fr1 + fadd fr0, fr1 + fcmp/eq fr1, fr7 + bf wrong + +neg: + mov #3, r0 + neg r0, r0 + lds r0, fpul + float fpul, fr7 + + # Check the result. + fldi1 fr0 + fldi1 fr1 + fadd fr0, fr1 + fadd fr0, fr1 + fneg fr1 + fcmp/eq fr1, fr7 + bf wrong + + bra double + nop + +wrong: + fail + +double: + mov #3, r0 + lds r0, fpul + _setpr + float fpul, dr8 + _clrpr + # check the result. + fldi1 fr0 + fldi1 fr1 + fadd fr0, fr1 + fadd fr0, fr1 + _s2d fr1, dr2 + fcmp/eq dr2, dr8 + bf wrong + +dneg: + mov #3, r0 + neg r0, r0 + lds r0, fpul + _setpr + float fpul, dr8 + _clrpr + # check the result. + fldi1 fr0 + fldi1 fr1 + fadd fr0, fr1 + fadd fr0, fr1 + fneg fr1 + _s2d fr1, dr2 + fcmp/eq dr2, dr8 + bf wrong + +okay: + pass + +wrong2: + fail Index: movw1.cgs =================================================================== --- movw1.cgs (nonexistent) +++ movw1.cgs (revision 33) @@ -0,0 +1,29 @@ +# sh testcase for mov.w $rm, @$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #30, r1 + shll8 r1 +init: + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + mov.w r2, @r1 +check: + # Read it back. + mov.w @r1, r3 + shll16 r2 + shll16 r3 + cmp/eq r2, r3 + bf wrong + +okay: + pass +wrong: + fail Index: braf.cgs =================================================================== --- braf.cgs (nonexistent) +++ braf.cgs (revision 33) @@ -0,0 +1,24 @@ +# sh testcase for braf $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global braf +braf: + mov #4, r0 + braf r0 +slot: + nop +bad: + fail + fail +okay: + pass +alsobad: + fail + fail + fail Index: movw3.cgs =================================================================== --- movw3.cgs (nonexistent) +++ movw3.cgs (revision 33) @@ -0,0 +1,31 @@ +# sh testcase for mov.w $rm, @(r0, $rn) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #0, r0 + mov #30, r1 + shll8 r1 +init: + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + mov.w r2, @(r0, r1) +check: + # Read it back. + mov.w @(r0, r1), r3 + shll16 r2 + shll16 r3 + cmp/eq r2, r3 + bf wrong + +okay: + pass +wrong: + fail + Index: cmppl.cgs =================================================================== --- cmppl.cgs (nonexistent) +++ cmppl.cgs (revision 33) @@ -0,0 +1,37 @@ +# sh testcase for cmp/pl $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +zero: + mov #0, r0 + cmp/pl r0 + bt wrong + +plus: + mov #10, r0 + cmp/pl r0 + bf wrong + +minus: + mov #10, r0 + neg r0, r0 + cmp/pl r0 + bt wrong + +large: + mov #10, r0 + shll8 r0 + add #123, r0 + cmp/pl r0 + bf wrong + +okay: + pass + +wrong: + fail Index: negc.cgs =================================================================== --- negc.cgs (nonexistent) +++ negc.cgs (revision 33) @@ -0,0 +1,66 @@ +# sh testcase for negc $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + .macro signbit sign + mov r1, r2 + shlr16 r2 + shlr8 r2 + shlr r2 + shlr r2 + shlr r2 + shlr r2 + shlr r2 + shlr r2 + shlr r2 + assert r2, \sign + .endm + start + + .global negc +negc: + clrt + mov #1, r0 + negc r0, r1 + signbit #1 + +negc2: + sett + mov #1, r0 + negc r0, r1 + signbit #1 + +negc3: + clrt + mov #0, r0 + negc r0, r1 + signbit #0 + +negc4: + sett + mov #0, r0 + negc r0, r1 + signbit #1 + +negc5: + clrt + mov #0, r0 + or #255, r0 + negc r0, r1 + signbit #1 + +negc6: + sett + mov #0, r0 + or #255, r0 + negc r0, r1 + signbit #1 + +okay: + pass + +wrong: + fail Index: movw5.cgs =================================================================== --- movw5.cgs (nonexistent) +++ movw5.cgs (revision 33) @@ -0,0 +1,32 @@ +# sh testcase for mov.w r0, @($imm4x2, $rn) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r1 + shll8 r1 + +init: + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + # Preserve. + mov r0, r7 +move: + mov.w r0, @(12, r1) +check: + mov.w @(12, r1), r0 + shll16 r0 + shll16 r7 + cmp/eq r0, r7 + bf wrong + +okay: + pass +wrong: + fail + Index: stcl-gbr.cgs =================================================================== --- stcl-gbr.cgs (nonexistent) +++ stcl-gbr.cgs (revision 33) @@ -0,0 +1,27 @@ +# sh testcase for stc.l gbr, @-$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global stcl_gbr +stcl_gbr: + mov #42, r0 + ldc r0, gbr + mov #40, r0 + shll8 r0 + # save address + mov r0, r1 + stc.l gbr, @-r0 + + add #4, r0 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: ldsl-pr.cgs =================================================================== --- ldsl-pr.cgs (nonexistent) +++ ldsl-pr.cgs (revision 33) @@ -0,0 +1,28 @@ +# sh testcase for lds.l @${rn}+, pr -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ldsl_pr +ldsl_pr: + mov #40, r0 + shll8 r0 + # Preserve address. + mov r0, r1 + lds.l @r0+, pr + + # Add 4 to saved address (r1). + # Then compare with r0. + add #4, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass + +wrong: + fail Index: brk.cgs =================================================================== --- brk.cgs (nonexistent) +++ brk.cgs (revision 33) @@ -0,0 +1,18 @@ +# sh testcase for brk -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + .global brk +brk: + # If we hit the breakpoint, the sim will stop. + pass + + # FIXME: breakpoint instruction. + # The SH4 assembler doesn't know about "brk". + .word 0x003b +bad: + fail Index: movw7.cgs =================================================================== --- movw7.cgs (nonexistent) +++ movw7.cgs (revision 33) @@ -0,0 +1,36 @@ +# sh testcase for mov.w @${rm}+, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r0 + shll8 r0 + # Preserve address. + mov r0, r7 + + # Store something first. + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + mov.w r2, @r0 +check: + # Read it back. + mov.w @r0+, r3 + cmp/eq r2, r3 + bf wrong + +inc: + # Ensure address is post-incremented. + add #2, r7 + cmp/eq r0, r7 + bf wrong + +okay: + pass +wrong: + fail + Index: movw9.cgs =================================================================== --- movw9.cgs (nonexistent) +++ movw9.cgs (revision 33) @@ -0,0 +1,33 @@ +# sh testcase for mov.w @($imm8x2, gbr), r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r0 + shll8 r0 + ldc r0, gbr + + # Store something first. + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + # Preserve r0. + mov r0, r7 + mov.w r0, @(12, gbr) + +check: + # Load it back. + mov.w @(12, gbr), r0 + shll16 r0 + shll16 r7 + cmp/eq r0, r7 + bf wrong + +okay: + pass +wrong: + fail Index: tsti.cgs =================================================================== --- tsti.cgs (nonexistent) +++ tsti.cgs (revision 33) @@ -0,0 +1,32 @@ +# sh testcase for tst #$imm8, r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global tsti +tsti: + mov #0, r0 + tst #0, r0 + +tsti2: + mov #0, r0 + tst #1, r0 + +tsti3: + mov #1, r0 + tst #0, r0 + +tsti4: + mov #1, r0 + tst #1, r0 + +tsti5: + mov #255, r0 + tst #255, r0 + +okay: + pass Index: fdiv.cgs =================================================================== --- fdiv.cgs (nonexistent) +++ fdiv.cgs (revision 33) @@ -0,0 +1,83 @@ +# sh testcase for fdiv -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + _clrpr + + # 1.0 / 0.0 should be INF + # (and not crash the sim). + fldi0 fr0 + fldi1 fr1 + fdiv fr0, fr1 + + # 0.0 / 1.0 == 0.0. + fldi0 fr0 + fldi1 fr1 + fdiv fr1, fr0 + fldi0 fr2 + fcmp/eq fr0, fr2 + bf wrong + + # 2.0 / 1.0 == 2.0. + fldi1 fr1 + fldi1 fr2 + fadd fr2, fr2 + fdiv fr1, fr2 + # Load 2.0 into fr3. + fldi1 fr3 + fadd fr3, fr3 + fcmp/eq fr2, fr3 + bf wrong + + # (1.0 / 2.0) + (1.0 / 2.0) == 1.0. + fldi1 fr1 + fldi1 fr2 + fadd fr2, fr2 + fdiv fr2, fr1 + # fr1 should contain 0.5. + fadd fr1, fr1 + # Load 1.0 into fr3. + fldi1 fr3 + # Compare fr1 with fr3. + fcmp/eq fr1, fr3 + bf wrong + + bra double + nop + +wrong: + fail + +double: + # double test + # (1.0 / 2.0) + (1.0 / 2.0) == 1.0. + fldi1 fr1 + _s2d fr1, dr6 + fldi1 fr2 + fadd fr2, fr2 + _s2d fr2, dr8 + _setpr + fdiv dr8, dr6 + # dr0 should contain 0.5. + # double it, expect 1.0. + fadd dr6, dr6 + _clrpr +foo: + # Load 1.0 into dr4. + fldi1 fr1 + _s2d fr1, dr10 + # Compare dr0 with dr10. + _setpr + fcmp/eq dr6, dr10 + bf wrong2 + _clrpr + +okay: + pass + +wrong2: + fail Index: cmppz.cgs =================================================================== --- cmppz.cgs (nonexistent) +++ cmppz.cgs (revision 33) @@ -0,0 +1,37 @@ +# sh testcase for cmp/pz $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +zero: + mov #0, r0 + cmp/pz r0 + bf wrong + +plus: + mov #10, r0 + cmp/pz r0 + bf wrong + +minus: + mov #10, r0 + neg r0, r0 + cmp/pz r0 + bt wrong + +large: + mov #10, r0 + shll8 r0 + add #123, r0 + cmp/pz r0 + bf wrong + +okay: + pass + +wrong: + fail Index: frchg.cgs =================================================================== --- frchg.cgs (nonexistent) +++ frchg.cgs (revision 33) @@ -0,0 +1,13 @@ +# sh testcase for frchg +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + frchg + frchg + frchg + frchg + pass Index: ocbwb.cgs =================================================================== --- ocbwb.cgs (nonexistent) +++ ocbwb.cgs (revision 33) @@ -0,0 +1,15 @@ +# sh testcase for ocbwb @$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ocbwb +ocbwb: + ocbwb @r0 + ocbwb @r1 + ocbwb @r15 + pass Index: lds-fpscr.cgs =================================================================== --- lds-fpscr.cgs (nonexistent) +++ lds-fpscr.cgs (revision 33) @@ -0,0 +1,22 @@ +# sh testcase for lds $rn, fpscr -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global lds_fpscr +lds_fpscr: + mov #0, r0 + lds r0, fpscr +readback: + sts fpscr, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: movl1.cgs =================================================================== --- movl1.cgs (nonexistent) +++ movl1.cgs (revision 33) @@ -0,0 +1,31 @@ +# sh testcase for mov.l $rm, @$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r1 + shll8 r1 +init: + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + shll8 r2 + add #85, r2 + shll8 r2 + add #170, r2 + + mov.l r2, @r1 + + # Load it back. + mov.l @r1, r3 + cmp/eq r2, r3 + bf wrong + +okay: + pass +wrong: + fail Index: movl3.cgs =================================================================== --- movl3.cgs (nonexistent) +++ movl3.cgs (revision 33) @@ -0,0 +1,36 @@ +# sh testcase for mov.l $rm, @(r0, $rn) +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +setaddr: + mov #0, r0 + mov #30, r1 + shll8 r1 + +init: + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + shll8 r2 + add #85, r2 + shll8 r2 + add #170, r2 + + mov.l r2, @(r0, r1) + +check: + # Load it back. + mov.l @(r0, r1), r3 + cmp/eq r2, r3 + bf wrong + +okay: + pass +wrong: + fail Index: swapw.cgs =================================================================== --- swapw.cgs (nonexistent) +++ swapw.cgs (revision 33) @@ -0,0 +1,43 @@ +# sh testcase for swap.w $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global swapw +swapw: + # Build up a characteristic bit pattern in R0. + mov #85, r0 + shll16 r0 + add #3, r0 + rotr r0 + rotr r0 + or #170, r0 + # Preserve for later. + mov r0, r8 + +test: + swap.w r0, r1 + mov #64, r0 + shll8 r0 + or #170, r0 + shll8 r0 + or #192, r0 + shll8 r0 + or #21, r0 + cmp/eq r1, r0 + bf wrong + +swapback: + swap.w r1, r2 + cmp/eq r2, r8 + bf wrong + +okay: + pass + +wrong: + fail Index: movl5.cgs =================================================================== --- movl5.cgs (nonexistent) +++ movl5.cgs (revision 33) @@ -0,0 +1,37 @@ +# sh testcase for mov.l $rm, @($imm4x4, $rn) -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +setaddr: + mov #30, r1 + shll8 r1 + +init: + # Build up a distinctive bit pattern. + mov #1, r0 + shll8 r0 + add #12, r0 + shll8 r0 + add #85, r0 + shll8 r0 + add #170, r0 + # Preserve. + mov r0, r7 + + mov.l r0, @(4, r1) +check: + # Load it back. + mov.l @(4, r1), r0 + cmp/eq r7, r0 + bf wrong + +okay: + pass + +wrong: + fail Index: mova.cgs =================================================================== --- mova.cgs (nonexistent) +++ mova.cgs (revision 33) @@ -0,0 +1,29 @@ +# sh testcase for mova @($imm8x4, pc), r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global mova +mova: + mova @(40, pc), r0 + mov #16, r1 + shll8 r1 + add #40, r1 + cmp/eq r0, r1 + bf wrong + mova @(12, pc), r0 + mov #16, r1 + shll8 r1 + add #24, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass + +wrong: + fail Index: dmulul.cgs =================================================================== --- dmulul.cgs (nonexistent) +++ dmulul.cgs (revision 33) @@ -0,0 +1,53 @@ +# sh testcase for dmulu.l $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #0, r0 + mov #0, r1 + dmulu.l r0, r1 + + mov #0, r0 + mov #5, r1 + dmulu.l r0, r1 + + mov #5, r0 + mov #0, r1 + dmulu.l r0, r1 + + mov #1, r0 + mov #5, r1 + dmulu.l r0, r1 + + mov #5, r0 + mov #1, r1 + dmulu.l r0, r1 + + mov #2, r0 + mov #2, r1 + dmulu.l r0, r1 + + mov #1, r0 + neg r0, r0 + mov #2, r1 + dmulu.l r0, r1 + + mov #1, r0 + neg r0, r0 + mov #1, r1 + neg r1, r1 + dmulu.l r0, r1 + + mov #1, r0 + neg r0, r0 + shlr r0 + mov #1, r1 + neg r1, r1 + shlr r1 + dmulu.l r0, r1 + + pass Index: clrt.cgs =================================================================== --- clrt.cgs (nonexistent) +++ clrt.cgs (revision 33) @@ -0,0 +1,16 @@ +# sh testcase for clrt -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global clrt +clrt: + clrt + bt wrong + pass +wrong: + fail Index: movl7.cgs =================================================================== --- movl7.cgs (nonexistent) +++ movl7.cgs (revision 33) @@ -0,0 +1,37 @@ +# sh testcase for mov.l @$rm+, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + mov #30, r0 + shll8 r0 + # Preserve address. + mov r0, r7 + # Store something first. + mov #170, r3 + mov.l r3, @r0 + + mov.l @r0+, r1 +check: + cmp/eq r1, r3 + bf wrong + + # Ensure address is post-incremented. + add #4, r7 + cmp/eq r7, r0 + bf wrong + +equal: + # Test rm = rn. + mov #30, r0 + shll8 r0 + mov.l @r0+, r0 + +okay: + pass +wrong: + fail Index: movl9.cgs =================================================================== --- movl9.cgs (nonexistent) +++ movl9.cgs (revision 33) @@ -0,0 +1,24 @@ +# sh testcase for mov.l @($imm8x4, gbr), r0 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + mov #30, r1 + shll8 r1 + ldc r1, gbr + # Store something there first. + mov #170, r0 + mov r0, r7 + mov.l r0, @(12, gbr) +check: + # Load it back. + mov.l @(12, gbr), r0 + cmp/eq r0, r7 + +okay: + pass +wrong: + fail Index: shll16.cgs =================================================================== --- shll16.cgs (nonexistent) +++ shll16.cgs (revision 33) @@ -0,0 +1,44 @@ +# sh testcase for shll16 $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global shll16 +shll16: + mov #108, r1 + shll16 r1 + shll16 r1 + assert r1, #0 + +another: + mov #1, r1 + shll16 r1 + mov #1, r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + shll r7 + cmp/eq r1, r7 + bf wrong + +okay: + pass + +wrong: + fail Index: movi.cgs =================================================================== --- movi.cgs (nonexistent) +++ movi.cgs (revision 33) @@ -0,0 +1,39 @@ +# sh testcase for mov #$imm8, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global movi +movi: + mov #0, r0 + cmp/eq #0, r0 + bf wrong + + mov #1, r0 + cmp/eq #1, r0 + bf wrong + + mov #255, r0 + cmp/eq #255, r0 + bf wrong + + mov #1, r15 + mov #1, r0 + cmp/eq r0, r15 + bf wrong + + mov #255, r15 + mov r15, r0 + cmp/eq r0, r15 + bf wrong + +okay: + pass + +wrong: + fail + Index: extsw.cgs =================================================================== --- extsw.cgs (nonexistent) +++ extsw.cgs (revision 33) @@ -0,0 +1,32 @@ +# sh testcase for exts.w $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global extsw +extsw: + mov #42, r1 + exts.w r1, r2 + assert r2, #42 + +another: + mov #0, r0 + or #255, r0 + shll8 r0 + exts.w r0, r1 + + mov #-1, r7 + shll8 r7 + cmp/eq r1, r7 + bf wrong + +okay: + pass + +wrong: + fail + Index: macl.cgs =================================================================== --- macl.cgs (nonexistent) +++ macl.cgs (revision 33) @@ -0,0 +1,76 @@ +# sh testcase for mac.l @${rm}+, @${rn}+ +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + # force S-bit clear + clrs + + # Store some magic numbers in memory. + mov #40, r1 + shll8 r1 + mov #85, r0 + mov.l r0, @r1 + # Keep for later. + mov r1, r10 +store2: + mov #40, r1 + shll8 r1 + add #12, r1 + mov #17, r0 + mov.l r0, @r1 + # Keep for later. + mov r1, r11 + +init: + # Set up addresses. + mov #40, r1 + shll8 r1 + mov #40, r2 + shll8 r2 + add #12, r2 + + # Prime {MACL, MACH} to #1. + mov #1, r3 + dmulu.l r3, r3 + +test: + mac.l @r1+, @r2+ + +check: + # Check result. + sts mach, r5 + assert r5, #0 + + mov #5, r0 + shll8 r0 + or #166, r0 + sts macl, r6 + cmp/eq r6, r0 + bf wrong + + # Ensure post-increment occurred. + add #4, r10 + cmp/eq r10, r1 + bf wrong + + add #4, r11 + cmp/eq r11, r2 + bf wrong + +doubleinc: + mov #40, r0 + shll8 r0 + mov r0, r1 + mac.l @r0+, @r0+ + add #16, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: movl10.cgs =================================================================== --- movl10.cgs (nonexistent) +++ movl10.cgs (revision 33) @@ -0,0 +1,34 @@ +# sh testcase for mov.l @($imm8x4, pc), $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + +init: + # Build up a distinctive bit pattern. + mov #1, r2 + shll8 r2 + add #12, r2 + shll8 r2 + add #85, r2 + shll8 r2 + add #170, r2 + + # Store to memory. + mov #16, r1 + shll8 r1 + add #32, r1 + mov.l r2, @r1 +check: + # Read it back. + mov.l @(12, pc), r0 + cmp/eq r2, r0 + bf wrong + +okay: + pass +wrong: + fail Index: sts-mach.cgs =================================================================== --- sts-mach.cgs (nonexistent) +++ sts-mach.cgs (revision 33) @@ -0,0 +1,22 @@ +# sh testcase for sts mach, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sts_mach +sts_mach: + mov #42, r0 + lds r0, mach + sts mach, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail + Index: sett.cgs =================================================================== --- sett.cgs (nonexistent) +++ sett.cgs (revision 33) @@ -0,0 +1,16 @@ +# sh testcase for sett -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sett +sett: + sett + bf wrong + pass +wrong: + fail Index: sts-macl.cgs =================================================================== --- sts-macl.cgs (nonexistent) +++ sts-macl.cgs (revision 33) @@ -0,0 +1,21 @@ +# sh testcase for sts macl, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sts_macl +sts_macl: + mov #42, r0 + lds r0, macl + sts macl, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail Index: bsr.cgs =================================================================== --- bsr.cgs (nonexistent) +++ bsr.cgs (revision 33) @@ -0,0 +1,21 @@ +# sh testcase for bsr $disp12 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global bsr +bsr: + bsr okay +slot: + nop +bad: + fail + fail +okay: + pass +alsobad: + fail Index: sub.cgs =================================================================== --- sub.cgs (nonexistent) +++ sub.cgs (revision 33) @@ -0,0 +1,68 @@ +# sh testcase for sub $rm, $rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global sub1 +sub1: + # 0 - x. + mov #0, r0 + mov #3, r1 + sub r1, r0 + + mov #2, r7 + not r7, r7 + cmp/eq r7, r0 + bf wrong + + .global sub2 +sub2: + # x - 0. + mov #0, r0 + mov #3, r1 + sub r0, r1 + assert r1, #3 + + .global sub3 +sub3: + # x - y. + mov #4, r0 + mov #3, r1 + sub r0, r1 + + mov #0, r7 + not r7, r7 + cmp/eq r7, r1 + bf wrong + + .global sub4 +sub4: + # y - x. + mov #4, r0 + mov #3, r1 + sub r1, r0 + assert r0, #1 + + .global sub5 +sub5: + # y - y == 0 (where y are in two distinct registers). + mov #4, r0 + mov #4, r1 + sub r1, r0 + assert r0, #0 + + .global sub6 +sub6: + # y - y = 0 (where y is the same register). + mov #4, r1 + sub r1, r1 + assert r1, #0 + +okay: + pass +wrong: + fail Index: testutils.inc =================================================================== --- testutils.inc (nonexistent) +++ testutils.inc (revision 33) @@ -0,0 +1,49 @@ +# Support macros for the assembly test cases. + + .macro start + .text + .global start +start: + .endm + + # Perform a single to double precision floating point conversion. + .macro _s2d fpr dpr + flds \fpr, fpul + _setpr + fcnvsd fpul, \dpr + _clrpr + .endm + + # Set the PR (PRecision) bit in the FPSCR. + .macro _setpr + sts fpscr, r7 + mov #8, r8 + shll16 r8 + or r8, r7 + lds r7, fpscr + .endm + + # Clear the PR bit. + .macro _clrpr + sts fpscr, r7 + mov #8, r8 + shll16 r8 + not r8, r8 + and r8, r7 + lds r7, fpscr + .endm + + # nb: this macro clobbers R7. + .macro assert reg value + mov \value, r7 + cmp/eq \reg, r7 + bf wrong + .endm + + .macro pass + trapa #253 + .endm + + .macro fail + trapa #254 + .endm Index: ftrc.cgs =================================================================== --- ftrc.cgs (nonexistent) +++ ftrc.cgs (revision 33) @@ -0,0 +1,132 @@ +# sh testcase for ftrc -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + # ftrc(0.0) = 0. + fldi0 fr0 + ftrc fr0, fpul + # check results. + mov #0, r0 + sts fpul, r1 + cmp/eq r0, r1 + bf wrong + + # ftrc(1.5) = 1. + fldi1 fr0 + fldi1 fr1 + fldi1 fr2 + # double it. + fadd fr2, fr2 + # form the fraction. + fdiv fr2, fr1 + fadd fr1, fr0 + # now we've got 1.5 in fr0. + ftrc fr0, fpul + # check results. + mov #1, r0 + sts fpul, r1 + cmp/eq r0, r1 + bf wrong + + # ftrc(-1.5) = -1. + fldi1 fr0 + fneg fr0 + fldi1 fr1 + fldi1 fr2 + # double it. + fadd fr2, fr2 + # form the fraction. + fdiv fr2, fr1 + fneg fr1 + # -1 + -0.5 = -1.5. + fadd fr1, fr0 + # now we've got 1.5 in fr0. + ftrc fr0, fpul + # check results. + mov #1, r0 + neg r0, r0 + sts fpul, r1 + cmp/eq r0, r1 + bf wrong + + bra double + nop + +wrong: + fail + +double: + # ftrc(0.0) = 0. + fldi0 fr0 + _s2d fr0, dr0 + _setpr + ftrc dr0, fpul + _clrpr + # check results. + mov #0, r0 + sts fpul, r1 + cmp/eq r0, r1 +foo: + bf wrong2 + + # ftrc(1.5) = 1. + fldi1 fr0 + fldi1 fr2 + fldi1 fr4 + # double it. + fadd fr4, fr4 + # form 0.5. + fdiv fr4, fr2 + fadd fr2, fr0 + # now we've got 1.5 in fr0, so do some single->double + # conversions and perform the ftrc. + _s2d fr0, dr0 + _s2d fr2, dr2 + _s2d fr4, dr4 + _setpr + ftrc dr0, fpul + _clrpr + + # check results. + mov #1, r0 + sts fpul, r1 + cmp/eq r0, r1 + bf wrong2 + + # ftrc(-1.5) = -1. + fldi1 fr0 + fneg fr0 + fldi1 fr2 + fldi1 fr4 + # double it. + fadd fr4, fr4 + # form the fraction. + fdiv fr4, fr2 + fneg fr2 + # -1 + -0.5 = -1.5. + fadd fr2, fr0 + # now we've got 1.5 in fr0, so do some single->double + # conversions and perform the ftrc. + _s2d fr0, dr0 + _s2d fr2, dr2 + _s2d fr4, dr4 + _setpr + ftrc dr0, fpul + _clrpr + + # check results. + mov #1, r0 + neg r0, r0 + sts fpul, r1 + cmp/eq r0, r1 + bf wrong2 + +okay: + pass +wrong2: + fail Index: jsr.cgs =================================================================== --- jsr.cgs (nonexistent) +++ jsr.cgs (revision 33) @@ -0,0 +1,29 @@ +# sh testcase for jsr @$rn -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global jsr +jsr: + # Load 0x1010 into r0. + mov #1, r0 + shll8 r0 + shll2 r0 + shll2 r0 + add #16, r0 + jsr @r0 +slot: + nop +bad: + fail +okay: + pass +alsobad: + fail + fail + fail + Index: fipr.cgs =================================================================== --- fipr.cgs (nonexistent) +++ fipr.cgs (revision 33) @@ -0,0 +1,44 @@ +# sh testcase for fipr $fvm, $fvn +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start +initv1: + fldi1 fr0 + # Load 2 into fr2. + fldi1 fr1 + fadd fr1, fr1 + # Load 4 into fr2. + fldi1 fr2 + fadd fr2, fr2 + fadd fr2, fr2 + fldi0 fr3 + +initv2: + fldi1 fr8 + fldi0 fr9 + fldi1 fr10 + fldi0 fr11 + + fipr fv0, fv8 + + # Result will be in fr11. + fldi1 fr0 + fldi1 fr1 + # Two. + fadd fr1, fr0 + # Four. + fadd fr0, fr0 + # Five. + fadd fr1, fr0 + fcmp/eq fr0, fr11 + bf wrong + +okay: + pass + +wrong: + fail Index: and.cgs =================================================================== --- and.cgs (nonexistent) +++ and.cgs (revision 33) @@ -0,0 +1,33 @@ +# sh testcase for and $rm64, $rn64 -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global and +and: + mov #1, r1 + mov #7, r2 + rotr r2 + rotr r2 + and r1, r2 + + # R1 & R2 = 1. + assert r2, #1 + +another: + mov #192, r1 + mov #0, r2 + and r1, r2 + + # R1 & R2 = 0. + assert r2, #0 + +okay: + pass + +wrong: + fail Index: ldsl-fpul.cgs =================================================================== --- ldsl-fpul.cgs (nonexistent) +++ ldsl-fpul.cgs (revision 33) @@ -0,0 +1,27 @@ +# sh testcase for lds.l @${rn}+, fpul -*- Asm -*- +# mach: all +# as: -isa=shcompact +# ld: -m shelf32 + + .include "compact/testutils.inc" + + start + + .global ldsl_fpul +ldsl_fpul: + mov #40, r0 + shll8 r0 + # remember the address. + mov r0, r1 + lds.l @r0+, fpul + + # ensure post increment occurred. + add #4, r1 + cmp/eq r0, r1 + bf wrong + +okay: + pass +wrong: + fail +

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.