# fr30 testcase for stm1 ($reglist_low)
# mach(): fr30

	.include "testutils.inc"

	START

	.text
	.global stm1
stm1:
	; Test stm1 ($reglist_low)
	mvr_h_gr	sp,r1		; save stack pointer temporarily
	mvr_h_gr	sp,r2		; save stack pointer permanently
	mvi_h_gr   	8,r8
	mvi_h_gr   	9,r9
	mvi_h_gr   	10,r10
	mvi_h_gr   	11,r11
	mvi_h_gr   	12,r12
	mvi_h_gr   	13,r13
	mvi_h_gr   	14,r14
	set_cc          0x0f		; Condition codes should not change
	stm1      	(r8,r10,r12,r14)
	test_cc		1 1 1 1
	inci_h_gr	-4,r1
	test_h_mem	14,r1
	inci_h_gr	-4,r1
	test_h_mem	12,r1
	inci_h_gr	-4,r1
	test_h_mem	10,r1
	inci_h_gr	-4,r1
	testr_h_mem	8,r1

	mvr_h_gr	r2,sp		; restore stack pointer
	mvr_h_gr	r2,r1		; save stack pointer temporarily
	mvi_h_gr   	8,r8
	mvi_h_gr   	9,r9
	mvi_h_gr   	10,r10
	mvi_h_gr   	11,r11
	mvi_h_gr   	12,r12
	mvi_h_gr   	13,r13
	mvi_h_gr   	14,r14
	set_cc          0x0f		; Condition codes should not change
	stm1      	(r9,r11,r13,r15)
	test_cc		1 1 1 1
	inci_h_gr	-4,r1
	testr_h_mem	r2,r1
	inci_h_gr	-4,r1
	test_h_mem	13,r1
	inci_h_gr	-4,r1
	test_h_mem	11,r1
	inci_h_gr	-4,r1
	test_h_mem	9,r1		; saved r15 is from before stm1

	mvr_h_gr	r2,sp		; restore stack pointer
	mvr_h_gr	r2,r1		; save stack pointer temporarily
	mvi_h_gr   	8,r8
	mvi_h_gr   	9,r9
	mvi_h_gr   	10,r10
	mvi_h_gr   	11,r11
	mvi_h_gr   	12,r12
	mvi_h_gr   	13,r13
	mvi_h_gr   	14,r14
	set_cc          0x0f		; Condition codes should not change
	stm1      	(r9,r13,r15,r11); Order specified should not matter
	test_cc		1 1 1 1
	inci_h_gr	-4,r1
	testr_h_mem	r2,r1
	inci_h_gr	-4,r1
	test_h_mem	13,r1
	inci_h_gr	-4,r1
	test_h_mem	11,r1
	inci_h_gr	-4,r1
	test_h_mem	9,r1		; saved r15 is from before stm1

	mvr_h_gr	r2,sp		; restore stack pointer
	mvr_h_gr	r2,r1		; save stack pointer temporarily
	mvi_h_gr   	9,r8
	mvi_h_gr   	9,r9
	mvi_h_gr   	9,r10
	mvi_h_gr   	9,r11
	mvi_h_gr   	9,r12
	mvi_h_gr   	9,r13
	mvi_h_gr   	9,r14
	set_cc          0x0f		; Condition codes should not change
	stm1      	()		; should do nothing
	test_cc		1 1 1 1
	testr_h_gr	r2,sp
	inci_h_gr	-4,r1
	testr_h_mem	r2,r1
	inci_h_gr	-4,r1
	test_h_mem	13,r1
	inci_h_gr	-4,r1
	test_h_mem	11,r1
	inci_h_gr	-4,r1
	test_h_mem	9,r1

	pass
