--- /dev/null
+# m32r testcase for add $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global add
+add:
+
+ mvi_h_gr r4, 1
+ mvi_h_gr r5, 2
+ add r4, r5
+ test_h_gr r4, 3
+
+ pass
--- /dev/null
+# m32r testcase for add3 $dr,$sr,#$slo16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global add3
+add3:
+
+ mvi_h_gr r5, 1
+ add3 r4, r5, 2
+ test_h_gr r4, 3
+
+ pass
--- /dev/null
+# m32r testcase for addi $dr,#$simm8
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global addi
+addi:
+
+ mvi_h_gr r5, 1
+ addi r5, 2
+ test_h_gr r5, 3
+
+ pass
+
--- /dev/null
+# m32r testcase for addv $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global addv
+addv:
+
+ pass
--- /dev/null
+# m32r testcase for addv3 $dr,$sr,#$simm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global addv3
+addv3:
+
+ pass
--- /dev/null
+# m32r testcase for and $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global and
+and:
+
+ pass
--- /dev/null
+# m32r testcase for and3 $dr,$sr,#$uimm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global and3
+and3:
+
+ pass
--- /dev/null
+# m32r testcase for bc $disp24
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bc24
+bc24:
+
+ mvi_h_condbit 0
+ bc.l test0fail
+ bra test0pass
+test0fail:
+ fail
+test0pass:
+
+ mvi_h_condbit 1
+ bc.l test1pass
+ fail
+test1pass:
+
+ pass
+
--- /dev/null
+# m32r testcase for bc $disp8
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bc8
+bc8:
+
+ mvi_h_condbit 0
+ bc.s test0fail
+ bra test0pass
+test0fail:
+ fail
+test0pass:
+
+ mvi_h_condbit 1
+ bc.s test1pass
+ fail
+test1pass:
+
+ pass
--- /dev/null
+# m32r testcase for beq $src1,$src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global beq
+beq:
+
+ pass
--- /dev/null
+# m32r testcase for beqz $src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global beqz
+beqz:
+
+ pass
--- /dev/null
+# m32r testcase for bgez $src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bgez
+bgez:
+
+ pass
--- /dev/null
+# m32r testcase for bgtz $src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bgtz
+bgtz:
+
+ pass
--- /dev/null
+# m32r testcase for blez $src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global blez
+blez:
+
+ pass
--- /dev/null
+# m32r testcase for bltz $src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bltz
+bltz:
+
+ pass
--- /dev/null
+# m32r testcase for bnc $disp24
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bnc24
+bnc24:
+
+ pass
--- /dev/null
+# m32r testcase for bnc $disp8
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bnc8
+bnc8:
+
+ pass
--- /dev/null
+# m32r testcase for bne $src1,$src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bne
+bne:
+
+ pass
--- /dev/null
+# m32r testcase for bnez $src2,$disp16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bnez
+bnez:
+
+ pass
--- /dev/null
+# m32r testcase for bra $disp24
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bra24
+bra24:
+
+ pass
--- /dev/null
+# m32r testcase for bra $disp8
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global bra8
+bra8:
+
+ pass
--- /dev/null
+# m32r testcase for cmp $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp
+cmp:
+
+ pass
--- /dev/null
+# m32r testcase for cmpi $src2,#$simm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmpi
+cmpi:
+
+ pass
--- /dev/null
+# m32r testcase for cmpu $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmpu
+cmpu:
+
+ pass
--- /dev/null
+# m32r testcase for cmpui $src2,#$uimm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmpui
+cmpui:
+
+ pass
--- /dev/null
+# m32r testcase for div $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global div
+div:
+
+ pass
--- /dev/null
+# m32r testcase for divu $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global divu
+divu:
+
+ pass
--- /dev/null
+# output: Hello world!
+
+ .globl _start
+_start:
+
+; write (hello world)
+ ldi8 r3,#14
+ ld24 r2,#hello
+ ldi8 r1,#1
+ ldi8 r0,#5
+ trap #0
+; exit (0)
+ ldi8 r1,#0
+ ldi8 r0,#1
+ trap #0
+
+length: .long 14
+hello: .ascii "Hello world!\r\n"
--- /dev/null
+# m32r testcase for ld $dr,@($slo16,$sr)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ld_d
+ld_d:
+
+ pass
--- /dev/null
+# m32r testcase for ld $dr,@$sr+
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ld_plus
+ld_plus:
+
+ pass
--- /dev/null
+# m32r testcase for ld $dr,@$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ld
+ld:
+
+ pass
--- /dev/null
+# m32r testcase for ld24 $dr,#$uimm24
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ld24
+ld24:
+
+ pass
--- /dev/null
+# m32r testcase for ldb $dr,@($slo16,$sr)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldb_d
+ldb_d:
+
+ pass
--- /dev/null
+# m32r testcase for ldb $dr,@$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldb
+ldb:
+
+ pass
--- /dev/null
+# m32r testcase for ldh $dr,@($slo16,$sr)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldh_d
+ldh_d:
+
+ pass
--- /dev/null
+# m32r testcase for ldh $dr,@$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldh
+ldh:
+
+ pass
--- /dev/null
+# m32r testcase for ldi $dr,$slo16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldi16
+ldi16:
+
+ pass
--- /dev/null
+# m32r testcase for ldi $dr,#$simm8
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldi8
+ldi8:
+
+ pass
--- /dev/null
+# m32r testcase for ldub $dr,@($slo16,$sr)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldub_d
+ldub_d:
+
+ pass
--- /dev/null
+# m32r testcase for ldub $dr,@$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldub
+ldub:
+
+ pass
--- /dev/null
+# m32r testcase for lduh $dr,@($slo16,$sr)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global lduh_d
+lduh_d:
+
+ pass
--- /dev/null
+# m32r testcase for lduh $dr,@$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global lduh
+lduh:
+
+ pass
--- /dev/null
+# m32r testcase for lock $dr,@$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global lock
+lock:
+
+ pass
--- /dev/null
+# m32r testcase for machi $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global machi
+machi:
+
+ mvi_h_accum0 0, 1
+ mvi_h_gr r4, 0x10123
+ mvi_h_gr r5, 0x20456
+ machi r4, r5
+ test_h_accum0 0, 0x20001
+
+ pass
--- /dev/null
+# m32r testcase for maclo $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global maclo
+maclo:
+
+ mvi_h_accum0 0, 1
+ mvi_h_gr r4, 0x1230001
+ mvi_h_gr r5, 0x4560002
+ maclo r4, r5
+ test_h_accum0 0, 0x20001
+
+ pass
--- /dev/null
+# m32r testcase for macwhi $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global macwhi
+macwhi:
+
+ pass
--- /dev/null
+# m32r testcase for macwlo $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global macwlo
+macwlo:
+
+ pass
--- /dev/null
+# m32r testcase for mul $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mul
+mul:
+
+ pass
--- /dev/null
+# m32r testcase for mulhi $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mulhi
+mulhi:
+
+ mvi_h_gr r4, 0x40000
+ mvi_h_gr r5, 0x50000
+ mulhi r4, r5
+ test_h_accum0 0, 0x140000
+
+ pass
--- /dev/null
+# m32r testcase for mullo $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mullo
+mullo:
+
+ mvi_h_gr r4, 4
+ mvi_h_gr r5, 5
+ mullo r4, r5
+ test_h_accum0 0, 0x140000
+
+ pass
--- /dev/null
+# m32r testcase for mulwhi $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mulwhi
+mulwhi:
+
+ pass
--- /dev/null
+# m32r testcase for mulwlo $src1,$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mulwlo
+mulwlo:
+
+ pass
--- /dev/null
+# m32r testcase for mv $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mv
+mv:
+
+ pass
--- /dev/null
+# m32r testcase for mvfachi $dr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvfachi
+mvfachi:
+
+ pass
--- /dev/null
+# m32r testcase for mvfaclo $dr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvfaclo
+mvfaclo:
+
+ pass
--- /dev/null
+# m32r testcase for mvfacmi $dr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvfacmi
+mvfacmi:
+
+ mvi_h_accum0 0x12345678, 0x87654321
+ mvfacmi r4
+ test_h_gr r4, 0x56788765
+
+ pass
--- /dev/null
+# m32r testcase for mvtachi $src1
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvtachi
+mvtachi:
+
+ pass
--- /dev/null
+# m32r testcase for mvtaclo $src1
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvtaclo
+mvtaclo:
+
+ pass
--- /dev/null
+# m32r testcase for mvtc $sr,$dcr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvtc
+mvtc:
+
+ pass
--- /dev/null
+# m32r testcase for neg $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global neg
+neg:
+
+ pass
--- /dev/null
+# m32r testcase for nop
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global nop
+nop:
+
+ pass
--- /dev/null
+# m32r testcase for not $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global not
+not:
+
+ pass
--- /dev/null
+# m32r testcase for or $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global or
+or:
+
+ pass
--- /dev/null
+# m32r testcase for or3 $dr,$sr,#$ulo16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global or3
+or3:
+
+ pass
--- /dev/null
+# m32r testcase for rac $accd
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global rac_d
+rac_d:
+
+ pass
--- /dev/null
+# m32r testcase for rac $accd,$accs
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global rac_ds
+rac_ds:
+
+ pass
--- /dev/null
+# m32r testcase for rac
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global rac
+rac:
+
+ mvi_h_accum0 1, 0x4001
+ rac
+ test_h_accum0 2, 0x10000
+
+ mvi_h_accum0 0x3fff, 0xffff4000
+ rac
+ test_h_accum0 0x7fff, 0xffff0000
+
+ mvi_h_accum0 0xffff8000, 0
+ rac
+ test_h_accum0 0xffff8000, 0
+
+ pass
--- /dev/null
+# m32r testcase for rach $accd
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global rach_d
+rach_d:
+
+ pass
--- /dev/null
+# m32r testcase for rach $accd,$accs
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global rach_ds
+rach_ds:
+
+ pass
--- /dev/null
+# m32r testcase for rach
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global rach
+rach:
+
+ pass
--- /dev/null
+# m32r testcase for rem $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global rem
+rem:
+
+ pass
--- /dev/null
+# m32r testcase for seth $dr,#$hi16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global seth
+seth:
+
+ pass
--- /dev/null
+# m32r testcase for sll $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global sll
+sll:
+
+ pass
--- /dev/null
+# m32r testcase for sll3 $dr,$sr,#$simm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global sll3
+sll3:
+
+ pass
--- /dev/null
+# m32r testcase for slli $dr,#$uimm5
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global slli
+slli:
+
+ pass
--- /dev/null
+# m32r testcase for sra $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global sra
+sra:
+
+ pass
--- /dev/null
+# m32r testcase for sra3 $dr,$sr,#$simm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global sra3
+sra3:
+
+ pass
--- /dev/null
+# m32r testcase for srai $dr,#$uimm5
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global srai
+srai:
+
+ pass
--- /dev/null
+# m32r testcase for srl $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global srl
+srl:
+
+ pass
--- /dev/null
+# m32r testcase for srl3 $dr,$sr,#$simm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global srl3
+srl3:
+
+ pass
--- /dev/null
+# m32r testcase for srli $dr,#$uimm5
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global srli
+srli:
+
+ pass
--- /dev/null
+# m32r testcase for st $src1,@($slo16,$src2)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global st_d
+st_d:
+
+ pass
--- /dev/null
+# m32r testcase for st $src1,@-$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global st_minus
+st_minus:
+
+ pass
--- /dev/null
+# m32r testcase for st $src1,@+$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global st_plus
+st_plus:
+
+ pass
--- /dev/null
+# m32r testcase for st $src1,@$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global st
+st:
+
+ pass
--- /dev/null
+# m32r testcase for stb $src1,@($slo16,$src2)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global stb_d
+stb_d:
+
+ pass
--- /dev/null
+# m32r testcase for stb $src1,@$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global stb
+stb:
+
+ pass
--- /dev/null
+# m32r testcase for sth $src1,@($slo16,$src2)
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global sth_d
+sth_d:
+
+ pass
--- /dev/null
+# m32r testcase for sth $src1,@$src2
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global sth
+sth:
+
+ pass
--- /dev/null
+# m32r testcase for sub $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global sub
+sub:
+
+ pass
--- /dev/null
+# m32r testcase for subv $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global subv
+subv:
+
+ pass
--- /dev/null
+# m32r testcase for subx $dr,$sr
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global subx
+subx:
+
+ pass
--- /dev/null
+# r0-r3 are used as tmps, consider them call clobbered by these macros.
+
+ .macro start
+ .data
+failmsg:
+ .ascii "fail\n"
+passmsg:
+ .ascii "pass\n"
+ .text
+ .global _start
+_start:
+ .endm
+
+ .macro exit rc
+ ldi8 r1, \rc
+ ldi8 r0, #1
+ trap #0
+ .endm
+
+ .macro pass
+ ldi8 r3, 5
+ ld24 r2, passmsg
+ ldi8 r1, 1
+ ldi8 r0, 5
+ trap #0
+ exit 0
+ .endm
+
+ .macro fail
+ ldi8 r3, 5
+ ld24 r2, failmsg
+ ldi8 r1, 1
+ ldi8 r0, 5
+ trap #0
+ exit 1
+ .endm
+
+ .macro mvi_h_gr reg, val
+ .if (\val >= -128) && (\val <= 127)
+ ldi8 \reg, \val
+ .else
+ seth \reg, high(\val)
+ or3 \reg, \reg, low(\val)
+ .endif
+ .endm
+
+# Other macros know this only clobbers r0.
+ .macro test_h_gr reg, val
+ mvi_h_gr r0, \val
+ beq \reg, r0, test_gr\@
+ fail
+test_gr\@:
+ .endm
+
+ .macro mvi_h_condbit val
+ ldi8 r0, 0
+ ldi8 r1, 1
+ .if \val
+ cmp r0, r1
+ .else
+ cmp r1, r0
+ .endif
+ .endm
+
+ .macro test_h_condbit val
+ .if \val
+ bc test_c1\@
+ fail
+test_c1\@:
+ .else
+ bnc test_c0\@
+ fail
+test_c0\@:
+ .endif
+ .endm
+
+ .macro mvi_h_accum0 hi, lo
+ mvi_h_gr r0, \hi
+ mvtachi r0
+ mvi_h_gr r0, \lo
+ mvtaclo r0
+ .endm
+
+ .macro test_h_accum0 hi, lo
+ mvfachi r1
+ test_h_gr r1, \hi
+ mvfaclo r1
+ test_h_gr r1, \lo
+ .endm
+
+# start-sanitize-m32rx
+ .macro mvi_h_accum1 hi, lo
+ mvi_h_gr r0, \hi
+ mvtachi r0, a1
+ mvi_h_gr r0, \lo
+ mvtaclo r0, a1
+ .endm
+
+ .macro test_h_accum1 hi, lo
+ mvfachi r1, a1
+ test_h_gr r1, \hi
+ mvfaclo r1, a1
+ test_h_gr r1, \lo
+ .endm
+# end-sanitize-m32rx
--- /dev/null
+# m32r testcase for xor3 $dr,$sr,#$uimm16
+# mach(): m32r m32rx
+
+ .include "testutils.inc"
+
+ start
+
+ .global xor3
+xor3:
+
+ pass