OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [mips/] [utils-fpu.inc] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# MIPS simulator testsuite FPU utility functions.
2
# Copyright (C) 2004, 2007, 2008 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 .  */
19
 
20
        .macro  enable_fpu fr
21
        mfc0    $20, $12
22
        or      $20, $20, (1 << 29) | (\fr << 26)
23
        mtc0    $20, $20
24
        .endm
25
 
26
        ###
27
        ### Data movement macros
28
        ###
29
 
30
        .macro ld_fp_df r, v
31
        .data
32
1:      .double \v
33
        .previous
34
        ldc1    \r, 1b
35
        .endm
36
 
37
        .macro ld_fp_di r, v
38
        .data
39
1:      .dword  \v
40
        .previous
41
        ldc1    \r, 1b
42
        .endm
43
 
44
        .macro ld_fp_sf r, v
45
        .data
46
1:      .float  \v
47
        .previous
48
        lwc1    \r, 1b
49
        .endm
50
 
51
        .macro ld_fp_si r, v
52
        .data
53
1:      .word   \v
54
        .previous
55
        lwc1    \r, 1b
56
        .endm
57
 
58
 
59
        ###
60
        ### FP condition code manipulation macros
61
        ###
62
 
63
        .macro clrset_fp_cc clr, set
64
        cfc1    $20, $31
65
        or      $20, $20, (((\clr & 0xfe) << 24) | ((\clr & 0x01) << 23))
66
        xor     $20, $20, (((\clr & 0xfe) << 24) | ((\clr & 0x01) << 23))
67
        or      $20, $20, (((\set & 0xfe) << 24) | ((\set & 0x01) << 23))
68
        ctc1    $20, $31
69
        .endm
70
 
71
        .macro clr_fp_cc clr
72
        clrset_fp_cc \clr, 0
73
        .endm
74
 
75
        .macro set_fp_cc set
76
        clrset_fp_cc 0, \set
77
        .endm
78
 
79
        .macro get_fp_cc r
80
        .set push
81
        .set noat
82
        cfc1    $1, $31
83
        srl     $1, $1, 23
84
        andi    \r, $1, 0x1fc
85
        andi    $1, $1, 0x1
86
        srl     \r, \r, 1
87
        or      \r, \r, $1
88
        .set pop
89
        .endm
90
 
91
        .macro ck_fp_cc v
92
        get_fp_cc $20
93
        xori    $20, $20, \v
94
        bnez    $20, _fail
95
         nop
96
        .endm
97
 
98
        .macro ckm_fp_cc v, mask
99
        get_fp_cc $20
100
        xori    $20, $20, \v
101
        andi    $20, $20, \mask
102
        bnez    $20, _fail
103
         nop
104
        .endm

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.