summaryrefslogtreecommitdiff
path: root/sim/testsuite/sim/sh64/compact/testutils.inc
blob: b1ad830578b7fd4a71f7ddd68e99a7953df5ac8e (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
# 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