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

Generated on Tue Jun 22 2021 15:28:24 for gem5 by doxygen 1.8.17