]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/testsuite/sim/mips/utils-fpu.inc
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / sim / testsuite / sim / mips / utils-fpu.inc
CommitLineData
cdc89eb2 1# MIPS simulator testsuite FPU utility functions.
6aba47ca 2# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
cdc89eb2
CD
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
adad0f8a
CD
21 .macro enable_fpu fr
22 mfc0 $20, $12
23 or $20, $20, (1 << 29) | (\fr << 26)
24 mtc0 $20, $20
25 .endm
26
cdc89eb2
CD
27 ###
28 ### Data movement macros
29 ###
30
31 .macro ld_fp_df r, v
32 .data
331: .double \v
34 .previous
35 ldc1 \r, 1b
36 .endm
37
38 .macro ld_fp_di r, v
39 .data
401: .dword \v
41 .previous
42 ldc1 \r, 1b
43 .endm
44
45 .macro ld_fp_sf r, v
46 .data
471: .float \v
48 .previous
49 lwc1 \r, 1b
50 .endm
51
52 .macro ld_fp_si r, v
53 .data
541: .word \v
55 .previous
56 lwc1 \r, 1b
57 .endm
58
59
60 ###
61 ### FP condition code manipulation macros
62 ###
63
64 .macro clrset_fp_cc clr, set
65 cfc1 $20, $31
adad0f8a
CD
66 or $20, $20, (((\clr & 0xfe) << 24) | ((\clr & 0x01) << 23))
67 xor $20, $20, (((\clr & 0xfe) << 24) | ((\clr & 0x01) << 23))
68 or $20, $20, (((\set & 0xfe) << 24) | ((\set & 0x01) << 23))
cdc89eb2
CD
69 ctc1 $20, $31
70 .endm
71
72 .macro clr_fp_cc clr
73 clrset_fp_cc \clr, 0
74 .endm
75
76 .macro set_fp_cc set
77 clrset_fp_cc 0, \set
78 .endm
79
80 .macro get_fp_cc r
81 .set push
82 .set noat
83 cfc1 $1, $31
84 srl $1, $1, 23
85 andi \r, $1, 0x1fc
86 andi $1, $1, 0x1
87 srl \r, \r, 1
88 or \r, \r, $1
89 .set pop
90 .endm
91
92 .macro ck_fp_cc v
93 get_fp_cc $20
94 xori $20, $20, \v
95 bnez $20, _fail
96 nop
97 .endm
adad0f8a
CD
98
99 .macro ckm_fp_cc v, mask
100 get_fp_cc $20
101 xori $20, $20, \v
102 andi $20, $20, \mask
103 bnez $20, _fail
104 nop
105 .endm