aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/sh/ldrc.s
blob: 444131302f4b67559a5113ce7172fce6c9689027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# sh testcase for ldrc, strc
# mach: shdsp
# as(shdsp):	-defsym sim_cpu=1 -dsp 

	.include "testutils.inc"

	start

setrc_imm:
	set_grs_a5a5
	# Test setrc
	#
	ldrs	lstart
	ldre	lend
	setrc	#0xff
	get_sr	r1
	shlr16	r1
	set_greg 0xfff, r0
	and	r0, r1
	assertreg 0xff, r1

	stc	rs, r0	! rs unchanged
	assertreg0	lstart
	stc	re, r0	! re unchanged
	assertreg0	lend

	set_greg 0xa5a5a5a5, r0
	set_greg 0xa5a5a5a5, r1

	test_grs_a5a5

setrc_reg:
	set_grs_a5a5
	# Test setrc
	#
	ldrs	lstart
	ldre	lend
	set_greg	0xfff, r0
	setrc	r0
	get_sr	r1
	shlr16	r1
	set_greg 0xfff, r0
	and	r0, r1
	assertreg 0xfff, r1

	stc	rs, r0	! rs unchanged
	assertreg0	lstart
	stc	re, r0	! re unchanged
	assertreg0	lend

	set_greg 0xa5a5a5a5, r0
	set_greg 0xa5a5a5a5, r1

	test_grs_a5a5

	bra	ldrc_imm

	.global lstart
	.align 2
lstart:	nop
	nop
	nop
	nop
	.global lend
	.align 2
lend:	nop
	nop
	nop
	nop

ldrc_imm:
	set_grs_a5a5
	# Test ldrc
	setrc	#0x0	! zero rc
	ldrc	#0xa5
	get_sr	r1
	shlr16	r1
	set_greg 0xfff, r0
	and	r0, r1
	assertreg 0xa5, r1
	stc	rs, r0	! rs unchanged
	assertreg0	lstart
	stc	re, r0
	assertreg0	lend+1	! bit 0 set in re

	# fix up re for next test
	dt	r0	! Ugh!  No DEC insn!
	ldc	r0, re

	set_greg 0xa5a5a5a5, r0
	set_greg 0xa5a5a5a5, r1

	test_grs_a5a5

ldrc_reg:
	set_grs_a5a5
	# Test ldrc
	setrc	#0x0	! zero rc
	set_greg 0xa5a, r0
	ldrc	r0
	get_sr	r1
	shlr16	r1
	set_greg 0xfff, r0
	and	r0, r1
	assertreg 0xa5a, r1
	stc	rs, r0	! rs unchanged
	assertreg0	lstart
	stc	re, r0
	assertreg0	lend+1	! bit 0 set in re

	set_greg 0xa5a5a5a5, r0
	set_greg 0xa5a5a5a5, r1

	test_grs_a5a5

	pass
	exit 0