2002-06-14 Chris Demetriou <cgd@broadcom.com>
Ed Satterthwaite <ehs@broadcom.com>
* mips3d.igen: New file which contains MIPS-3D ASE instructions.
* Makefile.in (IGEN_INCLUDE): Add mips3d.igen.
* mips.igen: Include mips3d.igen.
(mips3d): New model name for MIPS-3D ASE instructions.
(CVT.W.fmt): Don't use this instruction for word (source) format
instructions.
* cp1.c (fp_binary_r, fp_add_r, fp_mul_r, fpu_inv1, fpu_inv1_32)
(fpu_inv1_64, fp_recip1, fp_recip2, fpu_inv_sqrt1, fpu_inv_sqrt1_32)
(fpu_inv_sqrt1_64, fp_rsqrt1, fp_rsqrt2): New functions.
(NR_FRAC_GUARD, IMPLICIT_1): New macros.
* sim-main.h (fmt_pw, CompareAbs, AddR, MultiplyR, Recip1, Recip2)
(RSquareRoot1, RSquareRoot2): New macros.
(fp_add_r, fp_mul_r, fp_recip1, fp_recip2, fp_rsqrt1)
(fp_rsqrt2): New functions.
* configure.in: Add MIPS-3D support to mipsisa64 simulator.
* configure: Regenerate.
2002-06-14 18:49:09 +00:00
|
|
|
// -*- C -*-
|
|
|
|
|
|
|
|
// Simulator definition for the MIPS MIPS-3D ASE.
|
|
|
|
// Copyright (C) 2002 Free Software Foundation, Inc.
|
2003-05-02 22:17:21 +00:00
|
|
|
// Contributed by Ed Satterthwaite and Chris Demetriou, of Broadcom
|
|
|
|
// Corporation (SiByte).
|
2002-06-14 Chris Demetriou <cgd@broadcom.com>
Ed Satterthwaite <ehs@broadcom.com>
* mips3d.igen: New file which contains MIPS-3D ASE instructions.
* Makefile.in (IGEN_INCLUDE): Add mips3d.igen.
* mips.igen: Include mips3d.igen.
(mips3d): New model name for MIPS-3D ASE instructions.
(CVT.W.fmt): Don't use this instruction for word (source) format
instructions.
* cp1.c (fp_binary_r, fp_add_r, fp_mul_r, fpu_inv1, fpu_inv1_32)
(fpu_inv1_64, fp_recip1, fp_recip2, fpu_inv_sqrt1, fpu_inv_sqrt1_32)
(fpu_inv_sqrt1_64, fp_rsqrt1, fp_rsqrt2): New functions.
(NR_FRAC_GUARD, IMPLICIT_1): New macros.
* sim-main.h (fmt_pw, CompareAbs, AddR, MultiplyR, Recip1, Recip2)
(RSquareRoot1, RSquareRoot2): New macros.
(fp_add_r, fp_mul_r, fp_recip1, fp_recip2, fp_rsqrt1)
(fp_rsqrt2): New functions.
* configure.in: Add MIPS-3D support to mipsisa64 simulator.
* configure: Regenerate.
2002-06-14 18:49:09 +00:00
|
|
|
//
|
|
|
|
// 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
|
2007-08-24 14:30:15 +00:00
|
|
|
// the Free Software Foundation; either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
2002-06-14 Chris Demetriou <cgd@broadcom.com>
Ed Satterthwaite <ehs@broadcom.com>
* mips3d.igen: New file which contains MIPS-3D ASE instructions.
* Makefile.in (IGEN_INCLUDE): Add mips3d.igen.
* mips.igen: Include mips3d.igen.
(mips3d): New model name for MIPS-3D ASE instructions.
(CVT.W.fmt): Don't use this instruction for word (source) format
instructions.
* cp1.c (fp_binary_r, fp_add_r, fp_mul_r, fpu_inv1, fpu_inv1_32)
(fpu_inv1_64, fp_recip1, fp_recip2, fpu_inv_sqrt1, fpu_inv_sqrt1_32)
(fpu_inv_sqrt1_64, fp_rsqrt1, fp_rsqrt2): New functions.
(NR_FRAC_GUARD, IMPLICIT_1): New macros.
* sim-main.h (fmt_pw, CompareAbs, AddR, MultiplyR, Recip1, Recip2)
(RSquareRoot1, RSquareRoot2): New macros.
(fp_add_r, fp_mul_r, fp_recip1, fp_recip2, fp_rsqrt1)
(fp_rsqrt2): New functions.
* configure.in: Add MIPS-3D support to mipsisa64 simulator.
* configure: Regenerate.
2002-06-14 18:49:09 +00:00
|
|
|
// 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.
|
2007-08-24 14:30:15 +00:00
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2002-06-14 Chris Demetriou <cgd@broadcom.com>
Ed Satterthwaite <ehs@broadcom.com>
* mips3d.igen: New file which contains MIPS-3D ASE instructions.
* Makefile.in (IGEN_INCLUDE): Add mips3d.igen.
* mips.igen: Include mips3d.igen.
(mips3d): New model name for MIPS-3D ASE instructions.
(CVT.W.fmt): Don't use this instruction for word (source) format
instructions.
* cp1.c (fp_binary_r, fp_add_r, fp_mul_r, fpu_inv1, fpu_inv1_32)
(fpu_inv1_64, fp_recip1, fp_recip2, fpu_inv_sqrt1, fpu_inv_sqrt1_32)
(fpu_inv_sqrt1_64, fp_rsqrt1, fp_rsqrt2): New functions.
(NR_FRAC_GUARD, IMPLICIT_1): New macros.
* sim-main.h (fmt_pw, CompareAbs, AddR, MultiplyR, Recip1, Recip2)
(RSquareRoot1, RSquareRoot2): New macros.
(fp_add_r, fp_mul_r, fp_recip1, fp_recip2, fp_rsqrt1)
(fp_rsqrt2): New functions.
* configure.in: Add MIPS-3D support to mipsisa64 simulator.
* configure: Regenerate.
2002-06-14 18:49:09 +00:00
|
|
|
|
|
|
|
// 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));
|
|
|
|
}
|