aboutsummaryrefslogtreecommitdiff
path: root/sim/mips/mips3d.igen
blob: f7043efcac00791a8f0cf2c5ff6ed38cc2f0bd85 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// -*- C -*-

// Simulator definition for the MIPS MIPS-3D ASE.
// Copyright (C) 2002 Free Software Foundation, Inc.
// Contributed by Broadcom Corporation (SiByte).
//
// This file is part of GDB, the GNU debugger.
// 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

//  Reference: MIPS64 Architecture for Programmers Volume IV-c:
//             The MIPS-3D Application-Specific Extension to the
//             MIPS64 Architecture.  (MIPS Document MD00099)


010001,10,110,5.FT,5.FS,5.FD,011000:COP1:64,f::ADDR.PS
"addr.ps f<FD>, f<FS>, f<FT>"
*mips3d:
{
  /* fd.PL = ft.PU + ft.PL;  fd.PU = fs.PU + fs.PL;  */
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  StoreFPR (FD, fmt_ps, AddR (ValueFPR (FS, fmt_ps),
			      ValueFPR (FT, fmt_ps), fmt_ps));
}


010001,01001,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY2tf
"bc1any2%s<TF> <CC>, %#lx<OFFSET>"
*mips3d:
{
  address_word offset;
  int cc = CC;
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  if ((cc & 0x1) != 0)
    Unpredictable ();
  if ((GETFCC (cc) == TF) || (GETFCC (cc + 1) == TF))
    {
      offset = (EXTEND16 (OFFSET) << 2);
      DELAY_SLOT (NIA + offset);
    }
}


010001,01010,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY4tf
"bc1any4%s<TF> <CC>, %#lx<OFFSET>"
*mips3d:
{
  address_word offset;
  int cc = CC;
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  if ((cc & 0x3) != 0)
    Unpredictable ();
  if ((GETFCC (cc) == TF)
      || (GETFCC (cc + 1) == TF)
      || (GETFCC (cc + 2) == TF)
      || (GETFCC (cc + 3) == TF))
    {
      offset = (EXTEND16 (OFFSET) << 2);
      DELAY_SLOT (NIA + offset);
    }
}


010001,10,3.FMT,5.FT,5.FS,3.CC,01,11,4.COND:COP1:64,f::CABS.cond.fmt
"cabs.%s<COND>.%s<FMT> <CC>, f<FS>, f<FT>"
*mips3d:
{
  int fmt = FMT;
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  check_fmt_p (SD_, fmt, instruction_0);
  CompareAbs (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, CC);
  TRACE_ALU_RESULT (ValueFCR (31));
}


010001,10,110,00000,5.FS,5.FD,100100:COP1:64,f::CVT.PW.PS
"cvt.pw.ps f<FD>, f<FS>"
*mips3d:
{
  /* fd.pu = cvt_rnd (fs.pu); fd.pl = cvt_rnd (fs.pl);  */
  /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word.  */
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  StoreFPR (FD, fmt_pw, ConvertPS (GETRM (), ValueFPR (FS, fmt_ps),
				   fmt_ps, fmt_word));
}


010001,10,100,00000,5.FS,5.FD,100110:COP1:64,f::CVT.PS.PW
"cvt.ps.pw f<FD>, f<FS>"
*mips3d:
{
  /* fd.pl = cvt_rnd (fs.pl); fd.pu = cvt_rnd (fs.pu);  */
  /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word.  */
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  StoreFPR (FD, fmt_ps, ConvertPS (GETRM (), ValueFPR (FS, fmt_pw),
				   fmt_word, fmt_ps));
}


010001,10,110,5.FT,5.FS,5.FD,011010:COP1:64,f::MULR.PS
"mulr.ps f<FD>, f<FS>, f<FT>"
*mips3d:
{
  /* fd.PL = ft.PU * ft.PL;  fd.PU = fs.PU * fs.PL;  */
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  StoreFPR (FD, fmt_ps, MultiplyR (ValueFPR (FS, fmt_ps),
				   ValueFPR (FT, fmt_ps), fmt_ps));
}


010001,10,3.FMT,00000,5.FS,5.FD,011101:COP1:64,f::RECIP1.fmt
"recip1.%s<FMT> f<FD>, f<FS>"
*mips3d:
{
  int fmt = FMT;
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  check_fmt_p (SD_, fmt, instruction_0);
  StoreFPR (FD, fmt, Recip1 (ValueFPR (FS, fmt), fmt));
}


010001,10,3.FMT,5.FT,5.FS,5.FD,011100:COP1:64,f::RECIP2.fmt
"recip2.%s<FMT> f<FD>, f<FS>, f<FT>"
*mips3d:
{
  int fmt = FMT;
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  check_fmt_p (SD_, fmt, instruction_0);
  StoreFPR (FD, fmt, Recip2 (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
}


010001,10,3.FMT,00000,5.FS,5.FD,011110:COP1:64,f::RSQRT1.fmt
"rsqrt1.%s<FMT> f<FD>, f<FS>"
*mips3d:
{
  int fmt = FMT;
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  check_fmt_p (SD_, fmt, instruction_0);
  StoreFPR (FD, fmt, RSquareRoot1 (ValueFPR (FS, fmt), fmt));
}


010001,10,3.FMT,5.FT,5.FS,5.FD,011111:COP1:64,f::RSQRT2.fmt
"rsqrt2.%s<FMT> f<FD>, f<FS>, f<FT>"
*mips3d:
{
  int fmt = FMT;
  check_fpu (SD_);
  check_u64 (SD_, instruction_0);
  check_fmt_p (SD_, fmt, instruction_0);
  StoreFPR (FD, fmt, RSquareRoot2 (ValueFPR (FS, fmt),
				   ValueFPR (FT, fmt), fmt));
}