1# MIPS simulator testsuite MDMX utility functions.
2# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
3# Contributed by Chris Demetriou of Broadcom Corporation.
4#
5# This file is part of the GNU simulators.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20	.include "utils-fpu.inc"
21
22	###
23	### Shared macros
24	###
25
26	# Enable MDMX: enable the FPU w/ FR=1, then set Status.MX
27	.macro	enable_mdmx
28	enable_fpu 1
29	mfc0	$20, $12
30	or	$20, $20, (1 << 24)
31	mtc0	$20, $12
32	.endm
33
34
35	###
36	### .OB-format macros
37	###
38
39	.macro ld_ob r, v
40	.data
411:	.dword	\v
42	.previous
43	ldc1	\r, 1b
44	.endm
45
46	.macro ck_ob r, v
47	.data
481:	.dword	\v
49	.previous
50	dmfc1	$20, \r
51	ld	$21, 1b
52	bne	$20, $21, _fail
53	 nop
54	.endm
55
56	.macro ld_acc_ob h, m, l
57	ld_ob	$f20, \m
58	ld_ob	$f21, \l
59	wacl.ob	$f20, $f21
60	ld_ob	$f20, \h
61	wach.ob	$f20
62	.endm
63
64	.macro ck_acc_ob h, m, l
65	rach.ob	$f20
66	ck_ob	$f20, \h
67	racm.ob	$f20
68	ck_ob	$f20, \m
69	racl.ob	$f20
70	ck_ob	$f20, \l
71	.endm
72