2004-04-10 Chris Demetriou <cgd@broadcom.com>
[deliverable/binutils-gdb.git] / sim / testsuite / sim / mips / utils-fpu.inc
CommitLineData
cdc89eb2
CD
1# MIPS simulator testsuite FPU utility functions.
2# Copyright (C) 2004 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 2, or (at your option)
10# 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 along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 ###
22 ### Data movement macros
23 ###
24
25 .macro ld_fp_df r, v
26 .data
271: .double \v
28 .previous
29 ldc1 \r, 1b
30 .endm
31
32 .macro ld_fp_di r, v
33 .data
341: .dword \v
35 .previous
36 ldc1 \r, 1b
37 .endm
38
39 .macro ld_fp_sf r, v
40 .data
411: .float \v
42 .previous
43 lwc1 \r, 1b
44 .endm
45
46 .macro ld_fp_si r, v
47 .data
481: .word \v
49 .previous
50 lwc1 \r, 1b
51 .endm
52
53
54 ###
55 ### FP condition code manipulation macros
56 ###
57
58 .macro clrset_fp_cc clr, set
59 cfc1 $20, $31
60 or $20, $20, (((\clr & 0xf7) << 24) | ((\clr & 0x01) << 23))
61 xor $20, $20, (((\clr & 0xf7) << 24) | ((\clr & 0x01) << 23))
62 or $20, $20, (((\set & 0xf7) << 24) | ((\set & 0x01) << 23))
63 ctc1 $20, $31
64 .endm
65
66 .macro clr_fp_cc clr
67 clrset_fp_cc \clr, 0
68 .endm
69
70 .macro set_fp_cc set
71 clrset_fp_cc 0, \set
72 .endm
73
74 .macro get_fp_cc r
75 .set push
76 .set noat
77 cfc1 $1, $31
78 srl $1, $1, 23
79 andi \r, $1, 0x1fc
80 andi $1, $1, 0x1
81 srl \r, \r, 1
82 or \r, \r, $1
83 .set pop
84 .endm
85
86 .macro ck_fp_cc v
87 get_fp_cc $20
88 xori $20, $20, \v
89 bnez $20, _fail
90 nop
91 .endm
This page took 0.025311 seconds and 4 git commands to generate.