gem5  v20.1.0.0
op_encodings.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2017 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * For use for simulation and test purposes only
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Authors: Anthony Gutierrez
34  */
35 
37 
38 #include <iomanip>
39 
40 namespace Gcn3ISA
41 {
42  // --- Inst_SOP2 base class methods ---
43 
44  Inst_SOP2::Inst_SOP2(InFmt_SOP2 *iFmt, const std::string &opcode)
46  {
47  setFlag(Scalar);
48 
49  // copy first instruction DWORD
50  instData = iFmt[0];
51  if (hasSecondDword(iFmt)) {
52  // copy second instruction DWORD into union
53  extData = ((MachInst)iFmt)[1];
54  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
55  varSize = 4 + 4;
56  } else {
57  varSize = 4;
58  } // if
59  } // Inst_SOP2
60 
61  int
63  {
64  return varSize;
65  } // instSize
66 
67  bool
69  {
70  if (iFmt->SSRC0 == REG_SRC_LITERAL)
71  return true;
72 
73  if (iFmt->SSRC1 == REG_SRC_LITERAL)
74  return true;
75 
76  return false;
77  }
78 
79  void
81  {
82  std::stringstream dis_stream;
83  dis_stream << _opcode << " ";
84  dis_stream << opSelectorToRegSym(instData.SDST) << ", ";
85 
87  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
88  << _srcLiteral << ", ";
89  } else {
90  dis_stream << opSelectorToRegSym(instData.SSRC0) << ", ";
91  }
92 
94  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
95  << _srcLiteral;
96  } else {
97  dis_stream << opSelectorToRegSym(instData.SSRC1);
98  }
99 
100  disassembly = dis_stream.str();
101  }
102 
103  bool
105  {
106  assert(opIdx >= 0);
107  assert(opIdx < getNumOperands());
108 
109  switch (opIdx) {
110  case 0:
111  return isScalarReg(instData.SSRC0);
112  case 1:
113  return isScalarReg(instData.SSRC1);
114  case 2:
115  return isScalarReg(instData.SDST);
116  default:
117  fatal("Operand at idx %i does not exist\n", opIdx);
118  return false;
119  }
120  }
121 
122  bool
124  {
125  assert(opIdx >= 0);
126  assert(opIdx < getNumOperands());
127 
128  // SOP2 instructions cannot access VGPRs
129  return false;
130  }
131 
132  int
134  {
135  assert(opIdx >= 0);
136  assert(opIdx < getNumOperands());
137 
138  switch (opIdx) {
139  case 0:
141  gpuDynInst->wavefront()->reservedScalarRegs);
142  case 1:
144  gpuDynInst->wavefront()->reservedScalarRegs);
145  case 2:
147  gpuDynInst->wavefront()->reservedScalarRegs);
148  default:
149  fatal("Operand at idx %i does not exist\n", opIdx);
150  return -1;
151  }
152  }
153 
154  // --- Inst_SOPK base class methods ---
155 
156  Inst_SOPK::Inst_SOPK(InFmt_SOPK *iFmt, const std::string &opcode)
158  {
159  setFlag(Scalar);
160 
161  // copy first instruction DWORD
162  instData = iFmt[0];
163  if (hasSecondDword(iFmt)) {
164  // copy second instruction DWORD into union
165  extData = ((MachInst)iFmt)[1];
166  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
167  varSize = 4 + 4;
168  } else {
169  varSize = 4;
170  } // if
171  } // Inst_SOPK
172 
174  {
175  } // ~Inst_SOPK
176 
177  int
179  {
180  return varSize;
181  } // instSize
182 
183  bool
185  {
186  /*
187  SOPK can be a 64-bit instruction, i.e., have a second dword:
188  S_SETREG_IMM32_B32 writes some or all of the LSBs of a 32-bit
189  literal constant into a hardware register;
190  the way to detect such special case is to explicitly check the
191  opcode (20/0x14)
192  */
193  if (iFmt->OP == 0x14)
194  return true;
195 
196  return false;
197  }
198 
199 
200  void
202  {
203  std::stringstream dis_stream;
204  dis_stream << _opcode << " ";
205 
206  // S_SETREG_IMM32_B32 is a 64-bit instruction, using a
207  // 32-bit literal constant
208  if (instData.OP == 0x14) {
209  dis_stream << "0x" << std::hex << std::setfill('0')
210  << std::setw(8) << extData.imm_u32 << ", ";
211  } else {
212  dis_stream << opSelectorToRegSym(instData.SDST) << ", ";
213  }
214 
215  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(4)
216  << instData.SIMM16;
217 
218  disassembly = dis_stream.str();
219  }
220 
221  bool
223  {
224  assert(opIdx >= 0);
225  assert(opIdx < getNumOperands());
226 
227  switch (opIdx) {
228  case 0:
229  return false;
230  case 1:
231  return isScalarReg(instData.SDST);
232  default:
233  fatal("Operand at idx %i does not exist\n", opIdx);
234  return false;
235  }
236  }
237 
238  bool
240  {
241  assert(opIdx >= 0);
242  assert(opIdx < getNumOperands());
243 
244  // SOPK instruction cannot access VGPRs
245  return false;
246  }
247 
248  int
250  {
251  assert(opIdx >= 0);
252  assert(opIdx < getNumOperands());
253 
254  switch (opIdx) {
255  case 0:
256  return -1;
257  case 1:
259  gpuDynInst->wavefront()->reservedScalarRegs);
260  default:
261  fatal("Operand at idx %i does not exist\n", opIdx);
262  return -1;
263  }
264  }
265 
266  // --- Inst_SOP1 base class methods ---
267 
268  Inst_SOP1::Inst_SOP1(InFmt_SOP1 *iFmt, const std::string &opcode)
270  {
271  setFlag(Scalar);
272 
273  // copy first instruction DWORD
274  instData = iFmt[0];
275  if (hasSecondDword(iFmt)) {
276  // copy second instruction DWORD into union
277  extData = ((MachInst)iFmt)[1];
278  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
279  varSize = 4 + 4;
280  } else {
281  varSize = 4;
282  } // if
283  } // Inst_SOP1
284 
286  {
287  } // ~Inst_SOP1
288 
289  int
291  {
292  return varSize;
293  } // instSize
294 
295  bool
297  {
298  if (iFmt->SSRC0 == REG_SRC_LITERAL)
299  return true;
300 
301  return false;
302  }
303 
304  void
306  {
307  std::stringstream dis_stream;
308  dis_stream << _opcode << " ";
309  dis_stream << opSelectorToRegSym(instData.SDST) << ", ";
310 
311  if (instData.SSRC0 == REG_SRC_LITERAL) {
312  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
313  << extData.imm_u32;
314  } else {
315  dis_stream << opSelectorToRegSym(instData.SSRC0);
316  }
317 
318  disassembly = dis_stream.str();
319  }
320 
321  bool
323  {
324  assert(opIdx >= 0);
325  assert(opIdx < getNumOperands());
326 
327  switch (opIdx) {
328  case 0:
329  if (instData.OP == 0x1C) {
330  // Special case for s_getpc, which has no source reg.
331  // Instead, it implicitly reads the PC.
332  return isScalarReg(instData.SDST);
333  }
334  return isScalarReg(instData.SSRC0);
335  case 1:
336  return isScalarReg(instData.SDST);
337  default:
338  fatal("Operand at idx %i does not exist\n", opIdx);
339  return false;
340  }
341  }
342 
343  bool
345  {
346  assert(opIdx >= 0);
347  assert(opIdx < getNumOperands());
348 
349  // SOP1 instruction cannot access VGPRs
350  return false;
351  }
352 
353  int
355  {
356  assert(opIdx >= 0);
357  assert(opIdx < getNumOperands());
358 
359  switch (opIdx) {
360  case 0:
361  if (instData.OP == 0x1C) {
362  // Special case for s_getpc, which has no source reg.
363  // Instead, it implicitly reads the PC.
365  gpuDynInst->wavefront()->reservedScalarRegs);
366  }
368  gpuDynInst->wavefront()->reservedScalarRegs);
369  case 1:
371  gpuDynInst->wavefront()->reservedScalarRegs);
372  default:
373  fatal("Operand at idx %i does not exist\n", opIdx);
374  return -1;
375  }
376  }
377 
378  // --- Inst_SOPC base class methods ---
379 
380  Inst_SOPC::Inst_SOPC(InFmt_SOPC *iFmt, const std::string &opcode)
382  {
383  setFlag(Scalar);
384 
385  // copy first instruction DWORD
386  instData = iFmt[0];
387  if (hasSecondDword(iFmt)) {
388  // copy second instruction DWORD into union
389  extData = ((MachInst)iFmt)[1];
390  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
391  varSize = 4 + 4;
392  } else {
393  varSize = 4;
394  } // if
395  } // Inst_SOPC
396 
398  {
399  } // ~Inst_SOPC
400 
401  int
403  {
404  return varSize;
405  } // instSize
406 
407  bool
409  {
410  if (iFmt->SSRC0 == REG_SRC_LITERAL)
411  return true;
412 
413  if (iFmt->SSRC1 == REG_SRC_LITERAL)
414  return true;
415 
416  return false;
417  }
418 
419  void
421  {
422  std::stringstream dis_stream;
423  dis_stream << _opcode << " ";
424 
425  if (instData.SSRC0 == REG_SRC_LITERAL) {
426  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
427  << extData.imm_u32;
428  } else {
429  dis_stream << opSelectorToRegSym(instData.SSRC0) << ", ";
430  }
431 
432  if (instData.SSRC1 == REG_SRC_LITERAL) {
433  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
434  << extData.imm_u32;
435  } else {
436  dis_stream << opSelectorToRegSym(instData.SSRC1);
437  }
438 
439  disassembly = dis_stream.str();
440  }
441 
442  bool
444  {
445  assert(opIdx >= 0);
446  assert(opIdx < getNumOperands());
447 
448  switch (opIdx) {
449  case 0:
450  // SSRC0 is always a scalar reg or a constant
451  return isScalarReg(instData.SSRC0);
452  case 1:
453  // SSRC1 is always a scalar reg or a constant
454  return isScalarReg(instData.SSRC1);
455  default:
456  fatal("Operand at idx %i does not exist\n", opIdx);
457  return false;
458  }
459  }
460 
461  bool
463  {
464  assert(opIdx >= 0);
465  assert(opIdx < getNumOperands());
466 
467  // SOPC instructions cannot access VGPRs
468  return false;
469  }
470 
471  int
473  {
474  assert(opIdx >= 0);
475  assert(opIdx < getNumOperands());
476 
477  switch (opIdx) {
478  case 0:
480  gpuDynInst->wavefront()->reservedScalarRegs);
481  case 1:
483  gpuDynInst->wavefront()->reservedScalarRegs);
484  default:
485  fatal("Operand at idx %i does not exist\n", opIdx);
486  return -1;
487  }
488  }
489 
490  // --- Inst_SOPP base class methods ---
491 
492  Inst_SOPP::Inst_SOPP(InFmt_SOPP *iFmt, const std::string &opcode)
494  {
495  setFlag(Scalar);
496 
497  // copy first instruction DWORD
498  instData = iFmt[0];
499  } // Inst_SOPP
500 
502  {
503  } // ~Inst_SOPP
504 
505  int
507  {
508  return 4;
509  } // instSize
510 
511  void
513  {
514  std::stringstream dis_stream;
515  dis_stream << _opcode;
516 
517  switch (instData.OP) {
518  case 8:
519  {
520  dis_stream << " ";
521  int dest = 4 * instData.SIMM16 + 4;
522  dis_stream << "label_" << std::hex << dest;
523  }
524  break;
525  case 12:
526  {
527  dis_stream << " ";
528 
529  int vm_cnt = 0;
530  int exp_cnt = 0;
531  int lgkm_cnt = 0;
532 
533  vm_cnt = bits<uint16_t>(instData.SIMM16, 3, 0);
534  exp_cnt = bits<uint16_t>(instData.SIMM16, 6, 4);
535  lgkm_cnt = bits<uint16_t>(instData.SIMM16, 11, 8);
536 
537  // if the counts are not maxed out, then we
538  // print out the count value
539  if (vm_cnt != 0xf) {
540  dis_stream << "vmcnt(" << vm_cnt << ")";
541  }
542 
543  if (lgkm_cnt != 0xf) {
544  if (vm_cnt != 0xf)
545  dis_stream << " & ";
546 
547  dis_stream << "lgkmcnt(" << lgkm_cnt << ")";
548  }
549 
550  if (exp_cnt != 0x7) {
551  if (vm_cnt != 0xf || lgkm_cnt != 0xf)
552  dis_stream << " & ";
553 
554  dis_stream << "expcnt(" << exp_cnt << ")";
555  }
556  }
557  break;
558  default:
559  break;
560  }
561 
562  disassembly = dis_stream.str();
563  }
564 
565  bool
567  {
568  assert(opIdx >= 0);
569  assert(opIdx < getNumOperands());
570 
571  // SOPP instructions have a maximum of 1 operand,
572  // and it's always an immediate value
573  return false;
574  }
575 
576  bool
578  {
579  assert(opIdx >= 0);
580  assert(opIdx < getNumOperands());
581 
582  // SOPP instructions have a maximum of 1 operand,
583  // and it's always an immediate value
584  return false;
585  }
586 
587  int
589  {
590  assert(opIdx >= 0);
591  assert(opIdx < getNumOperands());
592 
593  // SOPP instructions have a maximum of 1 operand,
594  // and it's always an immediate value
595  return -1;
596  }
597 
598  // --- Inst_SMEM base class methods ---
599 
600  Inst_SMEM::Inst_SMEM(InFmt_SMEM *iFmt, const std::string &opcode)
602  {
603  setFlag(Scalar);
604  setFlag(GlobalSegment);
605 
606  // copy first instruction DWORD
607  instData = iFmt[0];
608  // copy second instruction DWORD
609  extData = ((InFmt_SMEM_1 *)iFmt)[1];
610  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
611 
612  if (instData.GLC)
613  setFlag(GloballyCoherent);
614  } // Inst_SMEM
615 
617  {
618  } // ~Inst_SMEM
619 
620  int
622  {
623  return 8;
624  } // instSize
625 
626  void
628  {
629  std::stringstream dis_stream;
630  dis_stream << _opcode << " ";
631  if (numDstRegOperands()) {
632  if (getOperandSize(getNumOperands() - 1) > 4) {
633  dis_stream << "s[" << instData.SDATA << ":"
635  4 - 1 << "], ";
636  } else {
637  dis_stream << "s" << instData.SDATA << ", ";
638  }
639  }
640 
641  // SBASE has an implied LSB of 0, so we need
642  // to shift by one to get the actual value
643  dis_stream << "s[" << (instData.SBASE << 1) << ":"
644  << ((instData.SBASE << 1) + 1) << "], ";
645 
646  if (instData.IMM) {
647  // IMM == 1 implies OFFSET should be
648  // used as the offset
649  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(2)
650  << extData.OFFSET;
651  } else {
652  // IMM == 0 implies OFFSET should be
653  // used to specify SGRP in which the
654  // offset is held
655  dis_stream << "s" << extData.OFFSET;
656  }
657 
658  disassembly = dis_stream.str();
659  }
660 
661  bool
663  {
664  assert(opIdx >= 0);
665  assert(opIdx < getNumOperands());
666 
667  switch (opIdx) {
668  case 0:
669  // SBASE is always a scalar
670  return true;
671  case 1:
672  if (instData.IMM) {
673  return false;
674  } else {
675  return isScalarReg(extData.OFFSET);
676  }
677  case 2:
678  return isScalarReg(instData.SDATA);
679  default:
680  fatal("Operand at idx %i does not exist\n", opIdx);
681  return false;
682  }
683  }
684 
685  bool
687  {
688  assert(opIdx >= 0);
689  assert(opIdx < getNumOperands());
690 
691  // SMEM instructions cannot access VGPRs
692  return false;
693  }
694 
695  int
697  {
698  assert(opIdx >= 0);
699  assert(opIdx < getNumOperands());
700 
701  switch (opIdx) {
702  case 0:
703  // SBASE has an implied LSB of 0, so we need
704  // to shift by one to get the actual value
705  return opSelectorToRegIdx(instData.SBASE << 1,
706  gpuDynInst->wavefront()->reservedScalarRegs);
707  case 1:
708  if (instData.IMM) {
709  // operand is an immediate value, not a register
710  return -1;
711  } else {
712  return extData.OFFSET;
713  }
714  case 2:
716  gpuDynInst->wavefront()->reservedScalarRegs);
717  default:
718  fatal("Operand at idx %i does not exist\n", opIdx);
719  return -1;
720  }
721  }
722 
723  // --- Inst_VOP2 base class methods ---
724 
725  Inst_VOP2::Inst_VOP2(InFmt_VOP2 *iFmt, const std::string &opcode)
727  {
728  // copy first instruction DWORD
729  instData = iFmt[0];
730  if (hasSecondDword(iFmt)) {
731  // copy second instruction DWORD into union
732  extData = ((MachInst)iFmt)[1];
733  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
734  varSize = 4 + 4;
735  if (iFmt->SRC0 == REG_SRC_DPP) {
736  setFlag(IsDPP);
737  } else if (iFmt->SRC0 == REG_SRC_SWDA) {
738  setFlag(IsSDWA);
739  }
740  } else {
741  varSize = 4;
742  } // if
743  } // Inst_VOP2
744 
746  {
747  } // ~Inst_VOP2
748 
749  int
751  {
752  return varSize;
753  } // instSize
754 
755  bool
757  {
758  /*
759  There are a few cases where VOP2 instructions have a second dword:
760 
761  1. SRC0 is a literal
762  2. SRC0 is being used to add a data parallel primitive (DPP)
763  operation to the instruction.
764  3. SRC0 is being used for sub d-word addressing (SDWA) of the
765  operands in the instruction.
766  4. VOP2 instructions also have four special opcodes:',
767  V_MADMK_{F16, F32} (0x24, 0x17), and V_MADAK_{F16, F32}',
768  (0x25, 0x18), that are always 64b. the only way to',
769  detect these special cases is to explicitly check,',
770  the opcodes',
771  */
772  if (iFmt->SRC0 == REG_SRC_LITERAL || (iFmt->SRC0 == REG_SRC_DPP) ||
773  (iFmt->SRC0 == REG_SRC_SWDA) || iFmt->OP == 0x17 ||
774  iFmt->OP == 0x18 || iFmt->OP == 0x24 || iFmt->OP == 0x25)
775  return true;
776 
777  return false;
778  }
779 
780  void
782  {
783  std::stringstream dis_stream;
784  dis_stream << _opcode << " ";
785  dis_stream << "v" << instData.VDST << ", ";
786 
787  if (writesVCC())
788  dis_stream << "vcc, ";
789 
790  if ((instData.SRC0 == REG_SRC_LITERAL) ||
791  (instData.SRC0 == REG_SRC_DPP) ||
792  (instData.SRC0 == REG_SRC_SWDA)) {
793  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
794  << _srcLiteral << ", ";
795  } else {
796  dis_stream << opSelectorToRegSym(instData.SRC0) << ", ";
797  }
798 
799  // VOP2 instructions have four special opcodes:',
800  // V_MADMK_{F16, F32} (0x24, 0x17), and V_MADAK_{F16, F32}',
801  // (0x25, 0x18), that are always 64b. the only way to',
802  // detect these special cases is to explicitly check,',
803  // the opcodes',
804  if (instData.OP == 0x17 || instData.OP == 0x18 || instData.OP == 0x24
805  || instData.OP == 0x25) {
806  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
807  << extData.imm_u32 << ", ";
808  }
809 
810  dis_stream << std::resetiosflags(std::ios_base::basefield) << "v"
811  << instData.VSRC1;
812 
813  if (readsVCC())
814  dis_stream << ", vcc";
815 
816  disassembly = dis_stream.str();
817  }
818 
819  bool
821  {
822  assert(opIdx >= 0);
823  assert(opIdx < getNumOperands());
824 
825  switch (opIdx) {
826  case 0:
827  // SRC0 may be a scalar or vector register, an
828  // inline constant, or a special HW register
829  return isScalarReg(instData.SRC0);
830  case 1:
831  // instData.VSRC1 is never a scalar reg
832  return false;
833  case 2:
834  if (readsVCC()) {
835  return true;
836  } else {
837  // instData.VDST is never a scalar reg
838  return false;
839  }
840  case 3:
841  // if a VOP2 instruction has more than 3 ops
842  // it must read from or write to VCC, and
843  // VCC is always in an SGPR
844  assert(readsVCC() || writesVCC());
845  if (readsVCC()) {
846  return false;
847  } else {
848  return true;
849  }
850  case 4:
851  // if a VOP2 instruction has more than 4 ops
852  // it must read from and write to VCC, and
853  // VCC is always in an SGPR
854  assert(writesVCC() && readsVCC());
855  return true;
856  default:
857  fatal("Operand at idx %i does not exist\n", opIdx);
858  return false;
859  }
860  }
861 
862  bool
864  {
865  assert(opIdx >= 0);
866  assert(opIdx < getNumOperands());
867 
868  switch (opIdx) {
869  case 0:
870  // SRC0 may be a scalar or vector register, an
871  // inline constant, or a special HW register
872  return isVectorReg(instData.SRC0);
873  case 1:
874  // instData.VSRC1 is always a vector reg
875  return true;
876  case 2:
877  if (readsVCC()) {
878  return false;
879  } else {
880  // instData.VDST is always a vector reg
881  return true;
882  }
883  case 3:
884  // if a VOP2 instruction has more than 3 ops
885  // it must read from or write to VCC, and
886  // VCC is always in an SGPR
887  assert(writesVCC() || readsVCC());
888  if (readsVCC()) {
889  return true;
890  } else {
891  return false;
892  }
893  case 4:
894  // if a VOP2 instruction has more than 4 ops
895  // it must read from and write to VCC, and
896  // VCC is always in an SGPR
897  assert(writesVCC() && readsVCC());
898  return false;
899  default:
900  fatal("Operand at idx %i does not exist\n", opIdx);
901  return false;
902  }
903  }
904 
905  int
907  {
908  assert(opIdx >= 0);
909  assert(opIdx < getNumOperands());
910 
911  switch (opIdx) {
912  case 0:
914  gpuDynInst->wavefront()->reservedScalarRegs);
915  case 1:
916  return instData.VSRC1;
917  case 2:
918  if (readsVCC()) {
920  gpuDynInst->wavefront()->reservedScalarRegs);
921  } else {
922  return instData.VDST;
923  }
924  case 3:
925  assert(writesVCC() || readsVCC());
926  if (readsVCC()) {
927  return instData.VDST;
928  } else {
930  gpuDynInst->wavefront()->reservedScalarRegs);
931  }
932  case 4:
933  assert(writesVCC() && readsVCC());
935  gpuDynInst->wavefront()->reservedScalarRegs);
936  default:
937  fatal("Operand at idx %i does not exist\n", opIdx);
938  return -1;
939  }
940  }
941 
942  // --- Inst_VOP1 base class methods ---
943 
944  Inst_VOP1::Inst_VOP1(InFmt_VOP1 *iFmt, const std::string &opcode)
946  {
947  // copy first instruction DWORD
948  instData = iFmt[0];
949  if (hasSecondDword(iFmt)) {
950  // copy second instruction DWORD into union
951  extData = ((MachInst)iFmt)[1];
952  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
953  varSize = 4 + 4;
954  if (iFmt->SRC0 == REG_SRC_DPP) {
955  setFlag(IsDPP);
956  } else if (iFmt->SRC0 == REG_SRC_SWDA) {
957  setFlag(IsSDWA);
958  }
959  } else {
960  varSize = 4;
961  } // if
962  } // Inst_VOP1
963 
965  {
966  } // ~Inst_VOP1
967 
968  int
970  {
971  return varSize;
972  } // instSize
973 
974  bool
976  {
977  /*
978  There are several cases where VOP1 instructions have a second dword:
979 
980  1. SRC0 is a literal.
981  2. SRC0 is being used to add a data parallel primitive (DPP)
982  operation to the instruction.
983  3. SRC0 is being used for sub d-word addressing (SDWA) of the
984  operands in the instruction.
985  */
986  if ((iFmt->SRC0 == REG_SRC_LITERAL) || (iFmt->SRC0 == REG_SRC_DPP) ||
987  (iFmt->SRC0 == REG_SRC_SWDA))
988  return true;
989 
990  return false;
991  }
992 
993  void
995  {
996  std::stringstream dis_stream;
997  dis_stream << _opcode << " ";
998  dis_stream << "v" << instData.VDST << ", ";
999 
1000  if ((instData.SRC0 == REG_SRC_LITERAL) ||
1001  (instData.SRC0 == REG_SRC_DPP) ||
1002  (instData.SRC0 == REG_SRC_SWDA)) {
1003  dis_stream << "0x" << std::hex << std::setfill('0') << std::setw(8)
1004  << _srcLiteral;
1005  } else {
1006  dis_stream << opSelectorToRegSym(instData.SRC0);
1007  }
1008 
1009  disassembly = dis_stream.str();
1010  }
1011 
1012  bool
1014  {
1015  assert(opIdx >= 0);
1016  assert(opIdx < getNumOperands());
1017 
1018  switch (opIdx) {
1019  case 0:
1020  return isScalarReg(instData.SRC0);
1021  case 1:
1022  // VDST is never a scalar reg
1023  return false;
1024  default:
1025  fatal("Operand at idx %i does not exist\n", opIdx);
1026  return false;
1027  }
1028  }
1029 
1030  bool
1032  {
1033  assert(opIdx >= 0);
1034  assert(opIdx < getNumOperands());
1035 
1036  switch (opIdx) {
1037  case 0:
1038  return isVectorReg(instData.SRC0);
1039  case 1:
1040  // VDST is always a vector reg
1041  return true;
1042  default:
1043  fatal("Operand at idx %i does not exist\n", opIdx);
1044  return false;
1045  }
1046  }
1047 
1048  int
1050  {
1051  assert(opIdx >= 0);
1052  assert(opIdx < getNumOperands());
1053 
1054  switch (opIdx) {
1055  case 0:
1057  gpuDynInst->wavefront()->reservedScalarRegs);
1058  case 1:
1059  return instData.VDST;
1060  default:
1061  fatal("Operand at idx %i does not exist\n", opIdx);
1062  return -1;
1063  }
1064  }
1065 
1066  // --- Inst_VOPC base class methods ---
1067 
1068  Inst_VOPC::Inst_VOPC(InFmt_VOPC *iFmt, const std::string &opcode)
1070  {
1071  // copy first instruction DWORD
1072  instData = iFmt[0];
1073  if (hasSecondDword(iFmt)) {
1074  // copy second instruction DWORD into union
1075  extData = ((MachInst)iFmt)[1];
1076  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
1077  varSize = 4 + 4;
1078  if (iFmt->SRC0 == REG_SRC_DPP) {
1079  setFlag(IsDPP);
1080  } else if (iFmt->SRC0 == REG_SRC_SWDA) {
1081  setFlag(IsSDWA);
1082  }
1083  } else {
1084  varSize = 4;
1085  } // if
1086  } // Inst_VOPC
1087 
1089  {
1090  } // ~Inst_VOPC
1091 
1092  int
1094  {
1095  return varSize;
1096  } // instSize
1097 
1098  bool
1100  {
1101  /*
1102  There are several cases where VOPC instructions have a second dword:
1103 
1104  1. SRC0 is a literal.
1105  2. SRC0 is being used to add a data parallel primitive (DPP)
1106  operation to the instruction.
1107  3. SRC0 is being used for sub d-word addressing (SDWA) of the
1108  operands in the instruction.
1109  */
1110  if ((iFmt->SRC0 == REG_SRC_LITERAL) || (iFmt->SRC0 == REG_SRC_DPP) ||
1111  (iFmt->SRC0 == REG_SRC_SWDA))
1112  return true;
1113 
1114  return false;
1115  }
1116 
1117  void
1119  {
1120  std::stringstream dis_stream;
1121  dis_stream << _opcode << " vcc, ";
1122 
1123  dis_stream << opSelectorToRegSym(instData.SRC0) << ", ";
1124  dis_stream << "v" << instData.VSRC1;
1125 
1126  disassembly = dis_stream.str();
1127  }
1128 
1129  bool
1131  {
1132  assert(opIdx >= 0);
1133  assert(opIdx < getNumOperands());
1134 
1135  switch (opIdx) {
1136  case 0:
1137  return isScalarReg(instData.SRC0);
1138  case 1:
1139  // VSRC1 is never a scalar register
1140  return false;
1141  case 2:
1142  // VCC is always a scalar register
1143  return true;
1144  default:
1145  fatal("Operand at idx %i does not exist\n", opIdx);
1146  return false;
1147  }
1148  }
1149 
1150  bool
1152  {
1153  assert(opIdx >= 0);
1154  assert(opIdx < getNumOperands());
1155 
1156  switch (opIdx) {
1157  case 0:
1158  return isVectorReg(instData.SRC0);
1159  case 1:
1160  // VSRC1 is never a scalar register
1161  return true;
1162  case 2:
1163  // VCC is always a scalar register
1164  return false;
1165  default:
1166  fatal("Operand at idx %i does not exist\n", opIdx);
1167  return false;
1168  }
1169  }
1170 
1171  int
1173  {
1174  assert(opIdx >= 0);
1175  assert(opIdx < getNumOperands());
1176 
1177  switch (opIdx) {
1178  case 0:
1180  gpuDynInst->wavefront()->reservedScalarRegs);
1181  case 1:
1182  return instData.VSRC1;
1183  case 2:
1184  // VCC
1186  gpuDynInst->wavefront()->reservedScalarRegs);
1187  default:
1188  fatal("Operand at idx %i does not exist\n", opIdx);
1189  return -1;
1190  }
1191  }
1192 
1193  // --- Inst_VINTRP base class methods ---
1194 
1195  Inst_VINTRP::Inst_VINTRP(InFmt_VINTRP *iFmt, const std::string &opcode)
1197  {
1198  // copy first instruction DWORD
1199  instData = iFmt[0];
1200  } // Inst_VINTRP
1201 
1203  {
1204  } // ~Inst_VINTRP
1205 
1206  int
1208  {
1209  return 4;
1210  } // instSize
1211 
1212  // --- Inst_VOP3 base class methods ---
1213 
1214  Inst_VOP3::Inst_VOP3(InFmt_VOP3 *iFmt, const std::string &opcode,
1215  bool sgpr_dst)
1216  : GCN3GPUStaticInst(opcode), sgprDst(sgpr_dst)
1217  {
1218  // copy first instruction DWORD
1219  instData = iFmt[0];
1220  // copy second instruction DWORD
1221  extData = ((InFmt_VOP3_1 *)iFmt)[1];
1222  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
1223  } // Inst_VOP3
1224 
1226  {
1227  } // ~Inst_VOP3
1228 
1229  int
1231  {
1232  return 8;
1233  } // instSize
1234 
1235  void
1237  {
1238  std::stringstream dis_stream;
1239  dis_stream << _opcode << " ";
1240  int num_regs = 0;
1241 
1242  if (getOperandSize(getNumOperands() - 1) > 4) {
1243  num_regs = getOperandSize(getNumOperands() - 1) / 4;
1244  if (sgprDst)
1245  dis_stream << "s[";
1246  else
1247  dis_stream << "v[";
1248  dis_stream << instData.VDST << ":" << instData.VDST +
1249  num_regs - 1 << "], ";
1250  } else {
1251  if (sgprDst)
1252  dis_stream << "s";
1253  else
1254  dis_stream << "v";
1255  dis_stream << instData.VDST << ", ";
1256  }
1257 
1258  num_regs = getOperandSize(0) / 4;
1259 
1260  if (extData.NEG & 0x1) {
1261  dis_stream << "-" << opSelectorToRegSym(extData.SRC0, num_regs);
1262  } else {
1263  dis_stream << opSelectorToRegSym(extData.SRC0, num_regs);
1264  }
1265 
1266  if (numSrcRegOperands() > 1) {
1267  num_regs = getOperandSize(1) / 4;
1268 
1269  if (extData.NEG & 0x2) {
1270  dis_stream << ", -"
1271  << opSelectorToRegSym(extData.SRC1, num_regs);
1272  } else {
1273  dis_stream << ", "
1274  << opSelectorToRegSym(extData.SRC1, num_regs);
1275  }
1276  }
1277 
1278  if (numSrcRegOperands() > 2) {
1279  num_regs = getOperandSize(2) / 4;
1280 
1281  if (extData.NEG & 0x4) {
1282  dis_stream << ", -"
1283  << opSelectorToRegSym(extData.SRC2, num_regs);
1284  } else {
1285  dis_stream << ", "
1286  << opSelectorToRegSym(extData.SRC2, num_regs);
1287  }
1288  }
1289 
1290  disassembly = dis_stream.str();
1291  }
1292 
1293  bool
1295  {
1296  assert(opIdx >= 0);
1297  assert(opIdx < getNumOperands());
1298 
1299  switch (opIdx) {
1300  case 0:
1301  // SRC0 may be a scalar or vector register, an
1302  // inline constant, or a special HW register
1303  return isScalarReg(extData.SRC0);
1304  case 1:
1305  if (numSrcRegOperands() > 1) {
1306  // if we have more than 1 source operand then
1307  // op index 1 corresponds to SRC1. SRC1 may be
1308  // a scalar or vector register, an inline
1309  // constant, or a special HW register
1310  return isScalarReg(extData.SRC1);
1311  } else {
1312  // if we only have 1 source operand, opIdx 1
1313  // will be VDST, and VDST is only a scalar
1314  // for v_cmp instructions
1315  if (sgprDst)
1316  return true;
1317  return false;
1318  }
1319  case 2:
1320  if (numSrcRegOperands() > 2) {
1321  // if we have more than 2 source operand then
1322  // op index 2 corresponds to SRC2. SRC2 may be
1323  // a scalar or vector register, an inline
1324  // constant, or a special HW register
1325  return isScalarReg(extData.SRC2);
1326  } else if (numSrcRegOperands() == 2) {
1327  // if we only have 2 source operands, opIdx 2
1328  // will be VDST, and VDST is only a scalar
1329  // for v_cmp instructions
1330  if (sgprDst)
1331  return true;
1332  return false;
1333  } else {
1334  // if this idx doesn't correspond to SRCX or
1335  // VDST then it must be a VCC read or write,
1336  // and VCC is always stored in an SGPR pair
1337  assert(writesVCC() || readsVCC());
1338  return true;
1339  }
1340  case 3:
1341  if (numSrcRegOperands() == 3) {
1342  // if we have 3 source operands, opIdx 3
1343  // will be VDST, and VDST is only a scalar
1344  // for v_cmp instructions
1345  if (sgprDst)
1346  return true;
1347  return false;
1348  } else {
1349  // if this idx doesn't correspond to VDST
1350  // then it must be a VCC read or write, and
1351  // and VCC is always stored in an SGPR pair
1352  assert(writesVCC() || readsVCC());
1353  return true;
1354  }
1355  case 4:
1356  // if a VOP3 instruction has more than 4 ops
1357  // it must read from and write to VCC, and
1358  // VCC is always in an SGPR
1359  assert(writesVCC() || readsVCC());
1360  return true;
1361  default:
1362  fatal("Operand at idx %i does not exist\n", opIdx);
1363  return false;
1364  }
1365  }
1366 
1367  bool
1369  {
1370  assert(opIdx >= 0);
1371  assert(opIdx < getNumOperands());
1372 
1373  switch (opIdx) {
1374  case 0:
1375  // SRC0 may be a scalar or vector register, an
1376  // inline constant, or a special HW register
1377  return isVectorReg(extData.SRC0);
1378  case 1:
1379  if (numSrcRegOperands() > 1) {
1380  // if we have more than 1 source operand then
1381  // op index 1 corresponds to SRC1. SRC1 may be
1382  // a scalar or vector register, an inline
1383  // constant, or a special HW register
1384  return isVectorReg(extData.SRC1);
1385  } else {
1386  // if we only have 1 source operands, opIdx 1
1387  // will be VDST, and VDST is a scalar for v_cmp
1388  // instructions
1389  if (sgprDst)
1390  return false;
1391  return true;
1392  }
1393  case 2:
1394  if (numSrcRegOperands() > 2) {
1395  // if we have more than 2 source operand then
1396  // op index 2 corresponds to SRC2. SRC2 may be
1397  // a scalar or vector register, an inline
1398  // constant, or a special HW register
1399  return isVectorReg(extData.SRC2);
1400  } else if (numSrcRegOperands() == 2) {
1401  // if we only have 2 source operands, opIdx 2
1402  // will be VDST, and VDST is a scalar for v_cmp
1403  // instructions
1404  if (sgprDst)
1405  return false;
1406  return true;
1407  } else {
1408  // if this idx doesn't correspond to SRCX or
1409  // VDST then it must be a VCC read or write,
1410  // and VCC is never stored in a VGPR
1411  assert(writesVCC() || readsVCC());
1412  return false;
1413  }
1414  case 3:
1415  if (numSrcRegOperands() == 3) {
1416  // if we have 3 source operands, opIdx 3
1417  // will be VDST, and VDST is a scalar for v_cmp
1418  // instructions
1419  if (sgprDst)
1420  return false;
1421  return true;
1422  } else {
1423  // if this idx doesn't correspond to VDST
1424  // then it must be a VCC read or write, and
1425  // and VCC is never stored in a VGPR
1426  assert(writesVCC() || readsVCC());
1427  return false;
1428  }
1429  case 4:
1430  // if a VOP3 instruction has more than 4 ops
1431  // it must read from and write to VCC, and
1432  // VCC is never stored in a VGPR
1433  assert(writesVCC() || readsVCC());
1434  return false;
1435  default:
1436  fatal("Operand at idx %i does not exist\n", opIdx);
1437  return false;
1438  }
1439  }
1440 
1441  int
1443  {
1444  assert(opIdx >= 0);
1445  assert(opIdx < getNumOperands());
1446 
1447  switch (opIdx) {
1448  case 0:
1449  // SRC0
1451  gpuDynInst->wavefront()->reservedScalarRegs);
1452  case 1:
1453  if (numSrcRegOperands() > 1) {
1454  // if we have more than 1 source operand then
1455  // op index 1 corresponds to SRC1
1457  gpuDynInst->wavefront()->reservedScalarRegs);
1458  } else {
1459  // if we only have 1 source operand, opIdx 1
1460  // will be VDST
1461  if (sgprDst) {
1463  gpuDynInst->wavefront()->reservedScalarRegs);
1464  }
1465  return instData.VDST;
1466  }
1467  case 2:
1468  if (numSrcRegOperands() > 2) {
1469  // if we have more than 2 source operand then
1470  // op index 2 corresponds to SRC2. SRC2 may be
1471  // a scalar or vector register, an inline
1472  // constant, or a special HW register
1474  gpuDynInst->wavefront()->reservedScalarRegs);
1475  } else if (numSrcRegOperands() == 2) {
1476  // if we only have 2 source operands, opIdx 2
1477  // will be VDST, and VDST is always a vector
1478  // reg
1479  if (sgprDst) {
1481  gpuDynInst->wavefront()->reservedScalarRegs);
1482  }
1483  return instData.VDST;
1484  } else {
1485  // if this idx doesn't correspond to SRCX or
1486  // VDST then it must be a VCC read or write,
1487  // and VCC is never stored in a VGPR
1488  assert(writesVCC() || readsVCC());
1490  gpuDynInst->wavefront()->reservedScalarRegs);
1491  }
1492  case 3:
1493  if (numSrcRegOperands() == 3) {
1494  // if we have 3 source operands then op
1495  // idx 3 will correspond to VDST
1496  if (sgprDst) {
1498  gpuDynInst->wavefront()->reservedScalarRegs);
1499  }
1500  return instData.VDST;
1501  } else {
1502  // if this idx doesn't correspond to VDST
1503  // then it must be a VCC read or write
1504  assert(writesVCC() || readsVCC());
1506  gpuDynInst->wavefront()->reservedScalarRegs);
1507  }
1508  case 4:
1509  // if a VOP3 instruction has more than 4 ops
1510  // it must read from and write to VCC
1511  assert(writesVCC() || readsVCC());
1513  gpuDynInst->wavefront()->reservedScalarRegs);
1514  default:
1515  fatal("Operand at idx %i does not exist\n", opIdx);
1516  return -1;
1517  }
1518  }
1519 
1520  // --- Inst_VOP3_SDST_ENC base class methods ---
1521 
1523  const std::string &opcode)
1525  {
1526  // copy first instruction DWORD
1527  instData = iFmt[0];
1528  // copy second instruction DWORD
1529  extData = ((InFmt_VOP3_1 *)iFmt)[1];
1530  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
1531  } // Inst_VOP3_SDST_ENC
1532 
1534  {
1535  } // ~Inst_VOP3_SDST_ENC
1536 
1537  int
1539  {
1540  return 8;
1541  } // instSize
1542 
1543  void
1545  {
1546  std::stringstream dis_stream;
1547  dis_stream << _opcode << " ";
1548 
1549  dis_stream << "v" << instData.VDST << ", ";
1550 
1551  if (numDstRegOperands() == 2) {
1552  if (getOperandSize(getNumOperands() - 1) > 4) {
1553  int num_regs = getOperandSize(getNumOperands() - 1) / 4;
1554  dis_stream << opSelectorToRegSym(instData.SDST, num_regs)
1555  << ", ";
1556  } else {
1557  dis_stream << opSelectorToRegSym(instData.SDST) << ", ";
1558  }
1559  }
1560 
1561  if (extData.NEG & 0x1) {
1562  dis_stream << "-" << opSelectorToRegSym(extData.SRC0) << ", ";
1563  } else {
1564  dis_stream << opSelectorToRegSym(extData.SRC0) << ", ";
1565  }
1566 
1567  if (extData.NEG & 0x2) {
1568  dis_stream << "-" << opSelectorToRegSym(extData.SRC1);
1569  } else {
1570  dis_stream << opSelectorToRegSym(extData.SRC1);
1571  }
1572 
1573  if (numSrcRegOperands() == 3) {
1574  if (extData.NEG & 0x4) {
1575  dis_stream << ", -" << opSelectorToRegSym(extData.SRC2);
1576  } else {
1577  dis_stream << ", " << opSelectorToRegSym(extData.SRC2);
1578  }
1579  }
1580 
1581  if (readsVCC())
1582  dis_stream << ", vcc";
1583 
1584  disassembly = dis_stream.str();
1585  }
1586 
1587  bool
1589  {
1590  assert(opIdx >= 0);
1591  assert(opIdx < getNumOperands());
1592 
1593  switch (opIdx) {
1594  case 0:
1595  // SRC0 may be a scalar or vector register, an
1596  // inline constant, or a special HW register
1597  return isScalarReg(extData.SRC0);
1598  case 1:
1599  if (numSrcRegOperands() > 1) {
1600  // if we have more than 1 source operand then
1601  // op index 1 corresponds to SRC1. SRC1 may be
1602  // a scalar or vector register, an inline
1603  // constant, or a special HW register
1604  return isScalarReg(extData.SRC1);
1605  } else {
1606  // if we only have 1 source operand, opIdx 1
1607  // will be VDST, and VDST is never a scalar
1608  // reg
1609  if (instData.VDST == REG_VCC_LO)
1610  return true;
1611  return false;
1612  }
1613  case 2:
1614  if (numSrcRegOperands() > 2) {
1615  // if we have more than 2 source operand then
1616  // op index 2 corresponds to SRC2. SRC2 may be
1617  // a scalar or vector register, an inline
1618  // constant, or a special HW register
1619  return isScalarReg(extData.SRC2);
1620  } else if (numSrcRegOperands() == 2) {
1621  // if we only have 2 source operands, opIdx 2
1622  // will be VDST, and VDST is never a scalar
1623  // reg
1624  if (instData.VDST == REG_VCC_LO)
1625  return true;
1626  return false;
1627  } else {
1628  // if this idx doesn't correspond to SRCX or
1629  // VDST then it must be a VCC read or write,
1630  // and VCC is always stored in an SGPR pair
1631  assert(writesVCC() || readsVCC());
1632  return true;
1633  }
1634  case 3:
1635  if (numSrcRegOperands() == 3) {
1636  // if we have 3 source operands then op
1637  // idx 3 will correspond to VDST, and VDST
1638  // is never a scalar reg
1639  if (instData.VDST == REG_VCC_LO)
1640  return true;
1641  return false;
1642  } else {
1643  // if this idx doesn't correspond to VDST
1644  // then it must be a VCC read or write, and
1645  // and VCC is always stored in an SGPR pair
1646  assert(writesVCC() || readsVCC());
1647  return true;
1648  }
1649  case 4:
1650  // if a VOP3 instruction has more than 4 ops
1651  // it must read from and write to VCC, and
1652  // VCC is always in an SGPR
1653  assert(writesVCC() || readsVCC());
1654  return true;
1655  default:
1656  fatal("Operand at idx %i does not exist\n", opIdx);
1657  return false;
1658  }
1659  }
1660 
1661  bool
1663  {
1664  assert(opIdx >= 0);
1665  assert(opIdx < getNumOperands());
1666 
1667  switch (opIdx) {
1668  case 0:
1669  // SRC0 may be a scalar or vector register, an
1670  // inline constant, or a special HW register
1671  return isVectorReg(extData.SRC0);
1672  case 1:
1673  if (numSrcRegOperands() > 1) {
1674  // if we have more than 1 source operand then
1675  // op index 1 corresponds to SRC1. SRC1 may be
1676  // a scalar or vector register, an inline
1677  // constant, or a special HW register
1678  return isVectorReg(extData.SRC1);
1679  } else {
1680  // if we only have 1 source operand, opIdx 1
1681  // will be VDST, and VDST is always a vector
1682  // reg
1683  if (instData.VDST == REG_VCC_LO)
1684  return false;
1685  return true;
1686  }
1687  case 2:
1688  if (numSrcRegOperands() > 2) {
1689  // if we have more than 2 source operand then
1690  // op index 2 corresponds to SRC2. SRC2 may be
1691  // a scalar or vector register, an inline
1692  // constant, or a special HW register
1693  return isVectorReg(extData.SRC2);
1694  } else if (numSrcRegOperands() == 2) {
1695  // if we only have 2 source operands, opIdx 2
1696  // will be VDST, and VDST is always a vector
1697  // reg
1698  if (instData.VDST == REG_VCC_LO)
1699  return false;
1700  return true;
1701  } else {
1702  // if this idx doesn't correspond to SRCX or
1703  // VDST then it must be a VCC read or write,
1704  // and VCC is never stored in a VGPR
1705  assert(writesVCC() || readsVCC());
1706  return false;
1707  }
1708  case 3:
1709  if (numSrcRegOperands() == 3) {
1710  // if we have 3 source operands then op
1711  // idx 3 will correspond to VDST, and VDST
1712  // is always a vector reg
1713  if (instData.VDST == REG_VCC_LO)
1714  return false;
1715  return true;
1716  } else {
1717  // if this idx doesn't correspond to VDST
1718  // then it must be a VCC read or write, and
1719  // and VCC is never stored in a VGPR
1720  assert(writesVCC() || readsVCC());
1721  return false;
1722  }
1723  case 4:
1724  // if a VOP3 instruction has more than 4 ops
1725  // it must read from and write to VCC, and
1726  // VCC is never stored in a VGPR
1727  assert(writesVCC() || readsVCC());
1728  return false;
1729  default:
1730  fatal("Operand at idx %i does not exist\n", opIdx);
1731  return false;
1732  }
1733  }
1734 
1735  int
1737  {
1738  assert(opIdx >= 0);
1739  assert(opIdx < getNumOperands());
1740 
1741  switch (opIdx) {
1742  case 0:
1743  // SRC0
1745  gpuDynInst->wavefront()->reservedScalarRegs);
1746  case 1:
1747  if (numSrcRegOperands() > 1) {
1748  // if we have more than 1 source operand then
1749  // op index 1 corresponds to SRC1
1751  gpuDynInst->wavefront()->reservedScalarRegs);
1752  } else {
1753  // if we only have 1 source operand, opIdx 1
1754  // will be VDST
1755  return instData.VDST;
1756  }
1757  case 2:
1758  if (numSrcRegOperands() > 2) {
1759  // if we have more than 2 source operand then
1760  // op index 2 corresponds to SRC2
1762  gpuDynInst->wavefront()->reservedScalarRegs);
1763  } else if (numSrcRegOperands() == 2) {
1764  // if we only have 2 source operands, opIdx 2
1765  // will be VDST
1766  return instData.VDST;
1767  } else {
1768  // if this idx doesn't correspond to SRCX or
1769  // VDST then it must be a VCC read or write
1770  assert(writesVCC() || readsVCC());
1772  gpuDynInst->wavefront()->reservedScalarRegs);
1773  }
1774  case 3:
1775  if (numSrcRegOperands() == 3) {
1776  // if we have 3 source operands then op
1777  // idx 3 will correspond to VDST
1778  return instData.VDST;
1779  } else {
1780  // if this idx doesn't correspond to VDST
1781  // then it must be a VCC read or write
1782  assert(writesVCC() || readsVCC());
1784  gpuDynInst->wavefront()->reservedScalarRegs);
1785  }
1786  case 4:
1787  // if a VOP3 instruction has more than 4 ops
1788  // it must read from and write to VCC
1789  assert(writesVCC() || readsVCC());
1791  gpuDynInst->wavefront()->reservedScalarRegs);
1792  default:
1793  fatal("Operand at idx %i does not exist\n", opIdx);
1794  return -1;
1795  }
1796  }
1797 
1798  // --- Inst_DS base class methods ---
1799 
1800  Inst_DS::Inst_DS(InFmt_DS *iFmt, const std::string &opcode)
1802  {
1803  setFlag(GroupSegment);
1804 
1805  // copy first instruction DWORD
1806  instData = iFmt[0];
1807  // copy second instruction DWORD
1808  extData = ((InFmt_DS_1 *)iFmt)[1];
1809  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
1810  } // Inst_DS
1811 
1813  {
1814  } // ~Inst_DS
1815 
1816  int
1818  {
1819  return 8;
1820  } // instSize
1821 
1822  void
1824  {
1825  std::stringstream dis_stream;
1826  dis_stream << _opcode << " ";
1827 
1828  if (numDstRegOperands())
1829  dis_stream << "v" << extData.VDST << ", ";
1830 
1831  dis_stream << "v" << extData.ADDR;
1832 
1833  if (numSrcRegOperands() > 1)
1834  dis_stream << ", v" << extData.DATA0;
1835 
1836  if (numSrcRegOperands() > 2)
1837  dis_stream << ", v" << extData.DATA1;
1838 
1839  uint16_t offset = 0;
1840 
1841  if (instData.OFFSET1) {
1842  offset += instData.OFFSET1;
1843  offset <<= 8;
1844  }
1845 
1846  if (instData.OFFSET0)
1847  offset += instData.OFFSET0;
1848 
1849  if (offset)
1850  dis_stream << " offset:" << offset;
1851 
1852  disassembly = dis_stream.str();
1853  }
1854 
1855  bool
1857  {
1858  assert(opIdx >= 0);
1859  assert(opIdx < getNumOperands());
1860 
1861  // DS instructions cannot access SGPRs
1862  return false;
1863  }
1864 
1865  bool
1867  {
1868  assert(opIdx >= 0);
1869  assert(opIdx < getNumOperands());
1870 
1871  // DS instructions only access VGPRs
1872  return true;
1873  }
1874 
1875  int
1877  {
1878  assert(opIdx >= 0);
1879  assert(opIdx < getNumOperands());
1880 
1881  switch (opIdx) {
1882  case 0:
1883  return extData.ADDR;
1884  case 1:
1885  if (numSrcRegOperands() > 1) {
1886  return extData.DATA0;
1887  } else if (numDstRegOperands()) {
1888  return extData.VDST;
1889  }
1890  break;
1891  case 2:
1892  if (numSrcRegOperands() > 2) {
1893  return extData.DATA1;
1894  } else if (numDstRegOperands()) {
1895  return extData.VDST;
1896  }
1897  break;
1898  case 3:
1899  assert(numDstRegOperands());
1900  return extData.VDST;
1901  default:
1902  fatal("Operand at idx %i does not exist\n", opIdx);
1903  return -1;
1904  }
1905  fatal("Operand at idx %i does not exist\n", opIdx);
1906  return -1;
1907  }
1908 
1909  // --- Inst_MUBUF base class methods ---
1910 
1911  Inst_MUBUF::Inst_MUBUF(InFmt_MUBUF *iFmt, const std::string &opcode)
1913  {
1914  // copy first instruction DWORD
1915  instData = iFmt[0];
1916  // copy second instruction DWORD
1917  extData = ((InFmt_MUBUF_1 *)iFmt)[1];
1918  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
1919 
1920  if (instData.GLC)
1921  setFlag(GloballyCoherent);
1922 
1923  if (instData.SLC)
1924  setFlag(SystemCoherent);
1925  } // Inst_MUBUF
1926 
1928  {
1929  } // ~Inst_MUBUF
1930 
1931  int
1933  {
1934  return 8;
1935  } // instSize
1936 
1937  void
1939  {
1940  // SRSRC is always in units of 4 SGPRs
1941  int srsrc_val = extData.SRSRC * 4;
1942  std::stringstream dis_stream;
1943  dis_stream << _opcode << " ";
1944  dis_stream << "v" << extData.VDATA << ", v" << extData.VADDR << ", ";
1945  dis_stream << "s[" << srsrc_val << ":"
1946  << srsrc_val + 3 << "], ";
1947  dis_stream << "s" << extData.SOFFSET;
1948 
1949  if (instData.OFFSET)
1950  dis_stream << ", offset:" << instData.OFFSET;
1951 
1952  disassembly = dis_stream.str();
1953  }
1954 
1955  bool
1957  {
1958  assert(opIdx >= 0);
1959  assert(opIdx < getNumOperands());
1960 
1961  switch (opIdx) {
1962  case 0:
1963  return false;
1964  case 1:
1965  return true;
1966  case 2:
1967  return true;
1968  case 3:
1969  return false;
1970  default:
1971  fatal("Operand at idx %i does not exist\n", opIdx);
1972  return false;
1973  }
1974  }
1975 
1976  bool
1978  {
1979  assert(opIdx >= 0);
1980  assert(opIdx < getNumOperands());
1981 
1982  switch (opIdx) {
1983  case 0:
1984  return true;
1985  case 1:
1986  return false;
1987  case 2:
1988  return false;
1989  case 3:
1990  return true;
1991  default:
1992  fatal("Operand at idx %i does not exist\n", opIdx);
1993  return false;
1994  }
1995  }
1996 
1997  int
1999  {
2000  assert(opIdx >= 0);
2001  assert(opIdx < getNumOperands());
2002 
2003  switch (opIdx) {
2004  case 0:
2005  return extData.VADDR;
2006  case 1:
2007  // SRSRC is always in units of 4 SGPRs
2008  return extData.SRSRC * 4;
2009  case 2:
2010  return extData.SOFFSET;
2011  case 3:
2012  return extData.VDATA;
2013  default:
2014  fatal("Operand at idx %i does not exist\n", opIdx);
2015  return -1;
2016  }
2017  }
2018 
2019  // --- Inst_MTBUF base class methods ---
2020 
2021  Inst_MTBUF::Inst_MTBUF(InFmt_MTBUF *iFmt, const std::string &opcode)
2023  {
2024  // copy first instruction DWORD
2025  instData = iFmt[0];
2026  // copy second instruction DWORD
2027  extData = ((InFmt_MTBUF_1 *)iFmt)[1];
2028  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
2029 
2030  if (instData.GLC)
2031  setFlag(GloballyCoherent);
2032 
2033  if (extData.SLC)
2034  setFlag(SystemCoherent);
2035 
2036  } // Inst_MTBUF
2037 
2039  {
2040  } // ~Inst_MTBUF
2041 
2042  int
2044  {
2045  return 8;
2046  } // instSize
2047 
2048  // --- Inst_MIMG base class methods ---
2049 
2050  Inst_MIMG::Inst_MIMG(InFmt_MIMG *iFmt, const std::string &opcode)
2052  {
2053  // copy first instruction DWORD
2054  instData = iFmt[0];
2055  // copy second instruction DWORD
2056  extData = ((InFmt_MIMG_1 *)iFmt)[1];
2057  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
2058 
2059  if (instData.GLC)
2060  setFlag(GloballyCoherent);
2061 
2062  if (instData.SLC)
2063  setFlag(SystemCoherent);
2064  } // Inst_MIMG
2065 
2067  {
2068  } // ~Inst_MIMG
2069 
2070  int
2072  {
2073  return 8;
2074  } // instSize
2075 
2076  // --- Inst_EXP base class methods ---
2077 
2078  Inst_EXP::Inst_EXP(InFmt_EXP *iFmt, const std::string &opcode)
2080  {
2081  // copy first instruction DWORD
2082  instData = iFmt[0];
2083  // copy second instruction DWORD
2084  extData = ((InFmt_EXP_1 *)iFmt)[1];
2085  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
2086  } // Inst_EXP
2087 
2089  {
2090  } // ~Inst_EXP
2091 
2092  int
2094  {
2095  return 8;
2096  } // instSize
2097 
2098  // --- Inst_FLAT base class methods ---
2099 
2100  Inst_FLAT::Inst_FLAT(InFmt_FLAT *iFmt, const std::string &opcode)
2102  {
2103  setFlag(Flat);
2104  // copy first instruction DWORD
2105  instData = iFmt[0];
2106  // copy second instruction DWORD
2107  extData = ((InFmt_FLAT_1 *)iFmt)[1];
2108  _srcLiteral = *reinterpret_cast<uint32_t*>(&iFmt[1]);
2109 
2110  if (instData.GLC)
2111  setFlag(GloballyCoherent);
2112 
2113  if (instData.SLC)
2114  setFlag(SystemCoherent);
2115  } // Inst_FLAT
2116 
2118  {
2119  } // ~Inst_FLAT
2120 
2121  int
2123  {
2124  return 8;
2125  } // instSize
2126 
2127  void
2129  {
2130  std::stringstream dis_stream;
2131  dis_stream << _opcode << " ";
2132 
2133  if (isLoad())
2134  dis_stream << "v" << extData.VDST << ", ";
2135 
2136  dis_stream << "v[" << extData.ADDR << ":" << extData.ADDR + 1 << "]";
2137 
2138  if (isStore())
2139  dis_stream << ", v" << extData.DATA;
2140 
2141  disassembly = dis_stream.str();
2142  }
2143 
2144  bool
2146  {
2147  assert(opIdx >= 0);
2148  assert(opIdx < getNumOperands());
2149 
2150  // if a FLAT instruction has more than two
2151  // operands it must be an atomic
2152  if (opIdx == 2)
2153  assert(isAtomic());
2154 
2155  // FLAT instructions cannot access SGPRs
2156  return false;
2157  }
2158 
2159  bool
2161  {
2162  assert(opIdx >= 0);
2163  assert(opIdx < getNumOperands());
2164 
2165  // if a FLAT instruction has more than two
2166  // operands it must be an atomic
2167  if (opIdx == 2)
2168  assert(isAtomic());
2169 
2170  // FLAT instructions only access VGPRs
2171  return true;
2172  }
2173 
2174  int
2176  {
2177  assert(opIdx >= 0);
2178  assert(opIdx < getNumOperands());
2179 
2180  switch (opIdx) {
2181  case 0:
2182  return extData.ADDR;
2183  case 1:
2184  if (isStore()) {
2185  return extData.DATA;
2186  } else if (isLoad()) {
2187  return extData.VDST;
2188  } else if (isAtomic()) {
2189  // For flat_atomic instructions,
2190  // the DATA VGPR gives the source
2191  return extData.DATA;
2192  } else {
2193  fatal("Unsupported flat instr type\n");
2194  }
2195  case 2:
2196  // if a FLAT instruction has more than two
2197  // operands it must be an atomic
2198  assert(isAtomic());
2199  return extData.VDST;
2200  default:
2201  fatal("Operand at idx %i does not exist\n", opIdx);
2202  return -1;
2203  }
2204  }
2205 } // namespace Gcn3ISA
Gcn3ISA::InFmt_FLAT::GLC
unsigned int GLC
Definition: gpu_decoder.hh:1392
Gcn3ISA::Inst_SMEM::Inst_SMEM
Inst_SMEM(InFmt_SMEM *, const std::string &opcode)
Definition: op_encodings.cc:600
Gcn3ISA::Inst_SMEM::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:662
Gcn3ISA::Inst_VOP3_SDST_ENC::Inst_VOP3_SDST_ENC
Inst_VOP3_SDST_ENC(InFmt_VOP3_SDST_ENC *, const std::string &opcode)
Definition: op_encodings.cc:1522
Gcn3ISA::MachInst
InstFormat * MachInst
used to represent the encoding of a GCN3 inst.
Definition: gpu_types.hh:62
Gcn3ISA::Inst_SMEM::instData
InFmt_SMEM instData
Definition: op_encodings.hh:265
Gcn3ISA::InFmt_VOP3_1::SRC1
unsigned int SRC1
Definition: gpu_decoder.hh:1561
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
Gcn3ISA::InFmt_SMEM_1::OFFSET
unsigned int OFFSET
Definition: gpu_decoder.hh:1488
Gcn3ISA::Inst_VOP1::extData
InstFormat extData
Definition: op_encodings.hh:311
Gcn3ISA::Inst_FLAT::~Inst_FLAT
~Inst_FLAT()
Definition: op_encodings.cc:2117
Gcn3ISA::Inst_VOP1::~Inst_VOP1
~Inst_VOP1()
Definition: op_encodings.cc:964
Gcn3ISA::Inst_VOPC::hasSecondDword
bool hasSecondDword(InFmt_VOPC *)
Definition: op_encodings.cc:1099
Gcn3ISA::REG_SRC_DPP
@ REG_SRC_DPP
Definition: registers.hh:126
GPUStaticInst::writesVCC
bool writesVCC() const
Definition: gpu_static_inst.hh:143
Gcn3ISA::Inst_VINTRP::Inst_VINTRP
Inst_VINTRP(InFmt_VINTRP *, const std::string &opcode)
Definition: op_encodings.cc:1195
Gcn3ISA::Inst_SOPP::~Inst_SOPP
~Inst_SOPP()
Definition: op_encodings.cc:501
Gcn3ISA::Inst_VOP1::varSize
uint32_t varSize
Definition: op_encodings.hh:312
Gcn3ISA::InFmt_VOP3_1::NEG
unsigned int NEG
Definition: gpu_decoder.hh:1564
Gcn3ISA::Inst_SOP1::instSize
int instSize() const override
Definition: op_encodings.cc:290
Gcn3ISA::Inst_DS::~Inst_DS
~Inst_DS()
Definition: op_encodings.cc:1812
Gcn3ISA::Inst_SMEM::~Inst_SMEM
~Inst_SMEM()
Definition: op_encodings.cc:616
Gcn3ISA::InFmt_FLAT_1::ADDR
unsigned int ADDR
Definition: gpu_decoder.hh:1400
GPUStaticInst::isLoad
bool isLoad() const
Definition: gpu_static_inst.hh:127
Gcn3ISA::Inst_DS::instData
InFmt_DS instData
Definition: op_encodings.hh:507
op_encodings.hh
Gcn3ISA::Inst_MTBUF::Inst_MTBUF
Inst_MTBUF(InFmt_MTBUF *, const std::string &opcode)
Definition: op_encodings.cc:2021
Gcn3ISA::Inst_FLAT::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:2160
Gcn3ISA::InFmt_EXP
Definition: gpu_decoder.hh:1373
Gcn3ISA::Inst_VOPC::instData
InFmt_VOPC instData
Definition: op_encodings.hh:333
Gcn3ISA::Inst_SMEM::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:696
Gcn3ISA::InFmt_DS_1::ADDR
unsigned int ADDR
Definition: gpu_decoder.hh:1367
Gcn3ISA::InFmt_SOPP
Definition: gpu_decoder.hh:1520
Gcn3ISA::InFmt_VOP3_1::SRC2
unsigned int SRC2
Definition: gpu_decoder.hh:1562
Gcn3ISA::Inst_FLAT::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:2145
Gcn3ISA::Inst_VOP2::~Inst_VOP2
~Inst_VOP2()
Definition: op_encodings.cc:745
Gcn3ISA::InFmt_MUBUF_1::SRSRC
unsigned int SRSRC
Definition: gpu_decoder.hh:1471
Gcn3ISA::Inst_MUBUF::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:1998
GPUStaticInst::readsVCC
bool readsVCC() const
Definition: gpu_static_inst.hh:142
Gcn3ISA::isScalarReg
bool isScalarReg(int opIdx)
Definition: registers.cc:217
Gcn3ISA::InFmt_MUBUF_1
Definition: gpu_decoder.hh:1468
Gcn3ISA::Inst_VOPC::~Inst_VOPC
~Inst_VOPC()
Definition: op_encodings.cc:1088
GPUStaticInst::numSrcRegOperands
virtual int numSrcRegOperands()=0
Gcn3ISA::InFmt_VOP3_SDST_ENC::SDST
unsigned int SDST
Definition: gpu_decoder.hh:1569
Gcn3ISA::Inst_VOP3::~Inst_VOP3
~Inst_VOP3()
Definition: op_encodings.cc:1225
Gcn3ISA::InFmt_VOP2::VDST
unsigned int VDST
Definition: gpu_decoder.hh:1545
Gcn3ISA::InFmt_VOP3_1::SRC0
unsigned int SRC0
Definition: gpu_decoder.hh:1560
Gcn3ISA::Inst_VOP3::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:1368
Gcn3ISA::Inst_SOP2::varSize
uint32_t varSize
Definition: op_encodings.hh:91
Gcn3ISA::Inst_MIMG::~Inst_MIMG
~Inst_MIMG()
Definition: op_encodings.cc:2066
Gcn3ISA::Inst_SOP2::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:123
GPUStaticInst::getNumOperands
virtual int getNumOperands()=0
Gcn3ISA::InFmt_MTBUF::GLC
unsigned int GLC
Definition: gpu_decoder.hh:1438
Gcn3ISA::Inst_VOP2::varSize
uint32_t varSize
Definition: op_encodings.hh:288
Gcn3ISA::Inst_DS::instSize
int instSize() const override
Definition: op_encodings.cc:1817
Gcn3ISA::InFmt_DS_1::DATA1
unsigned int DATA1
Definition: gpu_decoder.hh:1369
Gcn3ISA::Inst_VOP2::instSize
int instSize() const override
Definition: op_encodings.cc:750
Gcn3ISA::Inst_SOP1::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:344
Gcn3ISA::InFmt_SOPK::OP
unsigned int OP
Definition: gpu_decoder.hh:1516
Gcn3ISA::Inst_VOP3_SDST_ENC::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:1588
Gcn3ISA::InFmt_MUBUF::SLC
unsigned int SLC
Definition: gpu_decoder.hh:1462
Gcn3ISA::Inst_VOP3_SDST_ENC::~Inst_VOP3_SDST_ENC
~Inst_VOP3_SDST_ENC()
Definition: op_encodings.cc:1533
Gcn3ISA::Inst_VOP2::extData
InstFormat extData
Definition: op_encodings.hh:287
Gcn3ISA::Inst_VOP2::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:906
Gcn3ISA::InFmt_MIMG_1
Definition: gpu_decoder.hh:1425
Gcn3ISA::Inst_VOP1::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:1049
Gcn3ISA::Inst_SOPP::Inst_SOPP
Inst_SOPP(InFmt_SOPP *, const std::string &opcode)
Definition: op_encodings.cc:492
GPUStaticInst::setFlag
void setFlag(Flags flag)
Definition: gpu_static_inst.hh:238
Gcn3ISA::Inst_VOP3::instSize
int instSize() const override
Definition: op_encodings.cc:1230
Gcn3ISA::Inst_VOP1::Inst_VOP1
Inst_VOP1(InFmt_VOP1 *, const std::string &opcode)
Definition: op_encodings.cc:944
Gcn3ISA::InFmt_MUBUF_1::VDATA
unsigned int VDATA
Definition: gpu_decoder.hh:1470
Gcn3ISA::Inst_FLAT::extData
InFmt_FLAT_1 extData
Definition: op_encodings.hh:833
Gcn3ISA::InFmt_MIMG::SLC
unsigned int SLC
Definition: gpu_decoder.hh:1421
Gcn3ISA::InFmt_DS::OFFSET0
unsigned int OFFSET0
Definition: gpu_decoder.hh:1358
GPUStaticInst::isStore
bool isStore() const
Definition: gpu_static_inst.hh:128
GPUStaticInst::isAtomic
bool isAtomic() const
Definition: gpu_static_inst.hh:131
Gcn3ISA::REG_VCC_LO
@ REG_VCC_LO
Definition: registers.hh:57
Gcn3ISA::InFmt_SOP2::SSRC1
unsigned int SSRC1
Definition: gpu_decoder.hh:1500
Gcn3ISA::InFmt_SOPC::SSRC1
unsigned int SSRC1
Definition: gpu_decoder.hh:1508
Gcn3ISA::InFmt_MUBUF::GLC
unsigned int GLC
Definition: gpu_decoder.hh:1459
Gcn3ISA::Inst_MUBUF::Inst_MUBUF
Inst_MUBUF(InFmt_MUBUF *, const std::string &opcode)
Definition: op_encodings.cc:1911
Gcn3ISA::Inst_SOP2::hasSecondDword
bool hasSecondDword(InFmt_SOP2 *)
Definition: op_encodings.cc:68
Gcn3ISA::Inst_DS::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:1876
Gcn3ISA::Inst_VOP2::hasSecondDword
bool hasSecondDword(InFmt_VOP2 *)
Definition: op_encodings.cc:756
Gcn3ISA::Inst_MTBUF::instSize
int instSize() const override
Definition: op_encodings.cc:2043
Gcn3ISA::isVectorReg
bool isVectorReg(int opIdx)
Definition: registers.cc:230
Gcn3ISA::Inst_SOPK::instSize
int instSize() const override
Definition: op_encodings.cc:178
Gcn3ISA::InFmt_SMEM::GLC
unsigned int GLC
Definition: gpu_decoder.hh:1481
Gcn3ISA::InFmt_SOPC::SSRC0
unsigned int SSRC0
Definition: gpu_decoder.hh:1507
Gcn3ISA::Inst_SOPK::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:201
Gcn3ISA::Inst_SOPP::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:588
Gcn3ISA::Inst_VOP2::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:820
GPUStaticInst::numDstRegOperands
virtual int numDstRegOperands()=0
Gcn3ISA::Inst_SOPK::varSize
uint32_t varSize
Definition: op_encodings.hh:115
GPUStaticInst::_opcode
const std::string _opcode
Definition: gpu_static_inst.hh:260
Gcn3ISA::Inst_VOP3_SDST_ENC::instData
InFmt_VOP3_SDST_ENC instData
Definition: op_encodings.hh:404
Gcn3ISA::Inst_VINTRP::~Inst_VINTRP
~Inst_VINTRP()
Definition: op_encodings.cc:1202
GPUStaticInst::disassembly
std::string disassembly
Definition: gpu_static_inst.hh:261
Gcn3ISA::InFmt_SOP1::OP
unsigned int OP
Definition: gpu_decoder.hh:1493
Gcn3ISA::Inst_SOPP::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:566
Gcn3ISA::InFmt_DS::OFFSET1
unsigned int OFFSET1
Definition: gpu_decoder.hh:1359
Gcn3ISA::InFmt_MTBUF_1
Definition: gpu_decoder.hh:1445
Gcn3ISA::InFmt_FLAT
Definition: gpu_decoder.hh:1390
Gcn3ISA::InFmt_VOP2
Definition: gpu_decoder.hh:1542
Gcn3ISA::InFmt_DS
Definition: gpu_decoder.hh:1357
Gcn3ISA::Inst_SOP1::hasSecondDword
bool hasSecondDword(InFmt_SOP1 *)
Definition: op_encodings.cc:296
Gcn3ISA::Inst_SOP1::varSize
uint32_t varSize
Definition: op_encodings.hh:139
Gcn3ISA::REG_SRC_LITERAL
@ REG_SRC_LITERAL
Definition: registers.hh:131
Gcn3ISA::Inst_MIMG::extData
InFmt_MIMG_1 extData
Definition: op_encodings.hh:752
Gcn3ISA::Inst_SOPC::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:462
Gcn3ISA::InFmt_SOP2
Definition: gpu_decoder.hh:1498
Gcn3ISA::Inst_VOP3_SDST_ENC::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:1662
Gcn3ISA::Inst_SOPC::extData
InstFormat extData
Definition: op_encodings.hh:162
Gcn3ISA::Inst_VOP1::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:1031
Gcn3ISA::Inst_VINTRP::instSize
int instSize() const override
Definition: op_encodings.cc:1207
Gcn3ISA::Inst_FLAT::instData
InFmt_FLAT instData
Definition: op_encodings.hh:831
Gcn3ISA::Inst_VOP2::instData
InFmt_VOP2 instData
Definition: op_encodings.hh:285
Gcn3ISA::Inst_SOP1::instData
InFmt_SOP1 instData
Definition: op_encodings.hh:136
Gcn3ISA::Inst_VOP2::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:781
Gcn3ISA::Inst_FLAT::instSize
int instSize() const override
Definition: op_encodings.cc:2122
Gcn3ISA::Inst_EXP::~Inst_EXP
~Inst_EXP()
Definition: op_encodings.cc:2088
Gcn3ISA::Inst_SOP2::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:133
Gcn3ISA::Inst_VOP2::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:863
Gcn3ISA::InFmt_SMEM::IMM
unsigned int IMM
Definition: gpu_decoder.hh:1482
Gcn3ISA::Inst_VOP3_SDST_ENC::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:1736
Gcn3ISA::Inst_SOPC::Inst_SOPC
Inst_SOPC(InFmt_SOPC *, const std::string &opcode)
Definition: op_encodings.cc:380
Gcn3ISA::Inst_SOPK::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:249
Gcn3ISA::InFmt_VOPC
Definition: gpu_decoder.hh:1575
Gcn3ISA::InFmt_SMEM_1
Definition: gpu_decoder.hh:1487
Gcn3ISA::Inst_SOP1::extData
InstFormat extData
Definition: op_encodings.hh:138
Gcn3ISA::Inst_MUBUF::instData
InFmt_MUBUF instData
Definition: op_encodings.hh:713
Gcn3ISA
classes that represnt vector/scalar operands in GCN3 ISA.
Definition: decoder.cc:44
Gcn3ISA::Inst_VOP3::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:1442
Gcn3ISA::InFmt_FLAT_1
Definition: gpu_decoder.hh:1399
Gcn3ISA::InFmt_MTBUF
Definition: gpu_decoder.hh:1434
Gcn3ISA::Inst_SOP2::Inst_SOP2
Inst_SOP2(InFmt_SOP2 *, const std::string &opcode)
Definition: op_encodings.cc:44
Gcn3ISA::Inst_VOP1::instSize
int instSize() const override
Definition: op_encodings.cc:969
Gcn3ISA::InFmt_SOPC
Definition: gpu_decoder.hh:1506
Gcn3ISA::InFmt_SOPP::SIMM16
unsigned int SIMM16
Definition: gpu_decoder.hh:1521
Gcn3ISA::Inst_SMEM::extData
InFmt_SMEM_1 extData
Definition: op_encodings.hh:267
Gcn3ISA::InFmt_VOP1::VDST
unsigned int VDST
Definition: gpu_decoder.hh:1538
Gcn3ISA::Inst_SOPC::instData
InFmt_SOPC instData
Definition: op_encodings.hh:160
Gcn3ISA::opSelectorToRegIdx
int opSelectorToRegIdx(int idx, int numScalarRegs)
Definition: registers.cc:123
Gcn3ISA::InFmt_MUBUF
Definition: gpu_decoder.hh:1455
Gcn3ISA::Inst_VOP3::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:1236
Gcn3ISA::Inst_SMEM::instSize
int instSize() const override
Definition: op_encodings.cc:621
Gcn3ISA::Inst_MTBUF::~Inst_MTBUF
~Inst_MTBUF()
Definition: op_encodings.cc:2038
Gcn3ISA::Inst_EXP::extData
InFmt_EXP_1 extData
Definition: op_encodings.hh:767
Gcn3ISA::Inst_VOPC::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:1172
Gcn3ISA::InFmt_SOPK
Definition: gpu_decoder.hh:1513
Gcn3ISA::Inst_SOP1::~Inst_SOP1
~Inst_SOP1()
Definition: op_encodings.cc:285
Gcn3ISA::InFmt_FLAT::SLC
unsigned int SLC
Definition: gpu_decoder.hh:1393
Gcn3ISA::InFmt_VINTRP
Definition: gpu_decoder.hh:1526
Gcn3ISA::InFmt_MUBUF_1::SOFFSET
unsigned int SOFFSET
Definition: gpu_decoder.hh:1474
Gcn3ISA::Inst_VOPC::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:1130
Gcn3ISA::Inst_VOP3::extData
InFmt_VOP3_1 extData
Definition: op_encodings.hh:372
Gcn3ISA::Inst_SOP1::Inst_SOP1
Inst_SOP1(InFmt_SOP1 *, const std::string &opcode)
Definition: op_encodings.cc:268
Gcn3ISA::Inst_SOPC::instSize
int instSize() const override
Definition: op_encodings.cc:402
Gcn3ISA::Inst_SOPP::instData
InFmt_SOPP instData
Definition: op_encodings.hh:184
Gcn3ISA::Inst_SOPC::hasSecondDword
bool hasSecondDword(InFmt_SOPC *)
Definition: op_encodings.cc:408
Gcn3ISA::InFmt_SMEM::SBASE
unsigned int SBASE
Definition: gpu_decoder.hh:1478
Gcn3ISA::InFmt_VOP3::VDST
unsigned int VDST
Definition: gpu_decoder.hh:1551
Gcn3ISA::InFmt_SOP2::SDST
unsigned int SDST
Definition: gpu_decoder.hh:1501
Gcn3ISA::InFmt_MUBUF::OFFSET
unsigned int OFFSET
Definition: gpu_decoder.hh:1456
Gcn3ISA::InFmt_SOP1::SSRC0
unsigned int SSRC0
Definition: gpu_decoder.hh:1492
Gcn3ISA::Inst_FLAT::Inst_FLAT
Inst_FLAT(InFmt_FLAT *, const std::string &opcode)
Definition: op_encodings.cc:2100
Gcn3ISA::Inst_SOPK::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:239
Gcn3ISA::Inst_SOP1::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:322
Gcn3ISA::Inst_MIMG::Inst_MIMG
Inst_MIMG(InFmt_MIMG *, const std::string &opcode)
Definition: op_encodings.cc:2050
Gcn3ISA::Inst_SOPK::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:222
Gcn3ISA::InFmt_VOP1
Definition: gpu_decoder.hh:1535
Gcn3ISA::Inst_VOPC::varSize
uint32_t varSize
Definition: op_encodings.hh:336
Gcn3ISA::InFmt_MUBUF_1::VADDR
unsigned int VADDR
Definition: gpu_decoder.hh:1469
Gcn3ISA::Inst_MUBUF::~Inst_MUBUF
~Inst_MUBUF()
Definition: op_encodings.cc:1927
Gcn3ISA::Inst_SOPK::Inst_SOPK
Inst_SOPK(InFmt_SOPK *, const std::string &opcode)
Definition: op_encodings.cc:156
Gcn3ISA::Inst_SOP2::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:104
Gcn3ISA::InFmt_VOP3
Definition: gpu_decoder.hh:1550
Gcn3ISA::InFmt_MTBUF_1::SLC
unsigned int SLC
Definition: gpu_decoder.hh:1450
Gcn3ISA::InFmt_DS_1
Definition: gpu_decoder.hh:1366
Gcn3ISA::InFmt_SOP1
Definition: gpu_decoder.hh:1491
Gcn3ISA::InFmt_VOP3_1
Definition: gpu_decoder.hh:1559
Gcn3ISA::Inst_DS::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:1856
Gcn3ISA::Inst_VOPC::extData
InstFormat extData
Definition: op_encodings.hh:335
Gcn3ISA::Inst_VOP1::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:1013
Gcn3ISA::GCN3GPUStaticInst::getOperandSize
int getOperandSize(int opIdx) override
Definition: gpu_static_inst.hh:72
Gcn3ISA::InFmt_VOP2::VSRC1
unsigned int VSRC1
Definition: gpu_decoder.hh:1544
Gcn3ISA::InFmt_FLAT_1::DATA
unsigned int DATA
Definition: gpu_decoder.hh:1401
Gcn3ISA::Inst_SOP1::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:305
Gcn3ISA::Inst_EXP::instSize
int instSize() const override
Definition: op_encodings.cc:2093
ArmISA::opcode
Bitfield< 24, 21 > opcode
Definition: types.hh:101
Gcn3ISA::InFmt_VOP1::SRC0
unsigned int SRC0
Definition: gpu_decoder.hh:1536
Gcn3ISA::Inst_VOP3_SDST_ENC::instSize
int instSize() const override
Definition: op_encodings.cc:1538
Gcn3ISA::InFmt_DS_1::DATA0
unsigned int DATA0
Definition: gpu_decoder.hh:1368
Gcn3ISA::Inst_SOP2::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:80
Gcn3ISA::Inst_SOPC::varSize
uint32_t varSize
Definition: op_encodings.hh:163
Gcn3ISA::InFmt_SOPP::OP
unsigned int OP
Definition: gpu_decoder.hh:1522
Gcn3ISA::Inst_EXP::Inst_EXP
Inst_EXP(InFmt_EXP *, const std::string &opcode)
Definition: op_encodings.cc:2078
Gcn3ISA::Inst_SOPC::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:420
Gcn3ISA::Inst_VOP1::hasSecondDword
bool hasSecondDword(InFmt_VOP1 *)
Definition: op_encodings.cc:975
Gcn3ISA::Inst_SOP2::instData
InFmt_SOP2 instData
Definition: op_encodings.hh:88
Gcn3ISA::Inst_MUBUF::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:1977
Gcn3ISA::Inst_DS::Inst_DS
Inst_DS(InFmt_DS *, const std::string &opcode)
Definition: op_encodings.cc:1800
Gcn3ISA::InFmt_SMEM
Definition: gpu_decoder.hh:1477
Gcn3ISA::Inst_VOP3_SDST_ENC::extData
InFmt_VOP3_1 extData
Definition: op_encodings.hh:406
Gcn3ISA::Inst_SOPK::~Inst_SOPK
~Inst_SOPK()
Definition: op_encodings.cc:173
Gcn3ISA::Inst_SOPK::extData
InstFormat extData
Definition: op_encodings.hh:114
Gcn3ISA::Inst_VOPC::instSize
int instSize() const override
Definition: op_encodings.cc:1093
Gcn3ISA::Inst_SOP2::extData
InstFormat extData
Definition: op_encodings.hh:90
Gcn3ISA::Inst_VOP3_SDST_ENC::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:1544
Gcn3ISA::InFmt_VOPC::SRC0
unsigned int SRC0
Definition: gpu_decoder.hh:1576
Gcn3ISA::GCN3GPUStaticInst::_srcLiteral
ScalarRegU32 _srcLiteral
if the instruction has a src literal - an immediate value that is part of the instruction stream - we...
Definition: gpu_static_inst.hh:98
Gcn3ISA::InFmt_SOP2::SSRC0
unsigned int SSRC0
Definition: gpu_decoder.hh:1499
Gcn3ISA::Inst_DS::extData
InFmt_DS_1 extData
Definition: op_encodings.hh:509
Gcn3ISA::opSelectorToRegSym
std::string opSelectorToRegSym(int idx, int numRegs)
Definition: registers.cc:41
Gcn3ISA::Inst_VOP1::instData
InFmt_VOP1 instData
Definition: op_encodings.hh:309
Gcn3ISA::Inst_MTBUF::extData
InFmt_MTBUF_1 extData
Definition: op_encodings.hh:734
Gcn3ISA::Inst_SOPK::hasSecondDword
bool hasSecondDword(InFmt_SOPK *)
Definition: op_encodings.cc:184
Gcn3ISA::InFmt_DS_1::VDST
unsigned int VDST
Definition: gpu_decoder.hh:1370
Gcn3ISA::InFmt_VOPC::VSRC1
unsigned int VSRC1
Definition: gpu_decoder.hh:1577
Gcn3ISA::Inst_SOPP::instSize
int instSize() const override
Definition: op_encodings.cc:506
Gcn3ISA::Inst_VOP2::Inst_VOP2
Inst_VOP2(InFmt_VOP2 *, const std::string &opcode)
Definition: op_encodings.cc:725
Gcn3ISA::InFmt_SOPK::SDST
unsigned int SDST
Definition: gpu_decoder.hh:1515
GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:48
Gcn3ISA::Inst_VOP3::sgprDst
const bool sgprDst
the v_cmp and readlane instructions in the VOP3 encoding are unique because they are the only instruc...
Definition: op_encodings.hh:386
Gcn3ISA::InFmt_EXP_1
Definition: gpu_decoder.hh:1383
Gcn3ISA::Inst_VOPC::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:1151
Gcn3ISA::Inst_SOP2::instSize
int instSize() const override
Definition: op_encodings.cc:62
Gcn3ISA::Inst_VOP1::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:994
Gcn3ISA::Inst_EXP::instData
InFmt_EXP instData
Definition: op_encodings.hh:765
Gcn3ISA::Inst_VOP3::Inst_VOP3
Inst_VOP3(InFmt_VOP3 *, const std::string &opcode, bool sgpr_dst)
Definition: op_encodings.cc:1214
Gcn3ISA::Inst_MUBUF::instSize
int instSize() const override
Definition: op_encodings.cc:1932
Gcn3ISA::REG_SRC_SWDA
@ REG_SRC_SWDA
Definition: registers.hh:125
Gcn3ISA::Inst_FLAT::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:2175
Gcn3ISA::InstFormat::imm_u32
uint32_t imm_u32
Definition: gpu_decoder.hh:1642
Gcn3ISA::Inst_VOPC::Inst_VOPC
Inst_VOPC(InFmt_VOPC *, const std::string &opcode)
Definition: op_encodings.cc:1068
Gcn3ISA::Inst_MUBUF::extData
InFmt_MUBUF_1 extData
Definition: op_encodings.hh:715
Gcn3ISA::InFmt_VOP2::OP
unsigned int OP
Definition: gpu_decoder.hh:1546
Gcn3ISA::InFmt_SMEM::SDATA
unsigned int SDATA
Definition: gpu_decoder.hh:1479
Gcn3ISA::Inst_SOPK::instData
InFmt_SOPK instData
Definition: op_encodings.hh:112
Gcn3ISA::Inst_SOPP::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:577
Gcn3ISA::InFmt_MIMG
Definition: gpu_decoder.hh:1411
Gcn3ISA::Inst_VOP3::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:1294
Gcn3ISA::InFmt_VOP3_SDST_ENC
Definition: gpu_decoder.hh:1567
Gcn3ISA::InFmt_VOP2::SRC0
unsigned int SRC0
Definition: gpu_decoder.hh:1543
Gcn3ISA::InFmt_SOPK::SIMM16
unsigned int SIMM16
Definition: gpu_decoder.hh:1514
Gcn3ISA::Inst_SOP1::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:354
Gcn3ISA::Inst_FLAT::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:2128
Gcn3ISA::Inst_SOPC::getRegisterIndex
int getRegisterIndex(int opIdx, GPUDynInstPtr gpuDynInst) override
Definition: op_encodings.cc:472
Gcn3ISA::Inst_MTBUF::instData
InFmt_MTBUF instData
Definition: op_encodings.hh:732
Gcn3ISA::Inst_SMEM::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:627
Gcn3ISA::Inst_MIMG::instSize
int instSize() const override
Definition: op_encodings.cc:2071
Gcn3ISA::Inst_SOPC::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:443
Gcn3ISA::Inst_SOPP::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:512
Gcn3ISA::InFmt_SOP1::SDST
unsigned int SDST
Definition: gpu_decoder.hh:1494
Gcn3ISA::Inst_MIMG::instData
InFmt_MIMG instData
Definition: op_encodings.hh:750
Gcn3ISA::Inst_DS::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:1823
Gcn3ISA::Inst_SOPC::~Inst_SOPC
~Inst_SOPC()
Definition: op_encodings.cc:397
Gcn3ISA::Inst_SMEM::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:686
Gcn3ISA::Inst_MUBUF::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:1938
Gcn3ISA::Inst_VOP3::instData
InFmt_VOP3 instData
Definition: op_encodings.hh:370
Gcn3ISA::Inst_MUBUF::isScalarRegister
bool isScalarRegister(int opIdx) override
Definition: op_encodings.cc:1956
Gcn3ISA::InFmt_FLAT_1::VDST
unsigned int VDST
Definition: gpu_decoder.hh:1404
Gcn3ISA::InFmt_MIMG::GLC
unsigned int GLC
Definition: gpu_decoder.hh:1415
Gcn3ISA::InFmt_VOP3_SDST_ENC::VDST
unsigned int VDST
Definition: gpu_decoder.hh:1568
Gcn3ISA::Inst_VOPC::generateDisassembly
void generateDisassembly() override
Definition: op_encodings.cc:1118
Gcn3ISA::Inst_VINTRP::instData
InFmt_VINTRP instData
Definition: op_encodings.hh:352
ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:153
Gcn3ISA::Inst_DS::isVectorRegister
bool isVectorRegister(int opIdx) override
Definition: op_encodings.cc:1866
Gcn3ISA::GCN3GPUStaticInst
Definition: gpu_static_inst.hh:48

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17