mips3d.igen 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. // -*- C -*-
  2. // Simulator definition for the MIPS MIPS-3D ASE.
  3. // Copyright (C) 2002-2022 Free Software Foundation, Inc.
  4. // Contributed by Ed Satterthwaite and Chris Demetriou, of Broadcom
  5. // Corporation (SiByte).
  6. //
  7. // This file is part of GDB, the GNU debugger.
  8. //
  9. // This program is free software; you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation; either version 3 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. // Reference: MIPS64 Architecture for Programmers Volume IV-c:
  22. // The MIPS-3D Application-Specific Extension to the
  23. // MIPS64 Architecture. (MIPS Document MD00099)
  24. 010001,10,110,5.FT,5.FS,5.FD,011000:COP1:64,f::ADDR.PS
  25. "addr.ps f<FD>, f<FS>, f<FT>"
  26. *mips3d:
  27. {
  28. /* fd.PL = ft.PU + ft.PL; fd.PU = fs.PU + fs.PL; */
  29. check_fpu (SD_);
  30. check_u64 (SD_, instruction_0);
  31. StoreFPR (FD, fmt_ps, AddR (ValueFPR (FS, fmt_ps),
  32. ValueFPR (FT, fmt_ps), fmt_ps));
  33. }
  34. 010001,01001,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY2tf
  35. "bc1any2%s<TF> <CC>, %#lx<OFFSET>"
  36. *mips3d:
  37. {
  38. address_word offset;
  39. int cc = CC;
  40. check_fpu (SD_);
  41. check_u64 (SD_, instruction_0);
  42. if ((cc & 0x1) != 0)
  43. Unpredictable ();
  44. if ((GETFCC (cc) == TF) || (GETFCC (cc + 1) == TF))
  45. {
  46. offset = (EXTEND16 (OFFSET) << 2);
  47. DELAY_SLOT (NIA + offset);
  48. }
  49. }
  50. 010001,01010,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY4tf
  51. "bc1any4%s<TF> <CC>, %#lx<OFFSET>"
  52. *mips3d:
  53. {
  54. address_word offset;
  55. int cc = CC;
  56. check_fpu (SD_);
  57. check_u64 (SD_, instruction_0);
  58. if ((cc & 0x3) != 0)
  59. Unpredictable ();
  60. if ((GETFCC (cc) == TF)
  61. || (GETFCC (cc + 1) == TF)
  62. || (GETFCC (cc + 2) == TF)
  63. || (GETFCC (cc + 3) == TF))
  64. {
  65. offset = (EXTEND16 (OFFSET) << 2);
  66. DELAY_SLOT (NIA + offset);
  67. }
  68. }
  69. 010001,10,3.FMT,5.FT,5.FS,3.CC,01,11,4.COND:COP1:64,f::CABS.cond.fmt
  70. "cabs.%s<COND>.%s<FMT> <CC>, f<FS>, f<FT>"
  71. *mips3d:
  72. {
  73. int fmt = FMT;
  74. check_fpu (SD_);
  75. check_u64 (SD_, instruction_0);
  76. check_fmt_p (SD_, fmt, instruction_0);
  77. CompareAbs (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, CC);
  78. TRACE_ALU_RESULT (ValueFCR (31));
  79. }
  80. 010001,10,110,00000,5.FS,5.FD,100100:COP1:64,f::CVT.PW.PS
  81. "cvt.pw.ps f<FD>, f<FS>"
  82. *mips3d:
  83. {
  84. /* fd.pu = cvt_rnd (fs.pu); fd.pl = cvt_rnd (fs.pl); */
  85. /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word. */
  86. check_fpu (SD_);
  87. check_u64 (SD_, instruction_0);
  88. StoreFPR (FD, fmt_pw, ConvertPS (GETRM (), ValueFPR (FS, fmt_ps),
  89. fmt_ps, fmt_word));
  90. }
  91. 010001,10,100,00000,5.FS,5.FD,100110:COP1:64,f::CVT.PS.PW
  92. "cvt.ps.pw f<FD>, f<FS>"
  93. *mips3d:
  94. {
  95. /* fd.pl = cvt_rnd (fs.pl); fd.pu = cvt_rnd (fs.pu); */
  96. /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word. */
  97. check_fpu (SD_);
  98. check_u64 (SD_, instruction_0);
  99. StoreFPR (FD, fmt_ps, ConvertPS (GETRM (), ValueFPR (FS, fmt_pw),
  100. fmt_word, fmt_ps));
  101. }
  102. 010001,10,110,5.FT,5.FS,5.FD,011010:COP1:64,f::MULR.PS
  103. "mulr.ps f<FD>, f<FS>, f<FT>"
  104. *mips3d:
  105. {
  106. /* fd.PL = ft.PU * ft.PL; fd.PU = fs.PU * fs.PL; */
  107. check_fpu (SD_);
  108. check_u64 (SD_, instruction_0);
  109. StoreFPR (FD, fmt_ps, MultiplyR (ValueFPR (FS, fmt_ps),
  110. ValueFPR (FT, fmt_ps), fmt_ps));
  111. }
  112. 010001,10,3.FMT,00000,5.FS,5.FD,011101:COP1:64,f::RECIP1.fmt
  113. "recip1.%s<FMT> f<FD>, f<FS>"
  114. *mips3d:
  115. {
  116. int fmt = FMT;
  117. check_fpu (SD_);
  118. check_u64 (SD_, instruction_0);
  119. check_fmt_p (SD_, fmt, instruction_0);
  120. StoreFPR (FD, fmt, Recip1 (ValueFPR (FS, fmt), fmt));
  121. }
  122. 010001,10,3.FMT,5.FT,5.FS,5.FD,011100:COP1:64,f::RECIP2.fmt
  123. "recip2.%s<FMT> f<FD>, f<FS>, f<FT>"
  124. *mips3d:
  125. {
  126. int fmt = FMT;
  127. check_fpu (SD_);
  128. check_u64 (SD_, instruction_0);
  129. check_fmt_p (SD_, fmt, instruction_0);
  130. StoreFPR (FD, fmt, Recip2 (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
  131. }
  132. 010001,10,3.FMT,00000,5.FS,5.FD,011110:COP1:64,f::RSQRT1.fmt
  133. "rsqrt1.%s<FMT> f<FD>, f<FS>"
  134. *mips3d:
  135. {
  136. int fmt = FMT;
  137. check_fpu (SD_);
  138. check_u64 (SD_, instruction_0);
  139. check_fmt_p (SD_, fmt, instruction_0);
  140. StoreFPR (FD, fmt, RSquareRoot1 (ValueFPR (FS, fmt), fmt));
  141. }
  142. 010001,10,3.FMT,5.FT,5.FS,5.FD,011111:COP1:64,f::RSQRT2.fmt
  143. "rsqrt2.%s<FMT> f<FD>, f<FS>, f<FT>"
  144. *mips3d:
  145. {
  146. int fmt = FMT;
  147. check_fpu (SD_);
  148. check_u64 (SD_, instruction_0);
  149. check_fmt_p (SD_, fmt, instruction_0);
  150. StoreFPR (FD, fmt, RSquareRoot2 (ValueFPR (FS, fmt),
  151. ValueFPR (FT, fmt), fmt));
  152. }