# 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
