gem5  v22.1.0.0
instructions.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2021 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
33 
34 #include <cmath>
35 
37 #include "debug/VEGA.hh"
38 #include "debug/GPUSync.hh"
40 #include "gpu-compute/shader.hh"
41 
42 namespace gem5
43 {
44 
45 namespace VegaISA
46 {
47  // --- Inst_SOP2__S_ADD_U32 class methods ---
48 
50  : Inst_SOP2(iFmt, "s_add_u32")
51  {
52  setFlag(ALU);
53  } // Inst_SOP2__S_ADD_U32
54 
56  {
57  } // ~Inst_SOP2__S_ADD_U32
58 
59  // --- description from .arch file ---
60  // D.u = S0.u + S1.u;
61  // SCC = (S0.u + S1.u >= 0x800000000ULL ? 1 : 0) is an unsigned
62  // --- overflow/carry-out for S_ADDC_U32.
63  void
65  {
66  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
67  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
68  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
69  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
70 
71  src0.read();
72  src1.read();
73 
74  sdst = src0.rawData() + src1.rawData();
75  scc = ((ScalarRegU64)src0.rawData() + (ScalarRegU64)src1.rawData())
76  >= 0x100000000ULL ? 1 : 0;
77 
78  sdst.write();
79  scc.write();
80  } // execute
81  // --- Inst_SOP2__S_SUB_U32 class methods ---
82 
84  : Inst_SOP2(iFmt, "s_sub_u32")
85  {
86  setFlag(ALU);
87  } // Inst_SOP2__S_SUB_U32
88 
90  {
91  } // ~Inst_SOP2__S_SUB_U32
92 
93  // --- description from .arch file ---
94  // D.u = S0.u - S1.u;
95  // SCC = (S1.u > S0.u ? 1 : 0) is an unsigned overflow or carry-out for
96  // --- S_SUBB_U32.
97  void
99  {
100  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
101  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
102  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
103  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
104 
105  src0.read();
106  src1.read();
107 
108  sdst = src0.rawData() - src1.rawData();
109  scc = (src1.rawData() > src0.rawData()) ? 1 : 0;
110 
111  sdst.write();
112  scc.write();
113  } // execute
114  // --- Inst_SOP2__S_ADD_I32 class methods ---
115 
117  : Inst_SOP2(iFmt, "s_add_i32")
118  {
119  setFlag(ALU);
120  } // Inst_SOP2__S_ADD_I32
121 
123  {
124  } // ~Inst_SOP2__S_ADD_I32
125 
126  // --- description from .arch file ---
127  // D.i = S0.i + S1.i;
128  // SCC = (S0.u[31] == S1.u[31] && S0.u[31] != D.u[31]) is a signed
129  // overflow.
130  // This opcode is not suitable for use with S_ADDC_U32 for implementing
131  // 64-bit operations.
132  void
134  {
135  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
136  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
137  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
138  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
139 
140  src0.read();
141  src1.read();
142 
143  sdst = src0.rawData() + src1.rawData();
144  scc = (bits(src0.rawData(), 31) == bits(src1.rawData(), 31)
145  && bits(src0.rawData(), 31) != bits(sdst.rawData(), 31))
146  ? 1 : 0;
147 
148  sdst.write();
149  scc.write();
150  } // execute
151  // --- Inst_SOP2__S_SUB_I32 class methods ---
152 
154  : Inst_SOP2(iFmt, "s_sub_i32")
155  {
156  setFlag(ALU);
157  } // Inst_SOP2__S_SUB_I32
158 
160  {
161  } // ~Inst_SOP2__S_SUB_I32
162 
163  // --- description from .arch file ---
164  // D.i = S0.i - S1.i;
165  // SCC = (S0.u[31] != S1.u[31] && S0.u[31] != D.u[31]) is a signed
166  // overflow.
167  // CAUTION: The condition code behaviour for this opcode is inconsistent
168  // with V_SUB_I32; see V_SUB_I32 for further details.
169  // This opcode is not suitable for use with S_SUBB_U32 for implementing
170  // 64-bit operations.
171  void
173  {
174  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
175  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
176  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
177  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
178 
179  src0.read();
180  src1.read();
181 
182  sdst = src0.rawData() - src1.rawData();
183  scc = (bits(src0.rawData(), 31) != bits(src1.rawData(), 31)
184  && bits(src0.rawData(), 31) != bits(sdst.rawData(), 31)) ? 1 : 0;
185 
186  sdst.write();
187  scc.write();
188  } // execute
189  // --- Inst_SOP2__S_ADDC_U32 class methods ---
190 
192  : Inst_SOP2(iFmt, "s_addc_u32")
193  {
194  setFlag(ALU);
195  } // Inst_SOP2__S_ADDC_U32
196 
198  {
199  } // ~Inst_SOP2__S_ADDC_U32
200 
201  // --- description from .arch file ---
202  // D.u = S0.u + S1.u + SCC;
203  // SCC = (S0.u + S1.u + SCC >= 0x800000000ULL ? 1 : 0) is an unsigned
204  // overflow.
205  void
207  {
208  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
209  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
210  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
211  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
212 
213  src0.read();
214  src1.read();
215  scc.read();
216 
217  sdst = src0.rawData() + src1.rawData() + scc.rawData();
218  scc = ((ScalarRegU64)src0.rawData() + (ScalarRegU64)src1.rawData()
219  + (ScalarRegU64)scc.rawData()) >= 0x100000000ULL ? 1 : 0;
220 
221  sdst.write();
222  scc.write();
223  } // execute
224  // --- Inst_SOP2__S_SUBB_U32 class methods ---
225 
227  : Inst_SOP2(iFmt, "s_subb_u32")
228  {
229  setFlag(ALU);
230  } // Inst_SOP2__S_SUBB_U32
231 
233  {
234  } // ~Inst_SOP2__S_SUBB_U32
235 
236  // --- description from .arch file ---
237  // D.u = S0.u - S1.u - SCC;
238  // SCC = (S1.u + SCC > S0.u ? 1 : 0) is an unsigned overflow.
239  void
241  {
242  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
243  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
244  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
245  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
246 
247  src0.read();
248  src1.read();
249  scc.read();
250 
251  sdst = src0.rawData() - src1.rawData() - scc.rawData();
252  scc = (src1.rawData() + scc.rawData()) > src0.rawData() ? 1 : 0;
253 
254  sdst.write();
255  scc.write();
256  } // execute
257  // --- Inst_SOP2__S_MIN_I32 class methods ---
258 
260  : Inst_SOP2(iFmt, "s_min_i32")
261  {
262  setFlag(ALU);
263  } // Inst_SOP2__S_MIN_I32
264 
266  {
267  } // ~Inst_SOP2__S_MIN_I32
268 
269  // --- description from .arch file ---
270  // D.i = (S0.i < S1.i) ? S0.i : S1.i;
271  // SCC = 1 if S0 is chosen as the minimum value.
272  void
274  {
275  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
276  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
277  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
278  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
279 
280  src0.read();
281  src1.read();
282 
283  sdst = std::min(src0.rawData(), src1.rawData());
284  scc = (src0.rawData() < src1.rawData()) ? 1 : 0;
285 
286  sdst.write();
287  scc.write();
288  } // execute
289  // --- Inst_SOP2__S_MIN_U32 class methods ---
290 
292  : Inst_SOP2(iFmt, "s_min_u32")
293  {
294  setFlag(ALU);
295  } // Inst_SOP2__S_MIN_U32
296 
298  {
299  } // ~Inst_SOP2__S_MIN_U32
300 
301  // --- description from .arch file ---
302  // D.u = (S0.u < S1.u) ? S0.u : S1.u;
303  // SCC = 1 if S0 is chosen as the minimum value.
304  void
306  {
307  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
308  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
309  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
310  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
311 
312  src0.read();
313  src1.read();
314 
315  sdst = std::min(src0.rawData(), src1.rawData());
316  scc = (src0.rawData() < src1.rawData()) ? 1 : 0;
317 
318  sdst.write();
319  scc.write();
320  } // execute
321  // --- Inst_SOP2__S_MAX_I32 class methods ---
322 
324  : Inst_SOP2(iFmt, "s_max_i32")
325  {
326  setFlag(ALU);
327  } // Inst_SOP2__S_MAX_I32
328 
330  {
331  } // ~Inst_SOP2__S_MAX_I32
332 
333  // --- description from .arch file ---
334  // D.i = (S0.i > S1.i) ? S0.i : S1.i;
335  // SCC = 1 if S0 is chosen as the maximum value.
336  void
338  {
339  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
340  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
341  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
342  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
343 
344  src0.read();
345  src1.read();
346 
347  sdst = std::max(src0.rawData(), src1.rawData());
348  scc = (src0.rawData() > src1.rawData()) ? 1 : 0;
349 
350  sdst.write();
351  scc.write();
352  } // execute
353  // --- Inst_SOP2__S_MAX_U32 class methods ---
354 
356  : Inst_SOP2(iFmt, "s_max_u32")
357  {
358  setFlag(ALU);
359  } // Inst_SOP2__S_MAX_U32
360 
362  {
363  } // ~Inst_SOP2__S_MAX_U32
364 
365  // --- description from .arch file ---
366  // D.u = (S0.u > S1.u) ? S0.u : S1.u;
367  // SCC = 1 if S0 is chosen as the maximum value.
368  void
370  {
371  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
372  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
373  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
374  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
375 
376  src0.read();
377  src1.read();
378 
379  sdst = std::max(src0.rawData(), src1.rawData());
380  scc = (src0.rawData() > src1.rawData()) ? 1 : 0;
381 
382  sdst.write();
383  scc.write();
384  } // execute
385  // --- Inst_SOP2__S_CSELECT_B32 class methods ---
386 
388  : Inst_SOP2(iFmt, "s_cselect_b32")
389  {
390  setFlag(ALU);
391  } // Inst_SOP2__S_CSELECT_B32
392 
394  {
395  } // ~Inst_SOP2__S_CSELECT_B32
396 
397  // --- description from .arch file ---
398  // D.u = SCC ? S0.u : S1.u (conditional select).
399  void
401  {
402  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
403  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
404  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
405  ConstScalarOperandU32 scc(gpuDynInst, REG_SCC);
406 
407  src0.read();
408  src1.read();
409  scc.read();
410 
411  sdst = scc.rawData() ? src0.rawData() : src1.rawData();
412 
413  sdst.write();
414  } // execute
415  // --- Inst_SOP2__S_CSELECT_B64 class methods ---
416 
418  : Inst_SOP2(iFmt, "s_cselect_b64")
419  {
420  setFlag(ALU);
421  } // Inst_SOP2__S_CSELECT_B64
422 
424  {
425  } // ~Inst_SOP2__S_CSELECT_B64
426 
427  // --- description from .arch file ---
428  // D.u64 = SCC ? S0.u64 : S1.u64 (conditional select).
429  void
431  {
432  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
433  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
434  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
435  ConstScalarOperandU32 scc(gpuDynInst, REG_SCC);
436 
437  src0.read();
438  src1.read();
439  scc.read();
440 
441  sdst = scc.rawData() ? src0.rawData() : src1.rawData();
442 
443  sdst.write();
444  } // execute
445  // --- Inst_SOP2__S_AND_B32 class methods ---
446 
448  : Inst_SOP2(iFmt, "s_and_b32")
449  {
450  setFlag(ALU);
451  } // Inst_SOP2__S_AND_B32
452 
454  {
455  } // ~Inst_SOP2__S_AND_B32
456 
457  // --- description from .arch file ---
458  // D.u = S0.u & S1.u;
459  // SCC = 1 if result is non-zero.
460  void
462  {
463  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
464  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
465  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
466  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
467 
468  src0.read();
469  src1.read();
470 
471  sdst = src0.rawData() & src1.rawData();
472  scc = sdst.rawData() ? 1 : 0;
473 
474  sdst.write();
475  scc.write();
476  } // execute
477  // --- Inst_SOP2__S_AND_B64 class methods ---
478 
480  : Inst_SOP2(iFmt, "s_and_b64")
481  {
482  setFlag(ALU);
483  } // Inst_SOP2__S_AND_B64
484 
486  {
487  } // ~Inst_SOP2__S_AND_B64
488 
489  // --- description from .arch file ---
490  // D.u64 = S0.u64 & S1.u64;
491  // SCC = 1 if result is non-zero.
492  void
494  {
495  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
496  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
497  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
498  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
499 
500  src0.read();
501  src1.read();
502 
503  sdst = src0.rawData() & src1.rawData();
504  scc = sdst.rawData() ? 1 : 0;
505 
506  sdst.write();
507  scc.write();
508  } // execute
509  // --- Inst_SOP2__S_OR_B32 class methods ---
510 
512  : Inst_SOP2(iFmt, "s_or_b32")
513  {
514  setFlag(ALU);
515  } // Inst_SOP2__S_OR_B32
516 
518  {
519  } // ~Inst_SOP2__S_OR_B32
520 
521  // --- description from .arch file ---
522  // D.u = S0.u | S1.u;
523  // SCC = 1 if result is non-zero.
524  void
526  {
527  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
528  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
529  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
530  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
531 
532  src0.read();
533  src1.read();
534 
535  sdst = src0.rawData() | src1.rawData();
536  scc = sdst.rawData() ? 1 : 0;
537 
538  sdst.write();
539  scc.write();
540  } // execute
541  // --- Inst_SOP2__S_OR_B64 class methods ---
542 
544  : Inst_SOP2(iFmt, "s_or_b64")
545  {
546  setFlag(ALU);
547  } // Inst_SOP2__S_OR_B64
548 
550  {
551  } // ~Inst_SOP2__S_OR_B64
552 
553  // --- description from .arch file ---
554  // D.u64 = S0.u64 | S1.u64;
555  // SCC = 1 if result is non-zero.
556  void
558  {
559  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
560  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
561  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
562  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
563 
564  src0.read();
565  src1.read();
566 
567  sdst = src0.rawData() | src1.rawData();
568  scc = sdst.rawData() ? 1 : 0;
569 
570  sdst.write();
571  scc.write();
572  } // execute
573  // --- Inst_SOP2__S_XOR_B32 class methods ---
574 
576  : Inst_SOP2(iFmt, "s_xor_b32")
577  {
578  setFlag(ALU);
579  } // Inst_SOP2__S_XOR_B32
580 
582  {
583  } // ~Inst_SOP2__S_XOR_B32
584 
585  // --- description from .arch file ---
586  // D.u = S0.u ^ S1.u;
587  // SCC = 1 if result is non-zero.
588  void
590  {
591  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
592  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
593  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
594  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
595 
596  src0.read();
597  src1.read();
598 
599  sdst = src0.rawData() ^ src1.rawData();
600  scc = sdst.rawData() ? 1 : 0;
601 
602  sdst.write();
603  scc.write();
604  } // execute
605  // --- Inst_SOP2__S_XOR_B64 class methods ---
606 
608  : Inst_SOP2(iFmt, "s_xor_b64")
609  {
610  setFlag(ALU);
611  } // Inst_SOP2__S_XOR_B64
612 
614  {
615  } // ~Inst_SOP2__S_XOR_B64
616 
617  // --- description from .arch file ---
618  // D.u64 = S0.u64 ^ S1.u64;
619  // SCC = 1 if result is non-zero.
620  void
622  {
623  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
624  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
625  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
626  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
627 
628  src0.read();
629  src1.read();
630 
631  sdst = src0.rawData() ^ src1.rawData();
632  scc = sdst.rawData() ? 1 : 0;
633 
634  sdst.write();
635  scc.write();
636  } // execute
637  // --- Inst_SOP2__S_ANDN2_B32 class methods ---
638 
640  : Inst_SOP2(iFmt, "s_andn2_b32")
641  {
642  setFlag(ALU);
643  } // Inst_SOP2__S_ANDN2_B32
644 
646  {
647  } // ~Inst_SOP2__S_ANDN2_B32
648 
649  // --- description from .arch file ---
650  // D.u = S0.u & ~S1.u;
651  // SCC = 1 if result is non-zero.
652  void
654  {
655  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
656  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
657  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
658  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
659 
660  src0.read();
661  src1.read();
662 
663  sdst = src0.rawData() &~ src1.rawData();
664  scc = sdst.rawData() ? 1 : 0;
665 
666  sdst.write();
667  scc.write();
668  } // execute
669  // --- Inst_SOP2__S_ANDN2_B64 class methods ---
670 
672  : Inst_SOP2(iFmt, "s_andn2_b64")
673  {
674  setFlag(ALU);
675  } // Inst_SOP2__S_ANDN2_B64
676 
678  {
679  } // ~Inst_SOP2__S_ANDN2_B64
680 
681  // --- description from .arch file ---
682  // D.u64 = S0.u64 & ~S1.u64;
683  // SCC = 1 if result is non-zero.
684  void
686  {
687  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
688  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
689  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
690  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
691 
692  src0.read();
693  src1.read();
694 
695  sdst = src0.rawData() &~ src1.rawData();
696  scc = sdst.rawData() ? 1 : 0;
697 
698  sdst.write();
699  scc.write();
700  } // execute
701  // --- Inst_SOP2__S_ORN2_B32 class methods ---
702 
704  : Inst_SOP2(iFmt, "s_orn2_b32")
705  {
706  setFlag(ALU);
707  } // Inst_SOP2__S_ORN2_B32
708 
710  {
711  } // ~Inst_SOP2__S_ORN2_B32
712 
713  // --- description from .arch file ---
714  // D.u = S0.u | ~S1.u;
715  // SCC = 1 if result is non-zero.
716  void
718  {
719  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
720  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
721  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
722  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
723 
724  src0.read();
725  src1.read();
726 
727  sdst = src0.rawData() |~ src1.rawData();
728  scc = sdst.rawData() ? 1 : 0;
729 
730  sdst.write();
731  scc.write();
732  } // execute
733  // --- Inst_SOP2__S_ORN2_B64 class methods ---
734 
736  : Inst_SOP2(iFmt, "s_orn2_b64")
737  {
738  setFlag(ALU);
739  } // Inst_SOP2__S_ORN2_B64
740 
742  {
743  } // ~Inst_SOP2__S_ORN2_B64
744 
745  // --- description from .arch file ---
746  // D.u64 = S0.u64 | ~S1.u64;
747  // SCC = 1 if result is non-zero.
748  void
750  {
751  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
752  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
753  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
754  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
755 
756  src0.read();
757  src1.read();
758 
759  sdst = src0.rawData() |~ src1.rawData();
760  scc = sdst.rawData() ? 1 : 0;
761 
762  sdst.write();
763  scc.write();
764  } // execute
765  // --- Inst_SOP2__S_NAND_B32 class methods ---
766 
768  : Inst_SOP2(iFmt, "s_nand_b32")
769  {
770  setFlag(ALU);
771  } // Inst_SOP2__S_NAND_B32
772 
774  {
775  } // ~Inst_SOP2__S_NAND_B32
776 
777  // --- description from .arch file ---
778  // D.u = ~(S0.u & S1.u);
779  // SCC = 1 if result is non-zero.
780  void
782  {
783  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
784  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
785  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
786  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
787 
788  src0.read();
789  src1.read();
790 
791  sdst = ~(src0.rawData() & src1.rawData());
792  scc = sdst.rawData() ? 1 : 0;
793 
794  sdst.write();
795  scc.write();
796  } // execute
797  // --- Inst_SOP2__S_NAND_B64 class methods ---
798 
800  : Inst_SOP2(iFmt, "s_nand_b64")
801  {
802  setFlag(ALU);
803  } // Inst_SOP2__S_NAND_B64
804 
806  {
807  } // ~Inst_SOP2__S_NAND_B64
808 
809  // --- description from .arch file ---
810  // D.u64 = ~(S0.u64 & S1.u64);
811  // SCC = 1 if result is non-zero.
812  void
814  {
815  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
816  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
817  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
818  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
819 
820  src0.read();
821  src1.read();
822 
823  sdst = ~(src0.rawData() & src1.rawData());
824  scc = sdst.rawData() ? 1 : 0;
825 
826  sdst.write();
827  scc.write();
828  } // execute
829  // --- Inst_SOP2__S_NOR_B32 class methods ---
830 
832  : Inst_SOP2(iFmt, "s_nor_b32")
833  {
834  setFlag(ALU);
835  } // Inst_SOP2__S_NOR_B32
836 
838  {
839  } // ~Inst_SOP2__S_NOR_B32
840 
841  // --- description from .arch file ---
842  // D.u = ~(S0.u | S1.u);
843  // SCC = 1 if result is non-zero.
844  void
846  {
847  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
848  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
849  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
850  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
851 
852  src0.read();
853  src1.read();
854 
855  sdst = ~(src0.rawData() | src1.rawData());
856  scc = sdst.rawData() ? 1 : 0;
857 
858  sdst.write();
859  scc.write();
860  } // execute
861  // --- Inst_SOP2__S_NOR_B64 class methods ---
862 
864  : Inst_SOP2(iFmt, "s_nor_b64")
865  {
866  setFlag(ALU);
867  } // Inst_SOP2__S_NOR_B64
868 
870  {
871  } // ~Inst_SOP2__S_NOR_B64
872 
873  // --- description from .arch file ---
874  // D.u64 = ~(S0.u64 | S1.u64);
875  // SCC = 1 if result is non-zero.
876  void
878  {
879  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
880  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
881  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
882  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
883 
884  src0.read();
885  src1.read();
886 
887  sdst = ~(src0.rawData() | src1.rawData());
888  scc = sdst.rawData() ? 1 : 0;
889 
890  sdst.write();
891  scc.write();
892  } // execute
893  // --- Inst_SOP2__S_XNOR_B32 class methods ---
894 
896  : Inst_SOP2(iFmt, "s_xnor_b32")
897  {
898  setFlag(ALU);
899  } // Inst_SOP2__S_XNOR_B32
900 
902  {
903  } // ~Inst_SOP2__S_XNOR_B32
904 
905  // --- description from .arch file ---
906  // D.u = ~(S0.u ^ S1.u);
907  // SCC = 1 if result is non-zero.
908  void
910  {
911  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
912  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
913  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
914  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
915 
916  src0.read();
917  src1.read();
918 
919  sdst = ~(src0.rawData() ^ src1.rawData());
920  scc = sdst.rawData() ? 1 : 0;
921 
922  sdst.write();
923  scc.write();
924  } // execute
925  // --- Inst_SOP2__S_XNOR_B64 class methods ---
926 
928  : Inst_SOP2(iFmt, "s_xnor_b64")
929  {
930  setFlag(ALU);
931  } // Inst_SOP2__S_XNOR_B64
932 
934  {
935  } // ~Inst_SOP2__S_XNOR_B64
936 
937  // --- description from .arch file ---
938  // D.u64 = ~(S0.u64 ^ S1.u64);
939  // SCC = 1 if result is non-zero.
940  void
942  {
943  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
944  ConstScalarOperandU64 src1(gpuDynInst, instData.SSRC1);
945  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
946  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
947 
948  src0.read();
949  src1.read();
950 
951  sdst = ~(src0.rawData() ^ src1.rawData());
952  scc = sdst.rawData() ? 1 : 0;
953 
954  sdst.write();
955  scc.write();
956  } // execute
957  // --- Inst_SOP2__S_LSHL_B32 class methods ---
958 
960  : Inst_SOP2(iFmt, "s_lshl_b32")
961  {
962  setFlag(ALU);
963  } // Inst_SOP2__S_LSHL_B32
964 
966  {
967  } // ~Inst_SOP2__S_LSHL_B32
968 
969  // --- description from .arch file ---
970  // D.u = S0.u << S1.u[4:0];
971  // SCC = 1 if result is non-zero.
972  void
974  {
975  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
976  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
977  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
978  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
979 
980  src0.read();
981  src1.read();
982 
983  sdst = (src0.rawData() << bits(src1.rawData(), 4, 0));
984  scc = sdst.rawData() ? 1 : 0;
985 
986  sdst.write();
987  scc.write();
988  } // execute
989  // --- Inst_SOP2__S_LSHL_B64 class methods ---
990 
992  : Inst_SOP2(iFmt, "s_lshl_b64")
993  {
994  setFlag(ALU);
995  } // Inst_SOP2__S_LSHL_B64
996 
998  {
999  } // ~Inst_SOP2__S_LSHL_B64
1000 
1001  // --- description from .arch file ---
1002  // D.u64 = S0.u64 << S1.u[5:0];
1003  // SCC = 1 if result is non-zero.
1004  void
1006  {
1007  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
1008  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1009  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
1010  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1011 
1012  src0.read();
1013  src1.read();
1014 
1015  sdst = (src0.rawData() << bits(src1.rawData(), 5, 0));
1016  scc = sdst.rawData() ? 1 : 0;
1017 
1018  sdst.write();
1019  scc.write();
1020  } // execute
1021  // --- Inst_SOP2__S_LSHR_B32 class methods ---
1022 
1024  : Inst_SOP2(iFmt, "s_lshr_b32")
1025  {
1026  setFlag(ALU);
1027  } // Inst_SOP2__S_LSHR_B32
1028 
1030  {
1031  } // ~Inst_SOP2__S_LSHR_B32
1032 
1033  // --- description from .arch file ---
1034  // D.u = S0.u >> S1.u[4:0];
1035  // SCC = 1 if result is non-zero.
1036  // The vacated bits are set to zero.
1037  void
1039  {
1040  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
1041  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1042  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
1043  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1044 
1045  src0.read();
1046  src1.read();
1047 
1048  sdst = (src0.rawData() >> bits(src1.rawData(), 4, 0));
1049  scc = sdst.rawData() ? 1 : 0;
1050 
1051  sdst.write();
1052  scc.write();
1053  } // execute
1054  // --- Inst_SOP2__S_LSHR_B64 class methods ---
1055 
1057  : Inst_SOP2(iFmt, "s_lshr_b64")
1058  {
1059  setFlag(ALU);
1060  } // Inst_SOP2__S_LSHR_B64
1061 
1063  {
1064  } // ~Inst_SOP2__S_LSHR_B64
1065 
1066  // --- description from .arch file ---
1067  // D.u64 = S0.u64 >> S1.u[5:0];
1068  // SCC = 1 if result is non-zero.
1069  // The vacated bits are set to zero.
1070  void
1072  {
1073  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
1074  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1075  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
1076  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1077 
1078  src0.read();
1079  src1.read();
1080 
1081  sdst = (src0.rawData() >> bits(src1.rawData(), 5, 0));
1082  scc = sdst.rawData() ? 1 : 0;
1083 
1084  sdst.write();
1085  scc.write();
1086  } // execute
1087  // --- Inst_SOP2__S_ASHR_I32 class methods ---
1088 
1090  : Inst_SOP2(iFmt, "s_ashr_i32")
1091  {
1092  setFlag(ALU);
1093  } // Inst_SOP2__S_ASHR_I32
1094 
1096  {
1097  } // ~Inst_SOP2__S_ASHR_I32
1098 
1099  // --- description from .arch file ---
1100  // D.i = signext(S0.i) >> S1.u[4:0];
1101  // SCC = 1 if result is non-zero.
1102  // The vacated bits are set to the sign bit of the input value.
1103  void
1105  {
1106  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
1107  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1108  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1109  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1110 
1111  src0.read();
1112  src1.read();
1113 
1114  sdst = (src0.rawData() >> bits(src1.rawData(), 4, 0));
1115  scc = sdst.rawData() ? 1 : 0;
1116 
1117  sdst.write();
1118  scc.write();
1119  } // execute
1120  // --- Inst_SOP2__S_ASHR_I64 class methods ---
1121 
1123  : Inst_SOP2(iFmt, "s_ashr_i64")
1124  {
1125  setFlag(ALU);
1126  } // Inst_SOP2__S_ASHR_I64
1127 
1129  {
1130  } // ~Inst_SOP2__S_ASHR_I64
1131 
1132  // --- description from .arch file ---
1133  // D.i64 = signext(S0.i64) >> S1.u[5:0];
1134  // SCC = 1 if result is non-zero.
1135  // The vacated bits are set to the sign bit of the input value.
1136  void
1138  {
1139  ConstScalarOperandI64 src0(gpuDynInst, instData.SSRC0);
1140  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1141  ScalarOperandI64 sdst(gpuDynInst, instData.SDST);
1142  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1143 
1144  src0.read();
1145  src1.read();
1146 
1147  sdst = (src0.rawData() >> bits(src1.rawData(), 5, 0));
1148  scc = sdst.rawData() ? 1 : 0;
1149 
1150  sdst.write();
1151  scc.write();
1152  } // execute
1153  // --- Inst_SOP2__S_BFM_B32 class methods ---
1154 
1156  : Inst_SOP2(iFmt, "s_bfm_b32")
1157  {
1158  setFlag(ALU);
1159  } // Inst_SOP2__S_BFM_B32
1160 
1162  {
1163  } // ~Inst_SOP2__S_BFM_B32
1164 
1165  // --- description from .arch file ---
1166  // D.u = ((1 << S0.u[4:0]) - 1) << S1.u[4:0] (bitfield mask).
1167  void
1169  {
1170  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
1171  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1172  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
1173 
1174  src0.read();
1175  src1.read();
1176 
1177  sdst = ((1 << bits(src0.rawData(), 4, 0)) - 1)
1178  << bits(src1.rawData(), 4, 0);
1179 
1180  sdst.write();
1181  } // execute
1182  // --- Inst_SOP2__S_BFM_B64 class methods ---
1183 
1185  : Inst_SOP2(iFmt, "s_bfm_b64")
1186  {
1187  setFlag(ALU);
1188  } // Inst_SOP2__S_BFM_B64
1189 
1191  {
1192  } // ~Inst_SOP2__S_BFM_B64
1193 
1194  // --- description from .arch file ---
1195  // D.u64 = ((1ULL << S0.u[5:0]) - 1) << S1.u[5:0] (bitfield mask).
1196  void
1198  {
1199  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
1200  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1201  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
1202 
1203  src0.read();
1204  src1.read();
1205 
1206  sdst = ((1ULL << bits(src0.rawData(), 5, 0)) - 1)
1207  << bits(src1.rawData(), 5, 0);
1208 
1209  sdst.write();
1210  } // execute
1211  // --- Inst_SOP2__S_MUL_I32 class methods ---
1212 
1214  : Inst_SOP2(iFmt, "s_mul_i32")
1215  {
1216  setFlag(ALU);
1217  } // Inst_SOP2__S_MUL_I32
1218 
1220  {
1221  } // ~Inst_SOP2__S_MUL_I32
1222 
1223  // --- description from .arch file ---
1224  // D.i = S0.i * S1.i.
1225  void
1227  {
1228  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
1229  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
1230  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1231 
1232  src0.read();
1233  src1.read();
1234 
1235  sdst = src0.rawData() * src1.rawData();
1236 
1237  sdst.write();
1238  } // execute
1239  // --- Inst_SOP2__S_BFE_U32 class methods ---
1240 
1242  : Inst_SOP2(iFmt, "s_bfe_u32")
1243  {
1244  setFlag(ALU);
1245  } // Inst_SOP2__S_BFE_U32
1246 
1248  {
1249  } // ~Inst_SOP2__S_BFE_U32
1250 
1251  // --- description from .arch file ---
1252  // Bit field extract. S0 is Data, S1[4:0] is field offset, S1[22:16] is
1253  // field width.
1254  // D.u = (S0.u>>S1.u[4:0]) & ((1<<S1.u[22:16])-1);
1255  // SCC = 1 if result is non-zero.
1256  void
1258  {
1259  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
1260  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1261  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
1262  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1263 
1264  src0.read();
1265  src1.read();
1266 
1267  sdst = (src0.rawData() >> bits(src1.rawData(), 4, 0))
1268  & ((1 << bits(src1.rawData(), 22, 16)) - 1);
1269  scc = sdst.rawData() ? 1 : 0;
1270 
1271  sdst.write();
1272  scc.write();
1273  } // execute
1274  // --- Inst_SOP2__S_BFE_I32 class methods ---
1275 
1277  : Inst_SOP2(iFmt, "s_bfe_i32")
1278  {
1279  setFlag(ALU);
1280  } // Inst_SOP2__S_BFE_I32
1281 
1283  {
1284  } // ~Inst_SOP2__S_BFE_I32
1285 
1286  // --- description from .arch file ---
1287  // Bit field extract. S0 is Data, S1[4:0] is field offset, S1[22:16] is
1288  // field width.
1289  // D.i = (S0.i>>S1.u[4:0]) & ((1<<S1.u[22:16])-1);
1290  // Sign-extend the result;
1291  // SCC = 1 if result is non-zero.
1292  void
1294  {
1295  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
1296  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1297  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1298  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1299 
1300  src0.read();
1301  src1.read();
1302 
1303  sdst = (src0.rawData() >> bits(src1.rawData(), 4, 0))
1304  & ((1 << bits(src1.rawData(), 22, 16)) - 1);
1305  scc = sdst.rawData() ? 1 : 0;
1306 
1307  sdst.write();
1308  scc.write();
1309  } // execute
1310  // --- Inst_SOP2__S_BFE_U64 class methods ---
1311 
1313  : Inst_SOP2(iFmt, "s_bfe_u64")
1314  {
1315  setFlag(ALU);
1316  } // Inst_SOP2__S_BFE_U64
1317 
1319  {
1320  } // ~Inst_SOP2__S_BFE_U64
1321 
1322  // --- description from .arch file ---
1323  // Bit field extract. S0 is Data, S1[5:0] is field offset, S1[22:16] is
1324  // field width.
1325  // D.u64 = (S0.u64>>S1.u[5:0]) & ((1<<S1.u[22:16])-1);
1326  // SCC = 1 if result is non-zero.
1327  void
1329  {
1330  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
1331  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1332  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
1333  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1334 
1335  src0.read();
1336  src1.read();
1337 
1338  sdst = (src0.rawData() >> bits(src1.rawData(), 5, 0))
1339  & ((1 << bits(src1.rawData(), 22, 16)) - 1);
1340  scc = sdst.rawData() ? 1 : 0;
1341 
1342  sdst.write();
1343  scc.write();
1344  } // execute
1345  // --- Inst_SOP2__S_BFE_I64 class methods ---
1346 
1348  : Inst_SOP2(iFmt, "s_bfe_i64")
1349  {
1350  setFlag(ALU);
1351  } // Inst_SOP2__S_BFE_I64
1352 
1354  {
1355  } // ~Inst_SOP2__S_BFE_I64
1356 
1357  // --- description from .arch file ---
1358  // Bit field extract. S0 is Data, S1[5:0] is field offset, S1[22:16] is
1359  // field width.
1360  // D.i64 = (S0.i64>>S1.u[5:0]) & ((1<<S1.u[22:16])-1);
1361  // Sign-extend result;
1362  // SCC = 1 if result is non-zero.
1363  void
1365  {
1366  ConstScalarOperandI64 src0(gpuDynInst, instData.SSRC0);
1367  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1368  ScalarOperandI64 sdst(gpuDynInst, instData.SDST);
1369  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1370 
1371  src0.read();
1372  src1.read();
1373 
1374  sdst = (src0.rawData() >> bits(src1.rawData(), 5, 0))
1375  & ((1 << bits(src1.rawData(), 22, 16)) - 1);
1376  scc = sdst.rawData() ? 1 : 0;
1377 
1378  sdst.write();
1379  scc.write();
1380  } // execute
1381  // --- Inst_SOP2__S_CBRANCH_G_FORK class methods ---
1382 
1384  : Inst_SOP2(iFmt, "s_cbranch_g_fork")
1385  {
1386  setFlag(Branch);
1387  } // Inst_SOP2__S_CBRANCH_G_FORK
1388 
1390  {
1391  } // ~Inst_SOP2__S_CBRANCH_G_FORK
1392 
1393  // --- description from .arch file ---
1394  // mask_pass = S0.u64 & EXEC;
1395  // mask_fail = ~S0.u64 & EXEC;
1396  // if(mask_pass == EXEC)
1397  // PC = S1.u64;
1398  // elsif(mask_fail == EXEC)
1399  // PC += 4;
1400  // elsif(bitcount(mask_fail) < bitcount(mask_pass))
1401  // EXEC = mask_fail;
1402  // SGPR[CSP*4] = { S1.u64, mask_pass };
1403  // CSP++;
1404  // PC += 4;
1405  // else
1406  // EXEC = mask_pass;
1407  // SGPR[CSP*4] = { PC + 4, mask_fail };
1408  // CSP++;
1409  // PC = S1.u64;
1410  // end.
1411  // Conditional branch using branch-stack.
1412  // S0 = compare mask(vcc or any sgpr) and
1413  // S1 = 64-bit byte address of target instruction.
1414  // See also S_CBRANCH_JOIN.
1415  void
1417  {
1419  } // execute
1420  // --- Inst_SOP2__S_ABSDIFF_I32 class methods ---
1421 
1423  : Inst_SOP2(iFmt, "s_absdiff_i32")
1424  {
1425  setFlag(ALU);
1426  } // Inst_SOP2__S_ABSDIFF_I32
1427 
1429  {
1430  } // ~Inst_SOP2__S_ABSDIFF_I32
1431 
1432  // --- description from .arch file ---
1433  // D.i = S0.i - S1.i;
1434  // if(D.i < 0) then D.i = -D.i;
1435  // SCC = 1 if result is non-zero.
1436  // Compute the absolute value of difference between two values.
1437  void
1439  {
1440  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
1441  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
1442  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1443  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1444 
1445  sdst = std::abs(src0.rawData() - src1.rawData());
1446  scc = sdst.rawData() ? 1 : 0;
1447 
1448  sdst.write();
1449  scc.write();
1450  } // execute
1451  // --- Inst_SOP2__S_RFE_RESTORE_B64 class methods ---
1452 
1454  InFmt_SOP2 *iFmt)
1455  : Inst_SOP2(iFmt, "s_rfe_restore_b64")
1456  {
1457  } // Inst_SOP2__S_RFE_RESTORE_B64
1458 
1460  {
1461  } // ~Inst_SOP2__S_RFE_RESTORE_B64
1462 
1463  // --- description from .arch file ---
1464  // PRIV = 0;
1465  // PC = S0.u64;
1466  // INST_ATC = S1.u32[0].
1467  // Return from exception handler and continue, possibly changing the
1468  // --- instruction ATC mode.
1469  // This instruction may only be used within a trap handler.
1470  // Use this instruction when the main program may be in a different memory
1471  // --- space than the trap handler.
1472  void
1474  {
1476  } // execute
1477  // --- Inst_SOP2__S_MUL_HI_U32 class methods ---
1478 
1480  : Inst_SOP2(iFmt, "s_mul_hi_u32")
1481  {
1482  setFlag(ALU);
1483  } // Inst_SOP2__S_MUL_HI_U32
1484 
1486  {
1487  } // ~Inst_SOP2__S_MUL_HI_U32
1488 
1489  // --- description from .arch file ---
1490  // D.u = (S0.u * S1.u) >> 32;
1491  void
1493  {
1494  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
1495  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
1496  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
1497 
1498  src0.read();
1499  src1.read();
1500 
1501  VecElemU64 tmp_dst =
1502  ((VecElemU64)src0.rawData() * (VecElemU64)src1.rawData());
1503  sdst = (tmp_dst >> 32);
1504 
1505  sdst.write();
1506  } // execute
1507  // --- Inst_SOP2__S_MUL_HI_I32 class methods ---
1508 
1510  : Inst_SOP2(iFmt, "s_mul_hi_i32")
1511  {
1512  setFlag(ALU);
1513  } // Inst_SOP2__S_MUL_HI_I32
1514 
1516  {
1517  } // ~Inst_SOP2__S_MUL_HI_I32
1518 
1519  // --- description from .arch file ---
1520  // D.u = (S0.u * S1.u) >> 32;
1521  void
1523  {
1524  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
1525  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
1526  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1527 
1528  src0.read();
1529  src1.read();
1530 
1531  VecElemI64 tmp_src0 =
1532  sext<std::numeric_limits<VecElemI64>::digits>(src0.rawData());
1533  VecElemI64 tmp_src1 =
1534  sext<std::numeric_limits<VecElemI64>::digits>(src1.rawData());
1535  sdst = (VecElemI32)((tmp_src0 * tmp_src1) >> 32);
1536 
1537  sdst.write();
1538  } // execute
1539  // --- Inst_SOPK__S_MOVK_I32 class methods ---
1540 
1542  : Inst_SOPK(iFmt, "s_movk_i32")
1543  {
1544  setFlag(ALU);
1545  } // Inst_SOPK__S_MOVK_I32
1546 
1548  {
1549  } // ~Inst_SOPK__S_MOVK_I32
1550 
1551  // --- description from .arch file ---
1552  // D.i = signext(SIMM16) (sign extension).
1553  void
1555  {
1556  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1557  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1558 
1559  sdst = simm16;
1560 
1561  sdst.write();
1562  } // execute
1563  // --- Inst_SOPK__S_CMOVK_I32 class methods ---
1564 
1566  : Inst_SOPK(iFmt, "s_cmovk_i32")
1567  {
1568  setFlag(ALU);
1569  } // Inst_SOPK__S_CMOVK_I32
1570 
1572  {
1573  } // ~Inst_SOPK__S_CMOVK_I32
1574 
1575  // --- description from .arch file ---
1576  // if(SCC) then D.i = signext(SIMM16);
1577  // else NOP.
1578  // Conditional move with sign extension.
1579  void
1581  {
1582  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1583  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1584  ConstScalarOperandU32 scc(gpuDynInst, REG_SCC);
1585 
1586  scc.read();
1587 
1588  if (scc.rawData()) {
1589  sdst = simm16;
1590  sdst.write();
1591  }
1592  } // execute
1593  // --- Inst_SOPK__S_CMPK_EQ_I32 class methods ---
1594 
1596  : Inst_SOPK(iFmt, "s_cmpk_eq_i32")
1597  {
1598  setFlag(ALU);
1599  } // Inst_SOPK__S_CMPK_EQ_I32
1600 
1602  {
1603  } // ~Inst_SOPK__S_CMPK_EQ_I32
1604 
1605  // --- description from .arch file ---
1606  // SCC = (S0.i == signext(SIMM16)).
1607  void
1609  {
1610  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1611  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1612  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1613 
1614  src.read();
1615 
1616  scc = (src.rawData() == simm16) ? 1 : 0;
1617 
1618  scc.write();
1619  } // execute
1620  // --- Inst_SOPK__S_CMPK_LG_I32 class methods ---
1621 
1623  : Inst_SOPK(iFmt, "s_cmpk_lg_i32")
1624  {
1625  setFlag(ALU);
1626  } // Inst_SOPK__S_CMPK_LG_I32
1627 
1629  {
1630  } // ~Inst_SOPK__S_CMPK_LG_I32
1631 
1632  // --- description from .arch file ---
1633  // SCC = (S0.i != signext(SIMM16)).
1634  void
1636  {
1637  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1638  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1639  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1640 
1641  src.read();
1642 
1643  scc = (src.rawData() != simm16) ? 1 : 0;
1644 
1645  scc.write();
1646  } // execute
1647  // --- Inst_SOPK__S_CMPK_GT_I32 class methods ---
1648 
1650  : Inst_SOPK(iFmt, "s_cmpk_gt_i32")
1651  {
1652  setFlag(ALU);
1653  } // Inst_SOPK__S_CMPK_GT_I32
1654 
1656  {
1657  } // ~Inst_SOPK__S_CMPK_GT_I32
1658 
1659  // --- description from .arch file ---
1660  // SCC = (S0.i > signext(SIMM16)).
1661  void
1663  {
1664  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1665  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1666  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1667 
1668  src.read();
1669 
1670  scc = (src.rawData() > simm16) ? 1 : 0;
1671 
1672  scc.write();
1673  } // execute
1674  // --- Inst_SOPK__S_CMPK_GE_I32 class methods ---
1675 
1677  : Inst_SOPK(iFmt, "s_cmpk_ge_i32")
1678  {
1679  setFlag(ALU);
1680  } // Inst_SOPK__S_CMPK_GE_I32
1681 
1683  {
1684  } // ~Inst_SOPK__S_CMPK_GE_I32
1685 
1686  // --- description from .arch file ---
1687  // SCC = (S0.i >= signext(SIMM16)).
1688  void
1690  {
1691  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1692  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1693  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1694 
1695  src.read();
1696 
1697  scc = (src.rawData() >= simm16) ? 1 : 0;
1698 
1699  scc.write();
1700  } // execute
1701  // --- Inst_SOPK__S_CMPK_LT_I32 class methods ---
1702 
1704  : Inst_SOPK(iFmt, "s_cmpk_lt_i32")
1705  {
1706  setFlag(ALU);
1707  } // Inst_SOPK__S_CMPK_LT_I32
1708 
1710  {
1711  } // ~Inst_SOPK__S_CMPK_LT_I32
1712 
1713  // --- description from .arch file ---
1714  // SCC = (S0.i < signext(SIMM16)).
1715  void
1717  {
1718  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1719  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1720  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1721 
1722  src.read();
1723 
1724  scc = (src.rawData() < simm16) ? 1 : 0;
1725 
1726  scc.write();
1727  } // execute
1728  // --- Inst_SOPK__S_CMPK_LE_I32 class methods ---
1729 
1731  : Inst_SOPK(iFmt, "s_cmpk_le_i32")
1732  {
1733  setFlag(ALU);
1734  } // Inst_SOPK__S_CMPK_LE_I32
1735 
1737  {
1738  } // ~Inst_SOPK__S_CMPK_LE_I32
1739 
1740  // --- description from .arch file ---
1741  // SCC = (S0.i <= signext(SIMM16)).
1742  void
1744  {
1745  ScalarRegI32 simm16 = (ScalarRegI32)sext<16>(instData.SIMM16);
1746  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1747  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1748 
1749  src.read();
1750 
1751  scc = (src.rawData() <= simm16) ? 1 : 0;
1752 
1753  scc.write();
1754  } // execute
1755  // --- Inst_SOPK__S_CMPK_EQ_U32 class methods ---
1756 
1758  : Inst_SOPK(iFmt, "s_cmpk_eq_u32")
1759  {
1760  setFlag(ALU);
1761  } // Inst_SOPK__S_CMPK_EQ_U32
1762 
1764  {
1765  } // ~Inst_SOPK__S_CMPK_EQ_U32
1766 
1767  // --- description from .arch file ---
1768  // SCC = (S0.u == SIMM16).
1769  void
1771  {
1773  ConstScalarOperandU32 src(gpuDynInst, instData.SDST);
1774  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1775 
1776  src.read();
1777 
1778  scc = (src.rawData() == simm16) ? 1 : 0;
1779 
1780  scc.write();
1781  } // execute
1782  // --- Inst_SOPK__S_CMPK_LG_U32 class methods ---
1783 
1785  : Inst_SOPK(iFmt, "s_cmpk_lg_u32")
1786  {
1787  setFlag(ALU);
1788  } // Inst_SOPK__S_CMPK_LG_U32
1789 
1791  {
1792  } // ~Inst_SOPK__S_CMPK_LG_U32
1793 
1794  // --- description from .arch file ---
1795  // SCC = (S0.u != SIMM16).
1796  void
1798  {
1800  ConstScalarOperandU32 src(gpuDynInst, instData.SDST);
1801  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1802 
1803  src.read();
1804 
1805  scc = (src.rawData() != simm16) ? 1 : 0;
1806 
1807  scc.write();
1808  } // execute
1809  // --- Inst_SOPK__S_CMPK_GT_U32 class methods ---
1810 
1812  : Inst_SOPK(iFmt, "s_cmpk_gt_u32")
1813  {
1814  setFlag(ALU);
1815  } // Inst_SOPK__S_CMPK_GT_U32
1816 
1818  {
1819  } // ~Inst_SOPK__S_CMPK_GT_U32
1820 
1821  // --- description from .arch file ---
1822  // SCC = (S0.u > SIMM16).
1823  void
1825  {
1827  ConstScalarOperandU32 src(gpuDynInst, instData.SDST);
1828  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1829 
1830  src.read();
1831 
1832  scc = (src.rawData() > simm16) ? 1 : 0;
1833 
1834  scc.write();
1835  } // execute
1836  // --- Inst_SOPK__S_CMPK_GE_U32 class methods ---
1837 
1839  : Inst_SOPK(iFmt, "s_cmpk_ge_u32")
1840  {
1841  setFlag(ALU);
1842  } // Inst_SOPK__S_CMPK_GE_U32
1843 
1845  {
1846  } // ~Inst_SOPK__S_CMPK_GE_U32
1847 
1848  // --- description from .arch file ---
1849  // SCC = (S0.u >= SIMM16).
1850  void
1852  {
1854  ConstScalarOperandU32 src(gpuDynInst, instData.SDST);
1855  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1856 
1857  src.read();
1858 
1859  scc = (src.rawData() >= simm16) ? 1 : 0;
1860 
1861  scc.write();
1862  } // execute
1863  // --- Inst_SOPK__S_CMPK_LT_U32 class methods ---
1864 
1866  : Inst_SOPK(iFmt, "s_cmpk_lt_u32")
1867  {
1868  setFlag(ALU);
1869  } // Inst_SOPK__S_CMPK_LT_U32
1870 
1872  {
1873  } // ~Inst_SOPK__S_CMPK_LT_U32
1874 
1875  // --- description from .arch file ---
1876  // SCC = (S0.u < SIMM16).
1877  void
1879  {
1881  ConstScalarOperandU32 src(gpuDynInst, instData.SDST);
1882  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1883 
1884  src.read();
1885 
1886  scc = (src.rawData() < simm16) ? 1 : 0;
1887 
1888  scc.write();
1889  } // execute
1890  // --- Inst_SOPK__S_CMPK_LE_U32 class methods ---
1891 
1893  : Inst_SOPK(iFmt, "s_cmpk_le_u32")
1894  {
1895  setFlag(ALU);
1896  } // Inst_SOPK__S_CMPK_LE_U32
1897 
1899  {
1900  } // ~Inst_SOPK__S_CMPK_LE_U32
1901 
1902  // --- description from .arch file ---
1903  // SCC = (S0.u <= SIMM16).
1904  void
1906  {
1908  ConstScalarOperandU32 src(gpuDynInst, instData.SDST);
1909  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1910 
1911  src.read();
1912 
1913  scc = (src.rawData() <= simm16) ? 1 : 0;
1914 
1915  scc.write();
1916  } // execute
1917  // --- Inst_SOPK__S_ADDK_I32 class methods ---
1918 
1920  : Inst_SOPK(iFmt, "s_addk_i32")
1921  {
1922  setFlag(ALU);
1923  } // Inst_SOPK__S_ADDK_I32
1924 
1926  {
1927  } // ~Inst_SOPK__S_ADDK_I32
1928 
1929  // --- description from .arch file ---
1930  // D.i = D.i + signext(SIMM16);
1931  // SCC = overflow.
1932  void
1934  {
1935  ScalarRegI16 simm16 = instData.SIMM16;
1936  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1937  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1938  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
1939 
1940  src.read();
1941 
1942  sdst = src.rawData() + (ScalarRegI32)sext<16>(simm16);
1943  scc = (bits(src.rawData(), 31) == bits(simm16, 15)
1944  && bits(src.rawData(), 31) != bits(sdst.rawData(), 31)) ? 1 : 0;
1945 
1946  sdst.write();
1947  scc.write();
1948  } // execute
1949  // --- Inst_SOPK__S_MULK_I32 class methods ---
1950 
1952  : Inst_SOPK(iFmt, "s_mulk_i32")
1953  {
1954  setFlag(ALU);
1955  } // Inst_SOPK__S_MULK_I32
1956 
1958  {
1959  } // ~Inst_SOPK__S_MULK_I32
1960 
1961  // --- description from .arch file ---
1962  // D.i = D.i * signext(SIMM16).
1963  void
1965  {
1966  ScalarRegI16 simm16 = instData.SIMM16;
1967  ConstScalarOperandI32 src(gpuDynInst, instData.SDST);
1968  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
1969 
1970  src.read();
1971 
1972  sdst = src.rawData() * (ScalarRegI32)sext<16>(simm16);
1973 
1974  sdst.write();
1975  } // execute
1976  // --- Inst_SOPK__S_CBRANCH_I_FORK class methods ---
1977 
1979  : Inst_SOPK(iFmt, "s_cbranch_i_fork")
1980  {
1981  setFlag(Branch);
1982  } // Inst_SOPK__S_CBRANCH_I_FORK
1983 
1985  {
1986  } // ~Inst_SOPK__S_CBRANCH_I_FORK
1987 
1988  // --- description from .arch file ---
1989  // mask_pass = S0.u64 & EXEC;
1990  // mask_fail = ~S0.u64 & EXEC;
1991  // target_addr = PC + signext(SIMM16 * 4) + 4;
1992  // if(mask_pass == EXEC)
1993  // PC = target_addr;
1994  // elsif(mask_fail == EXEC)
1995  // PC += 4;
1996  // elsif(bitcount(mask_fail) < bitcount(mask_pass))
1997  // EXEC = mask_fail;
1998  // SGPR[CSP*4] = { target_addr, mask_pass };
1999  // CSP++;
2000  // PC += 4;
2001  // else
2002  // EXEC = mask_pass;
2003  // SGPR[CSP*4] = { PC + 4, mask_fail };
2004  // CSP++;
2005  // PC = target_addr;
2006  // end.
2007  // Conditional branch using branch-stack.
2008  // S0 = compare mask(vcc or any sgpr), and
2009  // SIMM16 = signed DWORD branch offset relative to next instruction.
2010  // See also S_CBRANCH_JOIN.
2011  void
2013  {
2015  } // execute
2016  // --- Inst_SOPK__S_GETREG_B32 class methods ---
2017 
2019  : Inst_SOPK(iFmt, "s_getreg_b32")
2020  {
2021  setFlag(ALU);
2022  } // Inst_SOPK__S_GETREG_B32
2023 
2025  {
2026  } // ~Inst_SOPK__S_GETREG_B32
2027 
2028  // --- description from .arch file ---
2029  // D.u = hardware-reg. Read some or all of a hardware register into the
2030  // LSBs of D.
2031  // SIMM16 = {size[4:0], offset[4:0], hwRegId[5:0]}; offset is 0..31, size
2032  // is 1..32.
2033  void
2035  {
2036  ScalarRegI16 simm16 = instData.SIMM16;
2037  ScalarRegU32 hwregId = simm16 & 0x3f;
2038  ScalarRegU32 offset = (simm16 >> 6) & 31;
2039  ScalarRegU32 size = ((simm16 >> 11) & 31) + 1;
2040 
2041  ScalarRegU32 hwreg =
2042  gpuDynInst->computeUnit()->shader->getHwReg(hwregId);
2043  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2044  sdst.read();
2045 
2046  // Store value from hardware to part of the SDST.
2047  ScalarRegU32 mask = (((1U << size) - 1U) << offset);
2048  sdst = (hwreg & mask) >> offset;
2049  sdst.write();
2050  } // execute
2051  // --- Inst_SOPK__S_SETREG_B32 class methods ---
2052 
2054  : Inst_SOPK(iFmt, "s_setreg_b32")
2055  {
2056  setFlag(ALU);
2057  } // Inst_SOPK__S_SETREG_B32
2058 
2060  {
2061  } // ~Inst_SOPK__S_SETREG_B32
2062 
2063  // --- description from .arch file ---
2064  // hardware-reg = S0.u. Write some or all of the LSBs of D into a hardware
2065  // register.
2066  // SIMM16 = {size[4:0], offset[4:0], hwRegId[5:0]}; offset is 0..31, size
2067  // is 1..32.
2068  void
2070  {
2071  ScalarRegI16 simm16 = instData.SIMM16;
2072  ScalarRegU32 hwregId = simm16 & 0x3f;
2073  ScalarRegU32 offset = (simm16 >> 6) & 31;
2074  ScalarRegU32 size = ((simm16 >> 11) & 31) + 1;
2075 
2076  ScalarRegU32 hwreg =
2077  gpuDynInst->computeUnit()->shader->getHwReg(hwregId);
2078  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2079  sdst.read();
2080 
2081  // Store value from SDST to part of the hardware register.
2082  ScalarRegU32 mask = (((1U << size) - 1U) << offset);
2083  hwreg = ((hwreg & ~mask) | ((sdst.rawData() << offset) & mask));
2084  gpuDynInst->computeUnit()->shader->setHwReg(hwregId, hwreg);
2085 
2086  // set MODE register to control the behavior of single precision
2087  // floating-point numbers: denormal mode or round mode
2088  if (hwregId==1 && size==2
2089  && (offset==4 || offset==0)) {
2090  warn_once("Be cautious that s_setreg_b32 has no real effect "
2091  "on FP modes: %s\n", gpuDynInst->disassemble());
2092  return;
2093  }
2094 
2095  // panic if not changing MODE of floating-point numbers
2097  } // execute
2098  // --- Inst_SOPK__S_SETREG_IMM32_B32 class methods ---
2099 
2101  InFmt_SOPK *iFmt)
2102  : Inst_SOPK(iFmt, "s_setreg_imm32_b32")
2103  {
2104  setFlag(ALU);
2105  } // Inst_SOPK__S_SETREG_IMM32_B32
2106 
2108  {
2109  } // ~Inst_SOPK__S_SETREG_IMM32_B32
2110 
2111  // --- description from .arch file ---
2112  // Write some or all of the LSBs of IMM32 into a hardware register; this
2113  // --- instruction requires a 32-bit literal constant.
2114  // SIMM16 = {size[4:0], offset[4:0], hwRegId[5:0]}; offset is 0..31, size
2115  // is 1..32.
2116  void
2118  {
2119  ScalarRegI16 simm16 = instData.SIMM16;
2120  ScalarRegU32 hwregId = simm16 & 0x3f;
2121  ScalarRegU32 offset = (simm16 >> 6) & 31;
2122  ScalarRegU32 size = ((simm16 >> 11) & 31) + 1;
2123 
2124  ScalarRegU32 hwreg =
2125  gpuDynInst->computeUnit()->shader->getHwReg(hwregId);
2126  ScalarRegI32 simm32 = extData.imm_u32;
2127 
2128  // Store value from SIMM32 to part of the hardware register.
2129  ScalarRegU32 mask = (((1U << size) - 1U) << offset);
2130  hwreg = ((hwreg & ~mask) | ((simm32 << offset) & mask));
2131  gpuDynInst->computeUnit()->shader->setHwReg(hwregId, hwreg);
2132 
2133  // set MODE register to control the behavior of single precision
2134  // floating-point numbers: denormal mode or round mode
2135  if (hwregId==HW_REG_MODE && size==2
2136  && (offset==4 || offset==0)) {
2137  warn_once("Be cautious that s_setreg_imm32_b32 has no real effect "
2138  "on FP modes: %s\n", gpuDynInst->disassemble());
2139  return;
2140  }
2141 
2142  // panic if not changing modes of single-precision FPs
2144  } // execute
2145  // --- Inst_SOP1__S_MOV_B32 class methods ---
2146 
2148  : Inst_SOP1(iFmt, "s_mov_b32")
2149  {
2150  setFlag(ALU);
2151  } // Inst_SOP1__S_MOV_B32
2152 
2154  {
2155  } // ~Inst_SOP1__S_MOV_B32
2156 
2157  // --- description from .arch file ---
2158  // D.u = S0.u.
2159  void
2161  {
2162  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2163  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2164 
2165  src.read();
2166 
2167  sdst = src.rawData();
2168 
2169  sdst.write();
2170  } // execute
2171  // --- Inst_SOP1__S_MOV_B64 class methods ---
2172 
2174  : Inst_SOP1(iFmt, "s_mov_b64")
2175  {
2176  setFlag(ALU);
2177  } // Inst_SOP1__S_MOV_B64
2178 
2180  {
2181  } // ~Inst_SOP1__S_MOV_B64
2182 
2183  // --- description from .arch file ---
2184  // D.u64 = S0.u64.
2185  void
2187  {
2188  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2189  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2190 
2191  src.read();
2192 
2193  sdst = src.rawData();
2194 
2195  sdst.write();
2196  } // execute
2197  // --- Inst_SOP1__S_CMOV_B32 class methods ---
2198 
2200  : Inst_SOP1(iFmt, "s_cmov_b32")
2201  {
2202  setFlag(ALU);
2203  } // Inst_SOP1__S_CMOV_B32
2204 
2206  {
2207  } // ~Inst_SOP1__S_CMOV_B32
2208 
2209  // --- description from .arch file ---
2210  // (SCC) then D.u = S0.u;
2211  // else NOP.
2212  // Conditional move.
2213  void
2215  {
2216  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2217  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2218  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2219 
2220  src.read();
2221  scc.read();
2222 
2223  if (scc.rawData()) {
2224  sdst = src.rawData();
2225  sdst.write();
2226  }
2227  } // execute
2228  // --- Inst_SOP1__S_CMOV_B64 class methods ---
2229 
2231  : Inst_SOP1(iFmt, "s_cmov_b64")
2232  {
2233  setFlag(ALU);
2234  } // Inst_SOP1__S_CMOV_B64
2235 
2237  {
2238  } // ~Inst_SOP1__S_CMOV_B64
2239 
2240  // --- description from .arch file ---
2241  // if(SCC) then D.u64 = S0.u64;
2242  // else NOP.
2243  // Conditional move.
2244  void
2246  {
2247  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2248  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2249  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2250 
2251  src.read();
2252  scc.read();
2253 
2254  if (scc.rawData()) {
2255  sdst = src.rawData();
2256  sdst.write();
2257  }
2258  } // execute
2259  // --- Inst_SOP1__S_NOT_B32 class methods ---
2260 
2262  : Inst_SOP1(iFmt, "s_not_b32")
2263  {
2264  setFlag(ALU);
2265  } // Inst_SOP1__S_NOT_B32
2266 
2268  {
2269  } // ~Inst_SOP1__S_NOT_B32
2270 
2271  // --- description from .arch file ---
2272  // D.u = ~S0.u;
2273  // SCC = 1 if result is non-zero.
2274  // Bitwise negation.
2275  void
2277  {
2278  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2279  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2280  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2281 
2282  src.read();
2283 
2284  sdst = ~src.rawData();
2285 
2286  scc = sdst.rawData() ? 1 : 0;
2287 
2288  sdst.write();
2289  scc.write();
2290  } // execute
2291  // --- Inst_SOP1__S_NOT_B64 class methods ---
2292 
2294  : Inst_SOP1(iFmt, "s_not_b64")
2295  {
2296  setFlag(ALU);
2297  } // Inst_SOP1__S_NOT_B64
2298 
2300  {
2301  } // ~Inst_SOP1__S_NOT_B64
2302 
2303  // --- description from .arch file ---
2304  // D.u64 = ~S0.u64;
2305  // SCC = 1 if result is non-zero.
2306  // Bitwise negation.
2307  void
2309  {
2310  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2311  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2312  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2313 
2314  src.read();
2315 
2316  sdst = ~src.rawData();
2317  scc = sdst.rawData() ? 1 : 0;
2318 
2319  sdst.write();
2320  scc.write();
2321  } // execute
2322  // --- Inst_SOP1__S_WQM_B32 class methods ---
2323 
2325  : Inst_SOP1(iFmt, "s_wqm_b32")
2326  {
2327  setFlag(ALU);
2328  } // Inst_SOP1__S_WQM_B32
2329 
2331  {
2332  } // ~Inst_SOP1__S_WQM_B32
2333 
2334  // --- description from .arch file ---
2335  // D[i] = (S0[(i & ~3):(i | 3)] != 0);
2336  // Computes whole quad mode for an active/valid mask.
2337  // SCC = 1 if result is non-zero.
2338  void
2340  {
2341  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2342  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2343  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2344 
2345  src.read();
2346 
2347  sdst = wholeQuadMode(src.rawData());
2348  scc = sdst.rawData() ? 1 : 0;
2349 
2350  sdst.write();
2351  scc.write();
2352  } // execute
2353  // --- Inst_SOP1__S_WQM_B64 class methods ---
2354 
2356  : Inst_SOP1(iFmt, "s_wqm_b64")
2357  {
2358  setFlag(ALU);
2359  } // Inst_SOP1__S_WQM_B64
2360 
2362  {
2363  } // ~Inst_SOP1__S_WQM_B64
2364 
2365  // --- description from .arch file ---
2366  // D[i] = (S0[(i & ~3):(i | 3)] != 0);
2367  // Computes whole quad mode for an active/valid mask.
2368  // SCC = 1 if result is non-zero.
2369  void
2371  {
2372  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2373  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2374  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2375 
2376  src.read();
2377 
2378  sdst = wholeQuadMode(src.rawData());
2379  scc = sdst.rawData() ? 1 : 0;
2380 
2381  sdst.write();
2382  scc.write();
2383  } // execute
2384  // --- Inst_SOP1__S_BREV_B32 class methods ---
2385 
2387  : Inst_SOP1(iFmt, "s_brev_b32")
2388  {
2389  setFlag(ALU);
2390  } // Inst_SOP1__S_BREV_B32
2391 
2393  {
2394  } // ~Inst_SOP1__S_BREV_B32
2395 
2396  // --- description from .arch file ---
2397  // D.u[31:0] = S0.u[0:31] (reverse bits).
2398  void
2400  {
2401  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2402  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2403 
2404  src.read();
2405 
2406  sdst = reverseBits(src.rawData());
2407 
2408  sdst.write();
2409  } // execute
2410  // --- Inst_SOP1__S_BREV_B64 class methods ---
2411 
2413  : Inst_SOP1(iFmt, "s_brev_b64")
2414  {
2415  setFlag(ALU);
2416  } // Inst_SOP1__S_BREV_B64
2417 
2419  {
2420  } // ~Inst_SOP1__S_BREV_B64
2421 
2422  // --- description from .arch file ---
2423  // D.u64[63:0] = S0.u64[0:63] (reverse bits).
2424  void
2426  {
2427  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2428  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2429 
2430  src.read();
2431 
2432  sdst = reverseBits(src.rawData());
2433 
2434  sdst.write();
2435  } // execute
2436  // --- Inst_SOP1__S_BCNT0_I32_B32 class methods ---
2437 
2439  : Inst_SOP1(iFmt, "s_bcnt0_i32_b32")
2440  {
2441  setFlag(ALU);
2442  } // Inst_SOP1__S_BCNT0_I32_B32
2443 
2445  {
2446  } // ~Inst_SOP1__S_BCNT0_I32_B32
2447 
2448  // --- description from .arch file ---
2449  // D.i = CountZeroBits(S0.u);
2450  // SCC = 1 if result is non-zero.
2451  void
2453  {
2454  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2455  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2456  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2457 
2458  src.read();
2459 
2460  sdst = countZeroBits(src.rawData());
2461  scc = sdst.rawData() ? 1 : 0;
2462 
2463  sdst.write();
2464  scc.write();
2465  } // execute
2466  // --- Inst_SOP1__S_BCNT0_I32_B64 class methods ---
2467 
2469  : Inst_SOP1(iFmt, "s_bcnt0_i32_b64")
2470  {
2471  setFlag(ALU);
2472  } // Inst_SOP1__S_BCNT0_I32_B64
2473 
2475  {
2476  } // ~Inst_SOP1__S_BCNT0_I32_B64
2477 
2478  // --- description from .arch file ---
2479  // D.i = CountZeroBits(S0.u64);
2480  // SCC = 1 if result is non-zero.
2481  void
2483  {
2484  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2485  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2486  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2487 
2488  src.read();
2489 
2490  sdst = countZeroBits(src.rawData());
2491  scc = sdst.rawData() ? 1 : 0;
2492 
2493  sdst.write();
2494  scc.write();
2495  } // execute
2496  // --- Inst_SOP1__S_BCNT1_I32_B32 class methods ---
2497 
2499  : Inst_SOP1(iFmt, "s_bcnt1_i32_b32")
2500  {
2501  setFlag(ALU);
2502  } // Inst_SOP1__S_BCNT1_I32_B32
2503 
2505  {
2506  } // ~Inst_SOP1__S_BCNT1_I32_B32
2507 
2508  // --- description from .arch file ---
2509  // D.i = CountOneBits(S0.u);
2510  // SCC = 1 if result is non-zero.
2511  void
2513  {
2514  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2515  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2516  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2517 
2518  src.read();
2519 
2520  sdst = popCount(src.rawData());
2521  scc = sdst.rawData() ? 1 : 0;
2522 
2523  sdst.write();
2524  scc.write();
2525  } // execute
2526  // --- Inst_SOP1__S_BCNT1_I32_B64 class methods ---
2527 
2529  : Inst_SOP1(iFmt, "s_bcnt1_i32_b64")
2530  {
2531  setFlag(ALU);
2532  } // Inst_SOP1__S_BCNT1_I32_B64
2533 
2535  {
2536  } // ~Inst_SOP1__S_BCNT1_I32_B64
2537 
2538  // --- description from .arch file ---
2539  // D.i = CountOneBits(S0.u64);
2540  // SCC = 1 if result is non-zero.
2541  void
2543  {
2544  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2545  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2546  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
2547 
2548  src.read();
2549 
2550  sdst = popCount(src.rawData());
2551  scc = sdst.rawData() ? 1 : 0;
2552 
2553  sdst.write();
2554  scc.write();
2555  } // execute
2556  // --- Inst_SOP1__S_FF0_I32_B32 class methods ---
2557 
2559  : Inst_SOP1(iFmt, "s_ff0_i32_b32")
2560  {
2561  setFlag(ALU);
2562  } // Inst_SOP1__S_FF0_I32_B32
2563 
2565  {
2566  } // ~Inst_SOP1__S_FF0_I32_B32
2567 
2568  // --- description from .arch file ---
2569  // D.i = FindFirstZero(S0.u);
2570  // If no zeros are found, return -1.
2571  // Returns the bit position of the first zero from the LSB.
2572  void
2574  {
2575  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2576  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2577 
2578  src.read();
2579 
2580  sdst = findFirstZero(src.rawData());
2581 
2582  sdst.write();
2583  } // execute
2584  // --- Inst_SOP1__S_FF0_I32_B64 class methods ---
2585 
2587  : Inst_SOP1(iFmt, "s_ff0_i32_b64")
2588  {
2589  setFlag(ALU);
2590  } // Inst_SOP1__S_FF0_I32_B64
2591 
2593  {
2594  } // ~Inst_SOP1__S_FF0_I32_B64
2595 
2596  // --- description from .arch file ---
2597  // D.i = FindFirstZero(S0.u64);
2598  // If no zeros are found, return -1.
2599  // Returns the bit position of the first zero from the LSB.
2600  void
2602  {
2603  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2604  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2605 
2606  src.read();
2607 
2608  sdst = findFirstZero(src.rawData());
2609 
2610  sdst.write();
2611  } // execute
2612  // --- Inst_SOP1__S_FF1_I32_B32 class methods ---
2613 
2615  : Inst_SOP1(iFmt, "s_ff1_i32_b32")
2616  {
2617  setFlag(ALU);
2618  } // Inst_SOP1__S_FF1_I32_B32
2619 
2621  {
2622  } // ~Inst_SOP1__S_FF1_I32_B32
2623 
2624  // --- description from .arch file ---
2625  // D.i = FindFirstOne(S0.u);
2626  // If no ones are found, return -1.
2627  // Returns the bit position of the first one from the LSB.
2628  void
2630  {
2631  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2632  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2633 
2634  src.read();
2635 
2636  sdst = findFirstOne(src.rawData());
2637 
2638  sdst.write();
2639  } // execute
2640  // --- Inst_SOP1__S_FF1_I32_B64 class methods ---
2641 
2643  : Inst_SOP1(iFmt, "s_ff1_i32_b64")
2644  {
2645  setFlag(ALU);
2646  } // Inst_SOP1__S_FF1_I32_B64
2647 
2649  {
2650  } // ~Inst_SOP1__S_FF1_I32_B64
2651 
2652  // --- description from .arch file ---
2653  // D.i = FindFirstOne(S0.u64);
2654  // If no ones are found, return -1.
2655  // Returns the bit position of the first one from the LSB.
2656  void
2658  {
2659  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2660  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2661 
2662  src.read();
2663 
2664  sdst = findFirstOne(src.rawData());
2665 
2666  sdst.write();
2667  } // execute
2668  // --- Inst_SOP1__S_FLBIT_I32_B32 class methods ---
2669 
2671  : Inst_SOP1(iFmt, "s_flbit_i32_b32")
2672  {
2673  setFlag(ALU);
2674  } // Inst_SOP1__S_FLBIT_I32_B32
2675 
2677  {
2678  } // ~Inst_SOP1__S_FLBIT_I32_B32
2679 
2680  // --- description from .arch file ---
2681  // D.i = FindFirstOne(S0.u);
2682  // If no ones are found, return -1.
2683  // Counts how many zeros before the first one starting from the MSB.
2684  void
2686  {
2687  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2688  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2689 
2690  src.read();
2691 
2692  sdst = countZeroBitsMsb(src.rawData());
2693 
2694  sdst.write();
2695  } // execute
2696  // --- Inst_SOP1__S_FLBIT_I32_B64 class methods ---
2697 
2699  : Inst_SOP1(iFmt, "s_flbit_i32_b64")
2700  {
2701  setFlag(ALU);
2702  } // Inst_SOP1__S_FLBIT_I32_B64
2703 
2705  {
2706  } // ~Inst_SOP1__S_FLBIT_I32_B64
2707 
2708  // --- description from .arch file ---
2709  // D.i = FindFirstOne(S0.u64);
2710  // If no ones are found, return -1.
2711  // Counts how many zeros before the first one starting from the MSB.
2712  void
2714  {
2715  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2716  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2717 
2718  src.read();
2719 
2720  sdst = countZeroBitsMsb(src.rawData());
2721 
2722  sdst.write();
2723  } // execute
2724  // --- Inst_SOP1__S_FLBIT_I32 class methods ---
2725 
2727  : Inst_SOP1(iFmt, "s_flbit_i32")
2728  {
2729  setFlag(ALU);
2730  } // Inst_SOP1__S_FLBIT_I32
2731 
2733  {
2734  } // ~Inst_SOP1__S_FLBIT_I32
2735 
2736  // --- description from .arch file ---
2737  // D.i = FirstOppositeSignBit(S0.i);
2738  // If S0.i == 0 or S0.i == -1 (all bits are the same), return -1.
2739  // Counts how many bits in a row (from MSB to LSB) are the same as the
2740  // sign bit.
2741  void
2743  {
2744  ConstScalarOperandI32 src(gpuDynInst, instData.SSRC0);
2745  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2746 
2747  src.read();
2748 
2749  sdst = firstOppositeSignBit(src.rawData());
2750 
2751  sdst.write();
2752  } // execute
2753  // --- Inst_SOP1__S_FLBIT_I32_I64 class methods ---
2754 
2756  : Inst_SOP1(iFmt, "s_flbit_i32_i64")
2757  {
2758  setFlag(ALU);
2759  } // Inst_SOP1__S_FLBIT_I32_I64
2760 
2762  {
2763  } // ~Inst_SOP1__S_FLBIT_I32_I64
2764 
2765  // --- description from .arch file ---
2766  // D.i = FirstOppositeSignBit(S0.i64);
2767  // If S0.i == 0 or S0.i == -1 (all bits are the same), return -1.
2768  // Counts how many bits in a row (from MSB to LSB) are the same as the
2769  // sign bit.
2770  void
2772  {
2773  ConstScalarOperandI64 src(gpuDynInst, instData.SSRC0);
2774  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2775 
2776  src.read();
2777 
2778  sdst = firstOppositeSignBit(src.rawData());
2779 
2780  sdst.write();
2781  } // execute
2782  // --- Inst_SOP1__S_SEXT_I32_I8 class methods ---
2783 
2785  : Inst_SOP1(iFmt, "s_sext_i32_i8")
2786  {
2787  setFlag(ALU);
2788  } // Inst_SOP1__S_SEXT_I32_I8
2789 
2791  {
2792  } // ~Inst_SOP1__S_SEXT_I32_I8
2793 
2794  // --- description from .arch file ---
2795  // D.i = signext(S0.i[7:0]) (sign extension).
2796  void
2798  {
2799  ConstScalarOperandI32 src(gpuDynInst, instData.SSRC0);
2800  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2801 
2802  src.read();
2803 
2804  sdst = sext<std::numeric_limits<ScalarRegI8>::digits>(
2805  bits(src.rawData(), 7, 0));
2806 
2807  sdst.write();
2808  } // execute
2809  // --- Inst_SOP1__S_SEXT_I32_I16 class methods ---
2810 
2812  : Inst_SOP1(iFmt, "s_sext_i32_i16")
2813  {
2814  setFlag(ALU);
2815  } // Inst_SOP1__S_SEXT_I32_I16
2816 
2818  {
2819  } // ~Inst_SOP1__S_SEXT_I32_I16
2820 
2821  // --- description from .arch file ---
2822  // D.i = signext(S0.i[15:0]) (sign extension).
2823  void
2825  {
2826  ConstScalarOperandI32 src(gpuDynInst, instData.SSRC0);
2827  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
2828 
2829  src.read();
2830 
2831  sdst = sext<std::numeric_limits<ScalarRegI16>::digits>(
2832  bits(src.rawData(), 15, 0));
2833 
2834  sdst.write();
2835  } // execute
2836  // --- Inst_SOP1__S_BITSET0_B32 class methods ---
2837 
2839  : Inst_SOP1(iFmt, "s_bitset0_b32")
2840  {
2841  setFlag(ALU);
2842  } // Inst_SOP1__S_BITSET0_B32
2843 
2845  {
2846  } // ~Inst_SOP1__S_BITSET0_B32
2847 
2848  // --- description from .arch file ---
2849  // D.u[S0.u[4:0]] = 0.
2850  void
2852  {
2853  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2854  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2855 
2856  src.read();
2857 
2858  sdst.setBit(bits(src.rawData(), 4, 0), 0);
2859 
2860  sdst.write();
2861  } // execute
2862  // --- Inst_SOP1__S_BITSET0_B64 class methods ---
2863 
2865  : Inst_SOP1(iFmt, "s_bitset0_b64")
2866  {
2867  setFlag(ALU);
2868  } // Inst_SOP1__S_BITSET0_B64
2869 
2871  {
2872  } // ~Inst_SOP1__S_BITSET0_B64
2873 
2874  // --- description from .arch file ---
2875  // D.u64[S0.u[5:0]] = 0.
2876  void
2878  {
2879  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2880  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2881 
2882  src.read();
2883 
2884  sdst.setBit(bits(src.rawData(), 5, 0), 0);
2885 
2886  sdst.write();
2887  } // execute
2888  // --- Inst_SOP1__S_BITSET1_B32 class methods ---
2889 
2891  : Inst_SOP1(iFmt, "s_bitset1_b32")
2892  {
2893  setFlag(ALU);
2894  } // Inst_SOP1__S_BITSET1_B32
2895 
2897  {
2898  } // ~Inst_SOP1__S_BITSET1_B32
2899 
2900  // --- description from .arch file ---
2901  // D.u[S0.u[4:0]] = 1.
2902  void
2904  {
2905  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2906  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
2907 
2908  src.read();
2909 
2910  sdst.setBit(bits(src.rawData(), 4, 0), 1);
2911 
2912  sdst.write();
2913  } // execute
2914  // --- Inst_SOP1__S_BITSET1_B64 class methods ---
2915 
2917  : Inst_SOP1(iFmt, "s_bitset1_b64")
2918  {
2919  setFlag(ALU);
2920  } // Inst_SOP1__S_BITSET1_B64
2921 
2923  {
2924  } // ~Inst_SOP1__S_BITSET1_B64
2925 
2926  // --- description from .arch file ---
2927  // D.u64[S0.u[5:0]] = 1.
2928  void
2930  {
2931  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
2932  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2933 
2934  src.read();
2935 
2936  sdst.setBit(bits(src.rawData(), 5, 0), 1);
2937 
2938  sdst.write();
2939  } // execute
2940  // --- Inst_SOP1__S_GETPC_B64 class methods ---
2941 
2943  : Inst_SOP1(iFmt, "s_getpc_b64")
2944  {
2945  setFlag(ALU);
2946  } // Inst_SOP1__S_GETPC_B64
2947 
2949  {
2950  } // ~Inst_SOP1__S_GETPC_B64
2951 
2952  // --- description from .arch file ---
2953  // D.u64 = PC + 4.
2954  // Destination receives the byte address of the next instruction.
2955  void
2957  {
2958  Addr pc = gpuDynInst->pc();
2959  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
2960 
2961  sdst = pc + 4;
2962 
2963  sdst.write();
2964  } // execute
2965  // --- Inst_SOP1__S_SETPC_B64 class methods ---
2966 
2968  : Inst_SOP1(iFmt, "s_setpc_b64")
2969  {
2970  setFlag(ALU);
2971  } // Inst_SOP1__S_SETPC_B64
2972 
2974  {
2975  } // ~Inst_SOP1__S_SETPC_B64
2976 
2977  // --- description from .arch file ---
2978  // PC = S0.u64.
2979  // S0.u64 is a byte address of the instruction to jump to.
2980  void
2982  {
2983  Wavefront *wf = gpuDynInst->wavefront();
2984  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
2985 
2986  src.read();
2987 
2988  wf->pc(src.rawData());
2989  } // execute
2990  // --- Inst_SOP1__S_SWAPPC_B64 class methods ---
2991 
2993  : Inst_SOP1(iFmt, "s_swappc_b64")
2994  {
2995  setFlag(ALU);
2996  } // Inst_SOP1__S_SWAPPC_B64
2997 
2999  {
3000  } // ~Inst_SOP1__S_SWAPPC_B64
3001 
3002  // --- description from .arch file ---
3003  // D.u64 = PC + 4; PC = S0.u64.
3004  // S0.u64 is a byte address of the instruction to jump to.
3005  void
3007  {
3008  Wavefront *wf = gpuDynInst->wavefront();
3009  Addr pc = gpuDynInst->pc();
3010  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3011  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3012 
3013  src.read();
3014 
3015  sdst = pc + 4;
3016 
3017  wf->pc(src.rawData());
3018  sdst.write();
3019  } // execute
3020  // --- Inst_SOP1__S_RFE_B64 class methods ---
3021 
3023  : Inst_SOP1(iFmt, "s_rfe_b64")
3024  {
3025  } // Inst_SOP1__S_RFE_B64
3026 
3028  {
3029  } // ~Inst_SOP1__S_RFE_B64
3030 
3031  // --- description from .arch file ---
3032  // PRIV = 0;
3033  // PC = S0.u64.
3034  // Return from exception handler and continue.
3035  // This instruction may only be used within a trap handler.
3036  void
3038  {
3040  } // execute
3041  // --- Inst_SOP1__S_AND_SAVEEXEC_B64 class methods ---
3042 
3044  InFmt_SOP1 *iFmt)
3045  : Inst_SOP1(iFmt, "s_and_saveexec_b64")
3046  {
3047  setFlag(ALU);
3048  setFlag(ReadsEXEC);
3049  setFlag(WritesEXEC);
3050  } // Inst_SOP1__S_AND_SAVEEXEC_B64
3051 
3053  {
3054  } // ~Inst_SOP1__S_AND_SAVEEXEC_B64
3055 
3056  // --- description from .arch file ---
3057  // D.u64 = EXEC;
3058  // EXEC = S0.u64 & EXEC;
3059  // SCC = 1 if the new value of EXEC is non-zero.
3060  void
3062  {
3063  Wavefront *wf = gpuDynInst->wavefront();
3064  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3065  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3066  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3067 
3068  src.read();
3069 
3070  sdst = wf->execMask().to_ullong();
3071  wf->execMask() = src.rawData() & wf->execMask().to_ullong();
3072  scc = wf->execMask().any() ? 1 : 0;
3073 
3074  sdst.write();
3075  scc.write();
3076  } // execute
3077  // --- Inst_SOP1__S_OR_SAVEEXEC_B64 class methods ---
3078 
3080  InFmt_SOP1 *iFmt)
3081  : Inst_SOP1(iFmt, "s_or_saveexec_b64")
3082  {
3083  setFlag(ALU);
3084  setFlag(ReadsEXEC);
3085  setFlag(WritesEXEC);
3086  } // Inst_SOP1__S_OR_SAVEEXEC_B64
3087 
3089  {
3090  } // ~Inst_SOP1__S_OR_SAVEEXEC_B64
3091 
3092  // --- description from .arch file ---
3093  // D.u64 = EXEC;
3094  // EXEC = S0.u64 | EXEC;
3095  // SCC = 1 if the new value of EXEC is non-zero.
3096  void
3098  {
3099  Wavefront *wf = gpuDynInst->wavefront();
3100  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3101  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3102  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3103 
3104  src.read();
3105 
3106  sdst = wf->execMask().to_ullong();
3107  wf->execMask() = src.rawData() | wf->execMask().to_ullong();
3108  scc = wf->execMask().any() ? 1 : 0;
3109 
3110  sdst.write();
3111  scc.write();
3112  } // execute
3113  // --- Inst_SOP1__S_XOR_SAVEEXEC_B64 class methods ---
3114 
3116  InFmt_SOP1 *iFmt)
3117  : Inst_SOP1(iFmt, "s_xor_saveexec_b64")
3118  {
3119  setFlag(ALU);
3120  setFlag(ReadsEXEC);
3121  setFlag(WritesEXEC);
3122  } // Inst_SOP1__S_XOR_SAVEEXEC_B64
3123 
3125  {
3126  } // ~Inst_SOP1__S_XOR_SAVEEXEC_B64
3127 
3128  // --- description from .arch file ---
3129  // D.u64 = EXEC;
3130  // EXEC = S0.u64 ^ EXEC;
3131  // SCC = 1 if the new value of EXEC is non-zero.
3132  void
3134  {
3135  Wavefront *wf = gpuDynInst->wavefront();
3136  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3137  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3138  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3139 
3140  src.read();
3141 
3142  sdst = wf->execMask().to_ullong();
3143  wf->execMask() = src.rawData() ^ wf->execMask().to_ullong();
3144  scc = wf->execMask().any() ? 1 : 0;
3145 
3146  sdst.write();
3147  scc.write();
3148  } // execute
3149  // --- Inst_SOP1__S_ANDN2_SAVEEXEC_B64 class methods ---
3150 
3152  InFmt_SOP1 *iFmt)
3153  : Inst_SOP1(iFmt, "s_andn2_saveexec_b64")
3154  {
3155  setFlag(ALU);
3156  setFlag(ReadsEXEC);
3157  setFlag(WritesEXEC);
3158  } // Inst_SOP1__S_ANDN2_SAVEEXEC_B64
3159 
3161  {
3162  } // ~Inst_SOP1__S_ANDN2_SAVEEXEC_B64
3163 
3164  // --- description from .arch file ---
3165  // D.u64 = EXEC;
3166  // EXEC = S0.u64 & ~EXEC;
3167  // SCC = 1 if the new value of EXEC is non-zero.
3168  void
3170  {
3171  Wavefront *wf = gpuDynInst->wavefront();
3172  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3173  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3174  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3175 
3176  src.read();
3177 
3178  sdst = wf->execMask().to_ullong();
3179  wf->execMask() = src.rawData() &~ wf->execMask().to_ullong();
3180  scc = wf->execMask().any() ? 1 : 0;
3181 
3182  sdst.write();
3183  scc.write();
3184  } // execute
3185  // --- Inst_SOP1__S_ORN2_SAVEEXEC_B64 class methods ---
3186 
3188  InFmt_SOP1 *iFmt)
3189  : Inst_SOP1(iFmt, "s_orn2_saveexec_b64")
3190  {
3191  setFlag(ALU);
3192  setFlag(ReadsEXEC);
3193  setFlag(WritesEXEC);
3194  } // Inst_SOP1__S_ORN2_SAVEEXEC_B64
3195 
3197  {
3198  } // ~Inst_SOP1__S_ORN2_SAVEEXEC_B64
3199 
3200  // --- description from .arch file ---
3201  // D.u64 = EXEC;
3202  // EXEC = S0.u64 | ~EXEC;
3203  // SCC = 1 if the new value of EXEC is non-zero.
3204  void
3206  {
3207  Wavefront *wf = gpuDynInst->wavefront();
3208  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3209  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3210  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3211 
3212  src.read();
3213 
3214  sdst = wf->execMask().to_ullong();
3215  wf->execMask() = src.rawData() |~ wf->execMask().to_ullong();
3216  scc = wf->execMask().any() ? 1 : 0;
3217 
3218  sdst.write();
3219  scc.write();
3220  } // execute
3221  // --- Inst_SOP1__S_NAND_SAVEEXEC_B64 class methods ---
3222 
3224  InFmt_SOP1 *iFmt)
3225  : Inst_SOP1(iFmt, "s_nand_saveexec_b64")
3226  {
3227  setFlag(ALU);
3228  setFlag(ReadsEXEC);
3229  setFlag(WritesEXEC);
3230  } // Inst_SOP1__S_NAND_SAVEEXEC_B64
3231 
3233  {
3234  } // ~Inst_SOP1__S_NAND_SAVEEXEC_B64
3235 
3236  // --- description from .arch file ---
3237  // D.u64 = EXEC;
3238  // EXEC = ~(S0.u64 & EXEC);
3239  // SCC = 1 if the new value of EXEC is non-zero.
3240  void
3242  {
3243  Wavefront *wf = gpuDynInst->wavefront();
3244  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3245  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3246  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3247 
3248  src.read();
3249 
3250  sdst = wf->execMask().to_ullong();
3251  wf->execMask() = ~(src.rawData() & wf->execMask().to_ullong());
3252  scc = wf->execMask().any() ? 1 : 0;
3253 
3254  sdst.write();
3255  scc.write();
3256  } // execute
3257  // --- Inst_SOP1__S_NOR_SAVEEXEC_B64 class methods ---
3258 
3260  InFmt_SOP1 *iFmt)
3261  : Inst_SOP1(iFmt, "s_nor_saveexec_b64")
3262  {
3263  setFlag(ALU);
3264  setFlag(ReadsEXEC);
3265  setFlag(WritesEXEC);
3266  } // Inst_SOP1__S_NOR_SAVEEXEC_B64
3267 
3269  {
3270  } // ~Inst_SOP1__S_NOR_SAVEEXEC_B64
3271 
3272  // --- description from .arch file ---
3273  // D.u64 = EXEC;
3274  // EXEC = ~(S0.u64 | EXEC);
3275  // SCC = 1 if the new value of EXEC is non-zero.
3276  void
3278  {
3279  Wavefront *wf = gpuDynInst->wavefront();
3280  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3281  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3282  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3283 
3284  src.read();
3285 
3286  sdst = wf->execMask().to_ullong();
3287  wf->execMask() = ~(src.rawData() | wf->execMask().to_ullong());
3288  scc = wf->execMask().any() ? 1 : 0;
3289 
3290  sdst.write();
3291  scc.write();
3292  } // execute
3293  // --- Inst_SOP1__S_XNOR_SAVEEXEC_B64 class methods ---
3294 
3296  InFmt_SOP1 *iFmt)
3297  : Inst_SOP1(iFmt, "s_xnor_saveexec_b64")
3298  {
3299  setFlag(ALU);
3300  setFlag(ReadsEXEC);
3301  setFlag(WritesEXEC);
3302  } // Inst_SOP1__S_XNOR_SAVEEXEC_B64
3303 
3305  {
3306  } // ~Inst_SOP1__S_XNOR_SAVEEXEC_B64
3307 
3308  // --- description from .arch file ---
3309  // D.u64 = EXEC;
3310  // EXEC = ~(S0.u64 ^ EXEC);
3311  // SCC = 1 if the new value of EXEC is non-zero.
3312  void
3314  {
3315  Wavefront *wf = gpuDynInst->wavefront();
3316  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3317  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3318  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3319 
3320  src.read();
3321 
3322  sdst = wf->execMask().to_ullong();
3323  wf->execMask() = ~(src.rawData() ^ wf->execMask().to_ullong());
3324  scc = wf->execMask().any() ? 1 : 0;
3325 
3326  sdst.write();
3327  scc.write();
3328  } // execute
3329  // --- Inst_SOP1__S_QUADMASK_B32 class methods ---
3330 
3332  : Inst_SOP1(iFmt, "s_quadmask_b32")
3333  {
3334  setFlag(ALU);
3335  } // Inst_SOP1__S_QUADMASK_B32
3336 
3338  {
3339  } // ~Inst_SOP1__S_QUADMASK_B32
3340 
3341  // --- description from .arch file ---
3342  // D.u = QuadMask(S0.u):
3343  // D[0] = OR(S0[3:0]), D[1] = OR(S0[7:4]) ... D[31:8] = 0;
3344  // SCC = 1 if result is non-zero.
3345  void
3347  {
3348  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
3349  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
3350  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3351 
3352  src.read();
3353 
3354  sdst = quadMask(src.rawData());
3355  scc = sdst.rawData() ? 1 : 0;
3356 
3357  sdst.write();
3358  scc.write();
3359  } // execute
3360  // --- Inst_SOP1__S_QUADMASK_B64 class methods ---
3361 
3363  : Inst_SOP1(iFmt, "s_quadmask_b64")
3364  {
3365  setFlag(ALU);
3366  } // Inst_SOP1__S_QUADMASK_B64
3367 
3369  {
3370  } // ~Inst_SOP1__S_QUADMASK_B64
3371 
3372  // --- description from .arch file ---
3373  // D.u64 = QuadMask(S0.u64):
3374  // D[0] = OR(S0[3:0]), D[1] = OR(S0[7:4]) ... D[63:16] = 0;
3375  // SCC = 1 if result is non-zero.
3376  void
3378  {
3379  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3380  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3381  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3382 
3383  src.read();
3384 
3385  sdst = quadMask(src.rawData());
3386  scc = sdst.rawData() ? 1 : 0;
3387 
3388  sdst.write();
3389  scc.write();
3390  } // execute
3391  // --- Inst_SOP1__S_MOVRELS_B32 class methods ---
3392 
3394  : Inst_SOP1(iFmt, "s_movrels_b32")
3395  {
3396  setFlag(ALU);
3397  } // Inst_SOP1__S_MOVRELS_B32
3398 
3400  {
3401  } // ~Inst_SOP1__S_MOVRELS_B32
3402 
3403  // --- description from .arch file ---
3404  // D.u = SGPR[S0.u + M0.u].u (move from relative source).
3405  void
3407  {
3408  ConstScalarOperandU32 m0(gpuDynInst, REG_M0);
3409  m0.read();
3410  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0 + m0.rawData());
3411  ScalarOperandU32 sdst(gpuDynInst, instData.SDST);
3412 
3413  src.read();
3414 
3415  sdst = src.rawData();
3416 
3417  sdst.write();
3418  } // execute
3419  // --- Inst_SOP1__S_MOVRELS_B64 class methods ---
3420 
3422  : Inst_SOP1(iFmt, "s_movrels_b64")
3423  {
3424  setFlag(ALU);
3425  } // Inst_SOP1__S_MOVRELS_B64
3426 
3428  {
3429  } // ~Inst_SOP1__S_MOVRELS_B64
3430 
3431  // --- description from .arch file ---
3432  // D.u64 = SGPR[S0.u + M0.u].u64 (move from relative source).
3433  // The index in M0.u must be even for this operation.
3434  void
3436  {
3437  ConstScalarOperandU32 m0(gpuDynInst, REG_M0);
3438  m0.read();
3439  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0 + m0.rawData());
3440  ScalarOperandU64 sdst(gpuDynInst, instData.SDST);
3441 
3442  src.read();
3443 
3444  sdst = src.rawData();
3445 
3446  sdst.write();
3447  } // execute
3448  // --- Inst_SOP1__S_MOVRELD_B32 class methods ---
3449 
3451  : Inst_SOP1(iFmt, "s_movreld_b32")
3452  {
3453  setFlag(ALU);
3454  } // Inst_SOP1__S_MOVRELD_B32
3455 
3457  {
3458  } // ~Inst_SOP1__S_MOVRELD_B32
3459 
3460  // --- description from .arch file ---
3461  // SGPR[D.u + M0.u].u = S0.u (move to relative destination).
3462  void
3464  {
3465  ConstScalarOperandU32 m0(gpuDynInst, REG_M0);
3466  m0.read();
3467  ConstScalarOperandU32 src(gpuDynInst, instData.SSRC0);
3468  ScalarOperandU32 sdst(gpuDynInst, instData.SDST + m0.rawData());
3469 
3470  src.read();
3471 
3472  sdst = src.rawData();
3473 
3474  sdst.write();
3475  } // execute
3476  // --- Inst_SOP1__S_MOVRELD_B64 class methods ---
3477 
3479  : Inst_SOP1(iFmt, "s_movreld_b64")
3480  {
3481  setFlag(ALU);
3482  } // Inst_SOP1__S_MOVRELD_B64
3483 
3485  {
3486  } // ~Inst_SOP1__S_MOVRELD_B64
3487 
3488  // --- description from .arch file ---
3489  // SGPR[D.u + M0.u].u64 = S0.u64 (move to relative destination).
3490  // The index in M0.u must be even for this operation.
3491  void
3493  {
3494  ConstScalarOperandU32 m0(gpuDynInst, REG_M0);
3495  m0.read();
3496  ConstScalarOperandU64 src(gpuDynInst, instData.SSRC0);
3497  ScalarOperandU64 sdst(gpuDynInst, instData.SDST + m0.rawData());
3498 
3499  src.read();
3500 
3501  sdst = src.rawData();
3502 
3503  sdst.write();
3504  } // execute
3505  // --- Inst_SOP1__S_CBRANCH_JOIN class methods ---
3506 
3508  : Inst_SOP1(iFmt, "s_cbranch_join")
3509  {
3510  setFlag(Branch);
3511  setFlag(WritesEXEC);
3512  } // Inst_SOP1__S_CBRANCH_JOIN
3513 
3515  {
3516  } // ~Inst_SOP1__S_CBRANCH_JOIN
3517 
3518  // --- description from .arch file ---
3519  // saved_csp = S0.u;
3520  // if(CSP == saved_csp) then
3521  // PC += 4; // Second time to JOIN: continue with program.
3522  // else
3523  // CSP -= 1; // First time to JOIN; jump to other FORK path.
3524  // {PC, EXEC} = SGPR[CSP * 4]; // Read 128 bits from 4 consecutive
3525  // SGPRs.
3526  // end
3527  // Conditional branch join point (end of conditional branch block). S0 is
3528  // saved CSP value.
3529  // See S_CBRANCH_G_FORK and S_CBRANCH_I_FORK for related instructions.
3530  void
3532  {
3534  } // execute
3535  // --- Inst_SOP1__S_ABS_I32 class methods ---
3536 
3538  : Inst_SOP1(iFmt, "s_abs_i32")
3539  {
3540  setFlag(ALU);
3541  } // Inst_SOP1__S_ABS_I32
3542 
3544  {
3545  } // ~Inst_SOP1__S_ABS_I32
3546 
3547  // --- description from .arch file ---
3548  // if(S.i < 0) then D.i = -S.i;
3549  // else D.i = S.i;
3550  // SCC = 1 if result is non-zero.
3551  // Integer absolute value.
3552  void
3554  {
3555  ConstScalarOperandI32 src(gpuDynInst, instData.SSRC0);
3556  ScalarOperandI32 sdst(gpuDynInst, instData.SDST);
3557  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3558 
3559  src.read();
3560 
3561  sdst = std::abs(src.rawData());
3562 
3563  scc = sdst.rawData() ? 1 : 0;
3564 
3565  sdst.write();
3566  scc.write();
3567  } // execute
3568  // --- Inst_SOP1__S_MOV_FED_B32 class methods ---
3569 
3571  : Inst_SOP1(iFmt, "s_mov_fed_b32")
3572  {
3573  setFlag(ALU);
3574  } // Inst_SOP1__S_MOV_FED_B32
3575 
3577  {
3578  } // ~Inst_SOP1__S_MOV_FED_B32
3579 
3580  // --- description from .arch file ---
3581  // D.u = S0.u. Introduce an EDC double-detect error on write to the
3582  // destination SGPR.
3583  void
3585  {
3587  } // execute
3588  // --- Inst_SOP1__S_SET_GPR_IDX_IDX class methods ---
3589 
3591  InFmt_SOP1 *iFmt)
3592  : Inst_SOP1(iFmt, "s_set_gpr_idx_idx")
3593  {
3594  } // Inst_SOP1__S_SET_GPR_IDX_IDX
3595 
3597  {
3598  } // ~Inst_SOP1__S_SET_GPR_IDX_IDX
3599 
3600  // --- description from .arch file ---
3601  // M0[7:0] = S0.u[7:0].
3602  // Modify the index used in vector GPR indexing.
3603  void
3605  {
3607  } // execute
3608  // --- Inst_SOPC__S_CMP_EQ_I32 class methods ---
3609 
3611  : Inst_SOPC(iFmt, "s_cmp_eq_i32")
3612  {
3613  setFlag(ALU);
3614  } // Inst_SOPC__S_CMP_EQ_I32
3615 
3617  {
3618  } // ~Inst_SOPC__S_CMP_EQ_I32
3619 
3620  // --- description from .arch file ---
3621  // SCC = (S0.i == S1.i).
3622  void
3624  {
3625  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
3626  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
3627  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3628 
3629  src0.read();
3630  src1.read();
3631 
3632  scc = (src0.rawData() == src1.rawData()) ? 1 : 0;
3633 
3634  scc.write();
3635  } // execute
3636  // --- Inst_SOPC__S_CMP_LG_I32 class methods ---
3637 
3639  : Inst_SOPC(iFmt, "s_cmp_lg_i32")
3640  {
3641  setFlag(ALU);
3642  } // Inst_SOPC__S_CMP_LG_I32
3643 
3645  {
3646  } // ~Inst_SOPC__S_CMP_LG_I32
3647 
3648  // --- description from .arch file ---
3649  // SCC = (S0.i != S1.i).
3650  void
3652  {
3653  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
3654  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
3655  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3656 
3657  src0.read();
3658  src1.read();
3659 
3660  scc = (src0.rawData() != src1.rawData()) ? 1 : 0;
3661 
3662  scc.write();
3663  } // execute
3664  // --- Inst_SOPC__S_CMP_GT_I32 class methods ---
3665 
3667  : Inst_SOPC(iFmt, "s_cmp_gt_i32")
3668  {
3669  setFlag(ALU);
3670  } // Inst_SOPC__S_CMP_GT_I32
3671 
3673  {
3674  } // ~Inst_SOPC__S_CMP_GT_I32
3675 
3676  // --- description from .arch file ---
3677  // SCC = (S0.i > S1.i).
3678  void
3680  {
3681  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
3682  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
3683  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3684 
3685  src0.read();
3686  src1.read();
3687 
3688  scc = (src0.rawData() > src1.rawData()) ? 1 : 0;
3689 
3690  scc.write();
3691  } // execute
3692  // --- Inst_SOPC__S_CMP_GE_I32 class methods ---
3693 
3695  : Inst_SOPC(iFmt, "s_cmp_ge_i32")
3696  {
3697  setFlag(ALU);
3698  } // Inst_SOPC__S_CMP_GE_I32
3699 
3701  {
3702  } // ~Inst_SOPC__S_CMP_GE_I32
3703 
3704  // --- description from .arch file ---
3705  // SCC = (S0.i >= S1.i).
3706  void
3708  {
3709  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
3710  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
3711  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3712 
3713  src0.read();
3714  src1.read();
3715 
3716  scc = (src0.rawData() >= src1.rawData()) ? 1 : 0;
3717 
3718  scc.write();
3719  } // execute
3720  // --- Inst_SOPC__S_CMP_LT_I32 class methods ---
3721 
3723  : Inst_SOPC(iFmt, "s_cmp_lt_i32")
3724  {
3725  setFlag(ALU);
3726  } // Inst_SOPC__S_CMP_LT_I32
3727 
3729  {
3730  } // ~Inst_SOPC__S_CMP_LT_I32
3731 
3732  // --- description from .arch file ---
3733  // SCC = (S0.i < S1.i).
3734  void
3736  {
3737  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
3738  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
3739  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3740 
3741  src0.read();
3742  src1.read();
3743 
3744  scc = (src0.rawData() < src1.rawData()) ? 1 : 0;
3745 
3746  scc.write();
3747  } // execute
3748  // --- Inst_SOPC__S_CMP_LE_I32 class methods ---
3749 
3751  : Inst_SOPC(iFmt, "s_cmp_le_i32")
3752  {
3753  setFlag(ALU);
3754  } // Inst_SOPC__S_CMP_LE_I32
3755 
3757  {
3758  } // ~Inst_SOPC__S_CMP_LE_I32
3759 
3760  // --- description from .arch file ---
3761  // SCC = (S0.i <= S1.i).
3762  void
3764  {
3765  ConstScalarOperandI32 src0(gpuDynInst, instData.SSRC0);
3766  ConstScalarOperandI32 src1(gpuDynInst, instData.SSRC1);
3767  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3768 
3769  src0.read();
3770  src1.read();
3771 
3772  scc = (src0.rawData() <= src1.rawData()) ? 1 : 0;
3773 
3774  scc.write();
3775  } // execute
3776  // --- Inst_SOPC__S_CMP_EQ_U32 class methods ---
3777 
3779  : Inst_SOPC(iFmt, "s_cmp_eq_u32")
3780  {
3781  setFlag(ALU);
3782  } // Inst_SOPC__S_CMP_EQ_U32
3783 
3785  {
3786  } // ~Inst_SOPC__S_CMP_EQ_U32
3787 
3788  // --- description from .arch file ---
3789  // SCC = (S0.u == S1.u).
3790  void
3792  {
3793  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3794  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3795  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3796 
3797  src0.read();
3798  src1.read();
3799 
3800  scc = (src0.rawData() == src1.rawData()) ? 1 : 0;
3801 
3802  scc.write();
3803  } // execute
3804  // --- Inst_SOPC__S_CMP_LG_U32 class methods ---
3805 
3807  : Inst_SOPC(iFmt, "s_cmp_lg_u32")
3808  {
3809  setFlag(ALU);
3810  } // Inst_SOPC__S_CMP_LG_U32
3811 
3813  {
3814  } // ~Inst_SOPC__S_CMP_LG_U32
3815 
3816  // --- description from .arch file ---
3817  // SCC = (S0.u != S1.u).
3818  void
3820  {
3821  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3822  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3823  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3824 
3825  src0.read();
3826  src1.read();
3827 
3828  scc = (src0.rawData() != src1.rawData()) ? 1 : 0;
3829 
3830  scc.write();
3831  } // execute
3832  // --- Inst_SOPC__S_CMP_GT_U32 class methods ---
3833 
3835  : Inst_SOPC(iFmt, "s_cmp_gt_u32")
3836  {
3837  setFlag(ALU);
3838  } // Inst_SOPC__S_CMP_GT_U32
3839 
3841  {
3842  } // ~Inst_SOPC__S_CMP_GT_U32
3843 
3844  // --- description from .arch file ---
3845  // SCC = (S0.u > S1.u).
3846  void
3848  {
3849  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3850  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3851  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3852 
3853  src0.read();
3854  src1.read();
3855 
3856  scc = (src0.rawData() > src1.rawData()) ? 1 : 0;
3857 
3858  scc.write();
3859  } // execute
3860  // --- Inst_SOPC__S_CMP_GE_U32 class methods ---
3861 
3863  : Inst_SOPC(iFmt, "s_cmp_ge_u32")
3864  {
3865  setFlag(ALU);
3866  } // Inst_SOPC__S_CMP_GE_U32
3867 
3869  {
3870  } // ~Inst_SOPC__S_CMP_GE_U32
3871 
3872  // --- description from .arch file ---
3873  // SCC = (S0.u >= S1.u).
3874  void
3876  {
3877  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3878  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3879  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3880 
3881  src0.read();
3882  src1.read();
3883 
3884  scc = (src0.rawData() >= src1.rawData()) ? 1 : 0;
3885 
3886  scc.write();
3887  } // execute
3888  // --- Inst_SOPC__S_CMP_LT_U32 class methods ---
3889 
3891  : Inst_SOPC(iFmt, "s_cmp_lt_u32")
3892  {
3893  setFlag(ALU);
3894  } // Inst_SOPC__S_CMP_LT_U32
3895 
3897  {
3898  } // ~Inst_SOPC__S_CMP_LT_U32
3899 
3900  // --- description from .arch file ---
3901  // SCC = (S0.u < S1.u).
3902  void
3904  {
3905  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3906  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3907  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3908 
3909  src0.read();
3910  src1.read();
3911 
3912  scc = (src0.rawData() < src1.rawData()) ? 1 : 0;
3913 
3914  scc.write();
3915  } // execute
3916  // --- Inst_SOPC__S_CMP_LE_U32 class methods ---
3917 
3919  : Inst_SOPC(iFmt, "s_cmp_le_u32")
3920  {
3921  setFlag(ALU);
3922  } // Inst_SOPC__S_CMP_LE_U32
3923 
3925  {
3926  } // ~Inst_SOPC__S_CMP_LE_U32
3927 
3928  // --- description from .arch file ---
3929  // SCC = (S0.u <= S1.u).
3930  void
3932  {
3933  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3934  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3935  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3936 
3937  src0.read();
3938  src1.read();
3939 
3940  scc = (src0.rawData() <= src1.rawData()) ? 1 : 0;
3941 
3942  scc.write();
3943  } // execute
3944  // --- Inst_SOPC__S_BITCMP0_B32 class methods ---
3945 
3947  : Inst_SOPC(iFmt, "s_bitcmp0_b32")
3948  {
3949  setFlag(ALU);
3950  } // Inst_SOPC__S_BITCMP0_B32
3951 
3953  {
3954  } // ~Inst_SOPC__S_BITCMP0_B32
3955 
3956  // --- description from .arch file ---
3957  // SCC = (S0.u[S1.u[4:0]] == 0).
3958  void
3960  {
3961  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3962  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3963  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3964 
3965  src0.read();
3966  src1.read();
3967 
3968  scc = !bits(src0.rawData(), bits(src1.rawData(), 4, 0)) ? 1 : 0;
3969 
3970  scc.write();
3971  } // execute
3972  // --- Inst_SOPC__S_BITCMP1_B32 class methods ---
3973 
3975  : Inst_SOPC(iFmt, "s_bitcmp1_b32")
3976  {
3977  setFlag(ALU);
3978  } // Inst_SOPC__S_BITCMP1_B32
3979 
3981  {
3982  } // ~Inst_SOPC__S_BITCMP1_B32
3983 
3984  // --- description from .arch file ---
3985  // SCC = (S0.u[S1.u[4:0]] == 1).
3986  void
3988  {
3989  ConstScalarOperandU32 src0(gpuDynInst, instData.SSRC0);
3990  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
3991  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
3992 
3993  src0.read();
3994  src1.read();
3995 
3996  scc = bits(src0.rawData(), bits(src1.rawData(), 4, 0)) ? 1 : 0;
3997 
3998  scc.write();
3999  } // execute
4000  // --- Inst_SOPC__S_BITCMP0_B64 class methods ---
4001 
4003  : Inst_SOPC(iFmt, "s_bitcmp0_b64")
4004  {
4005  setFlag(ALU);
4006  } // Inst_SOPC__S_BITCMP0_B64
4007 
4009  {
4010  } // ~Inst_SOPC__S_BITCMP0_B64
4011 
4012  // --- description from .arch file ---
4013  // SCC = (S0.u64[S1.u[5:0]] == 0).
4014  void
4016  {
4017  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
4018  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
4019  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
4020 
4021  src0.read();
4022  src1.read();
4023 
4024  scc = !bits(src0.rawData(), bits(src1.rawData(), 5, 0)) ? 1 : 0;
4025 
4026  scc.write();
4027  } // execute
4028  // --- Inst_SOPC__S_BITCMP1_B64 class methods ---
4029 
4031  : Inst_SOPC(iFmt, "s_bitcmp1_b64")
4032  {
4033  setFlag(ALU);
4034  } // Inst_SOPC__S_BITCMP1_B64
4035 
4037  {
4038  } // ~Inst_SOPC__S_BITCMP1_B64
4039 
4040  // --- description from .arch file ---
4041  // SCC = (S0.u64[S1.u[5:0]] == 1).
4042  void
4044  {
4045  ConstScalarOperandU64 src0(gpuDynInst, instData.SSRC0);
4046  ConstScalarOperandU32 src1(gpuDynInst, instData.SSRC1);
4047  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
4048 
4049  src0.read();
4050  src1.read();
4051 
4052  scc = bits(src0.rawData(), bits(src1.rawData(), 5, 0)) ? 1 : 0;
4053 
4054  scc.write();
4055  } // execute
4056  // --- Inst_SOPC__S_SETVSKIP class methods ---
4057 
4059  : Inst_SOPC(iFmt, "s_setvskip")
4060  {
4061  } // Inst_SOPC__S_SETVSKIP
4062 
4064  {
4065  } // ~Inst_SOPC__S_SETVSKIP
4066 
4067  // --- description from .arch file ---
4068  // VSKIP = S0.u[S1.u[4:0]].
4069  // Enables and disables VSKIP mode.
4070  // When VSKIP is enabled, no VOP*/M*BUF/MIMG/DS/FLAT/EXP instuctions are
4071  // issued.
4072  // If any vector operations are outstanding, S_WAITCNT must be issued
4073  // before executing.
4074  // This instruction requires one waitstate after executing (e.g. S_NOP 0).
4075  // Example:
4076  // s_waitcnt 0
4077  // s_setvskip 1, 0 // Enable vskip mode.
4078  // s_nop 1
4079  void
4081  {
4083  } // execute
4084  // --- Inst_SOPC__S_SET_GPR_IDX_ON class methods ---
4085 
4087  : Inst_SOPC(iFmt, "s_set_gpr_idx_on")
4088  {
4089  } // Inst_SOPC__S_SET_GPR_IDX_ON
4090 
4092  {
4093  } // ~Inst_SOPC__S_SET_GPR_IDX_ON
4094 
4095  // --- description from .arch file ---
4096  // MODE.gpr_idx_en = 1;
4097  // M0[7:0] = S0.u[7:0];
4098  // M0[15:12] = SIMM4 (direct contents of S1 field);
4099  // // Remaining bits of M0 are unmodified.
4100  // Enable GPR indexing mode. Vector operations after this will perform
4101  // relative GPR addressing based on the contents of M0. The structure
4102  // SQ_M0_GPR_IDX_WORD may be used to decode M0.
4103  // The raw contents of the S1 field are read and used to set the enable
4104  // bits. S1[0] = VSRC0_REL, S1[1] = VSRC1_REL, S1[2] = VSRC2_REL and
4105  // S1[3] = VDST_REL.
4106  void
4108  {
4110  } // execute
4111  // --- Inst_SOPC__S_CMP_EQ_U64 class methods ---
4112 
4114  : Inst_SOPC(iFmt, "s_cmp_eq_u64")
4115  {
4116  setFlag(ALU);
4117  } // Inst_SOPC__S_CMP_EQ_U64
4118 
4120  {
4121  } // ~Inst_SOPC__S_CMP_EQ_U64
4122 
4123  // --- description from .arch file ---
4124  // SCC = (S0.i64 == S1.i64).
4125  void
4127  {
4128  ConstScalarOperandI64 src0(gpuDynInst, instData.SSRC0);
4129  ConstScalarOperandI64 src1(gpuDynInst, instData.SSRC1);
4130  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
4131 
4132  src0.read();
4133  src1.read();
4134 
4135  scc = (src0.rawData() == src1.rawData()) ? 1 : 0;
4136 
4137  scc.write();
4138  } // execute
4139  // --- Inst_SOPC__S_CMP_LG_U64 class methods ---
4140 
4142  : Inst_SOPC(iFmt, "s_cmp_lg_u64")
4143  {
4144  setFlag(ALU);
4145  } // Inst_SOPC__S_CMP_LG_U64
4146 
4148  {
4149  } // ~Inst_SOPC__S_CMP_LG_U64
4150 
4151  // --- description from .arch file ---
4152  // SCC = (S0.i64 != S1.i64).
4153  void
4155  {
4156  ConstScalarOperandI64 src0(gpuDynInst, instData.SSRC0);
4157  ConstScalarOperandI64 src1(gpuDynInst, instData.SSRC1);
4158  ScalarOperandU32 scc(gpuDynInst, REG_SCC);
4159 
4160  src0.read();
4161  src1.read();
4162 
4163  scc = (src0.rawData() != src1.rawData()) ? 1 : 0;
4164 
4165  scc.write();
4166  } // execute
4167  // --- Inst_SOPP__S_NOP class methods ---
4168 
4170  : Inst_SOPP(iFmt, "s_nop")
4171  {
4172  setFlag(Nop);
4173  } // Inst_SOPP__S_NOP
4174 
4176  {
4177  } // ~Inst_SOPP__S_NOP
4178 
4179  // --- description from .arch file ---
4180  // Do nothing. Repeat NOP 1..8 times based on SIMM16[2:0] -- 0 = 1 time,
4181  // 7 = 8 times.
4182  // This instruction may be used to introduce wait states to resolve
4183  // hazards; see the shader programming guide for details. Compare with
4184  // S_SLEEP.
4185  void
4187  {
4188  } // execute
4189  // --- Inst_SOPP__S_ENDPGM class methods ---
4190 
4192  : Inst_SOPP(iFmt, "s_endpgm")
4193  {
4194  setFlag(EndOfKernel);
4195  } // Inst_SOPP__S_ENDPGM
4196 
4198  {
4199  } // ~Inst_SOPP__S_ENDPGM
4200 
4201  // --- description from .arch file ---
4202  // End of program; terminate wavefront.
4203  // The hardware implicitly executes S_WAITCNT 0 before executing this
4204  // --- instruction.
4205  // See S_ENDPGM_SAVED for the context-switch version of this instruction.
4206  void
4208  {
4209  Wavefront *wf = gpuDynInst->wavefront();
4210  ComputeUnit *cu = gpuDynInst->computeUnit();
4211 
4212  // delete extra instructions fetched for completed work-items
4213  wf->instructionBuffer.erase(wf->instructionBuffer.begin() + 1,
4214  wf->instructionBuffer.end());
4215 
4216  if (wf->pendingFetch) {
4217  wf->dropFetch = true;
4218  }
4219 
4221  .flushBuf(wf->wfSlotId);
4223 
4224  int refCount = wf->computeUnit->getLds()
4225  .decreaseRefCounter(wf->dispatchId, wf->wgId);
4226 
4232  int bar_id = WFBarrier::InvalidID;
4233  if (wf->hasBarrier()) {
4234  assert(wf->getStatus() != Wavefront::S_BARRIER);
4235  bar_id = wf->barrierId();
4236  assert(bar_id != WFBarrier::InvalidID);
4237  wf->releaseBarrier();
4238  cu->decMaxBarrierCnt(bar_id);
4239  DPRINTF(GPUSync, "CU[%d] WF[%d][%d] Wave[%d] - Exiting the "
4240  "program and decrementing max barrier count for "
4241  "barrier Id%d. New max count: %d.\n", cu->cu_id,
4242  wf->simdId, wf->wfSlotId, wf->wfDynId, bar_id,
4243  cu->maxBarrierCnt(bar_id));
4244  }
4245 
4246  DPRINTF(GPUExec, "CU%d: decrease ref ctr WG[%d] to [%d]\n",
4247  wf->computeUnit->cu_id, wf->wgId, refCount);
4248 
4251  wf->computeUnit->activeWaves--;
4252 
4253  panic_if(wf->computeUnit->activeWaves < 0, "CU[%d] Active waves less "
4254  "than zero\n", wf->computeUnit->cu_id);
4255 
4256  DPRINTF(GPUExec, "Doing return for CU%d: WF[%d][%d][%d]\n",
4257  wf->computeUnit->cu_id, wf->simdId, wf->wfSlotId, wf->wfDynId);
4258 
4259  for (int i = 0; i < wf->vecReads.size(); i++) {
4260  if (wf->rawDist.find(i) != wf->rawDist.end()) {
4261  wf->stats.readsPerWrite.sample(wf->vecReads.at(i));
4262  }
4263  }
4264  wf->vecReads.clear();
4265  wf->rawDist.clear();
4266  wf->lastInstExec = 0;
4267 
4268  if (!refCount) {
4275  if (bar_id != WFBarrier::InvalidID) {
4276  DPRINTF(GPUSync, "CU[%d] WF[%d][%d] Wave[%d] - All waves are "
4277  "now complete. Releasing barrier Id%d.\n", cu->cu_id,
4278  wf->simdId, wf->wfSlotId, wf->wfDynId,
4279  wf->barrierId());
4280  cu->releaseBarrier(bar_id);
4281  }
4282 
4291  //check whether the workgroup is indicating the kernel end, i.e.,
4292  //the last workgroup in the kernel
4293  bool kernelEnd =
4295 
4296  bool relNeeded =
4298 
4299  //if it is not a kernel end, then retire the workgroup directly
4300  if (!kernelEnd || !relNeeded) {
4304 
4305  return;
4306  }
4307 
4315  setFlag(MemSync);
4316  setFlag(GlobalSegment);
4317  // Notify Memory System of Kernel Completion
4318  // Kernel End = isKernel + isMemSync
4320  gpuDynInst->simdId = wf->simdId;
4321  gpuDynInst->wfSlotId = wf->wfSlotId;
4322  gpuDynInst->wfDynId = wf->wfDynId;
4323 
4324  DPRINTF(GPUExec, "inject global memory fence for CU%d: "
4325  "WF[%d][%d][%d]\n", wf->computeUnit->cu_id,
4326  wf->simdId, wf->wfSlotId, wf->wfDynId);
4327 
4328  // call shader to prepare the flush operations
4329  wf->computeUnit->shader->prepareFlush(gpuDynInst);
4330 
4332  } else {
4334  }
4335  } // execute
4336 
4337  // --- Inst_SOPP__S_BRANCH class methods ---
4338 
4340  : Inst_SOPP(iFmt, "s_branch")
4341  {
4342  setFlag(Branch);
4343  } // Inst_SOPP__S_BRANCH
4344 
4346  {
4347  } // ~Inst_SOPP__S_BRANCH
4348 
4349  // --- description from .arch file ---
4350  // PC = PC + signext(SIMM16 * 4) + 4 (short jump).
4351  // For a long jump, use S_SETPC.
4352  void
4354  {
4355  Wavefront *wf = gpuDynInst->wavefront();
4356  Addr pc = gpuDynInst->pc();
4357  ScalarRegI16 simm16 = instData.SIMM16;
4358 
4359  pc = pc + ((ScalarRegI64)simm16 * 4LL) + 4LL;
4360 
4361  wf->pc(pc);
4362  } // execute
4363  // --- Inst_SOPP__S_WAKEUP class methods ---
4364 
4366  : Inst_SOPP(iFmt, "s_wakeup")
4367  {
4368  } // Inst_SOPP__S_WAKEUP
4369 
4371  {
4372  } // ~Inst_SOPP__S_WAKEUP
4373 
4374  // --- description from .arch file ---
4375  // Allow a wave to 'ping' all the other waves in its threadgroup to force
4376  // them to wake up immediately from an S_SLEEP instruction. The ping is
4377  // ignored if the waves are not sleeping.
4378  // This allows for more efficient polling on a memory location. The waves
4379  // which are polling can sit in a long S_SLEEP between memory reads, but
4380  // the wave which writes the value can tell them all to wake up early now
4381  // that the data is available. This is useful for fBarrier implementations
4382  // (speedup).
4383  // This method is also safe from races because if any wave misses the ping,
4384  // everything still works fine (whoever missed it just completes their
4385  // normal S_SLEEP).
4386  void
4388  {
4390  } // execute
4391  // --- Inst_SOPP__S_CBRANCH_SCC0 class methods ---
4392 
4394  : Inst_SOPP(iFmt, "s_cbranch_scc0")
4395  {
4396  setFlag(Branch);
4397  } // Inst_SOPP__S_CBRANCH_SCC0
4398 
4400  {
4401  } // ~Inst_SOPP__S_CBRANCH_SCC0
4402 
4403  // --- description from .arch file ---
4404  // if(SCC == 0) then PC = PC + signext(SIMM16 * 4) + 4;
4405  // else NOP.
4406  void
4408  {
4409  Wavefront *wf = gpuDynInst->wavefront();
4410  Addr pc = gpuDynInst->pc();
4411  ScalarRegI16 simm16 = instData.SIMM16;
4412  ConstScalarOperandU32 scc(gpuDynInst, REG_SCC);
4413 
4414  scc.read();
4415 
4416  if (!scc.rawData()) {
4417  pc = pc + ((ScalarRegI64)simm16 * 4LL) + 4LL;
4418  }
4419 
4420  wf->pc(pc);
4421  } // execute
4422  // --- Inst_SOPP__S_CBRANCH_SCC1 class methods ---
4423 
4425  : Inst_SOPP(iFmt, "s_cbranch_scc1")
4426  {
4427  setFlag(Branch);
4428  } // Inst_SOPP__S_CBRANCH_SCC1
4429 
4431  {
4432  } // ~Inst_SOPP__S_CBRANCH_SCC1
4433 
4434  // --- description from .arch file ---
4435  // if(SCC == 1) then PC = PC + signext(SIMM16 * 4) + 4;
4436  // else NOP.
4437  void
4439  {
4440  Wavefront *wf = gpuDynInst->wavefront();
4441  Addr pc = gpuDynInst->pc();
4442  ScalarRegI16 simm16 = instData.SIMM16;
4443  ConstScalarOperandU32 scc(gpuDynInst, REG_SCC);
4444 
4445  scc.read();
4446 
4447  if (scc.rawData()) {
4448  pc = pc + ((ScalarRegI64)simm16 * 4LL) + 4LL;
4449  }
4450 
4451  wf->pc(pc);
4452  } // execute
4453  // --- Inst_SOPP__S_CBRANCH_VCCZ class methods ---
4454 
4456  : Inst_SOPP(iFmt, "s_cbranch_vccz")
4457  {
4458  setFlag(Branch);
4459  setFlag(ReadsVCC);
4460  } // Inst_SOPP__S_CBRANCH_VCCZ
4461 
4463  {
4464  } // ~Inst_SOPP__S_CBRANCH_VCCZ
4465 
4466  // --- description from .arch file ---
4467  // if(VCC == 0) then PC = PC + signext(SIMM16 * 4) + 4;
4468  // else NOP.
4469  void
4471  {
4472  Wavefront *wf = gpuDynInst->wavefront();
4473  ConstScalarOperandU64 vcc(gpuDynInst, REG_VCC_LO);
4474  Addr pc = gpuDynInst->pc();
4475  ScalarRegI16 simm16 = instData.SIMM16;
4476 
4477  vcc.read();
4478 
4479  if (!vcc.rawData()) {
4480  pc = pc + ((ScalarRegI64)simm16 * 4LL) + 4LL;
4481  }
4482 
4483  wf->pc(pc);
4484  } // execute
4485  // --- Inst_SOPP__S_CBRANCH_VCCNZ class methods ---
4486 
4488  : Inst_SOPP(iFmt, "s_cbranch_vccnz")
4489  {
4490  setFlag(Branch);
4491  setFlag(ReadsVCC);
4492  } // Inst_SOPP__S_CBRANCH_VCCNZ
4493 
4495  {
4496  } // ~Inst_SOPP__S_CBRANCH_VCCNZ
4497 
4498  // --- description from .arch file ---
4499  // if(VCC != 0) then PC = PC + signext(SIMM16 * 4) + 4;
4500  // else NOP.
4501  void
4503  {
4504  Wavefront *wf = gpuDynInst->wavefront();
4505  ConstScalarOperandU64 vcc(gpuDynInst, REG_VCC_LO);
4506 
4507  vcc.read();
4508 
4509  if (vcc.rawData()) {
4510  Addr pc = gpuDynInst->pc();
4511  ScalarRegI16 simm16 = instData.SIMM16;
4512  pc = pc + ((ScalarRegI64)simm16 * 4LL) + 4LL;
4513  wf->pc(pc);
4514  }
4515  } // execute
4516  // --- Inst_SOPP__S_CBRANCH_EXECZ class methods ---
4517 
4519  : Inst_SOPP(iFmt, "s_cbranch_execz")
4520  {
4521  setFlag(Branch);
4522  setFlag(ReadsEXEC);
4523  } // Inst_SOPP__S_CBRANCH_EXECZ
4524 
4526  {
4527  } // ~Inst_SOPP__S_CBRANCH_EXECZ
4528 
4529  // --- description from .arch file ---
4530  // if(EXEC == 0) then PC = PC + signext(SIMM16 * 4) + 4;
4531  // else NOP.
4532  void
4534  {
4535  Wavefront *wf = gpuDynInst->wavefront();
4536 
4537  if (wf->execMask().none()) {
4538  Addr pc = gpuDynInst->pc();
4539  ScalarRegI16 simm16 = instData.SIMM16;
4540  pc = pc + ((ScalarRegI64)simm16 * 4LL) + 4LL;
4541  wf->pc(pc);
4542  }
4543  } // execute
4544  // --- Inst_SOPP__S_CBRANCH_EXECNZ class methods ---
4545 
4547  : Inst_SOPP(iFmt, "s_cbranch_execnz")
4548  {
4549  setFlag(Branch);
4550  setFlag(ReadsEXEC);
4551  } // Inst_SOPP__S_CBRANCH_EXECNZ
4552 
4554  {
4555  } // ~Inst_SOPP__S_CBRANCH_EXECNZ
4556 
4557  // --- description from .arch file ---
4558  // if(EXEC != 0) then PC = PC + signext(SIMM16 * 4) + 4;
4559  // else NOP.
4560  void
4562  {
4563  Wavefront *wf = gpuDynInst->wavefront();
4564 
4565  if (wf->execMask().any()) {
4566  Addr pc = gpuDynInst->pc();
4567  ScalarRegI16 simm16 = instData.SIMM16;
4568  pc = pc + ((ScalarRegI64)simm16 * 4LL) + 4LL;
4569  wf->pc(pc);
4570  }
4571  } // execute
4572  // --- Inst_SOPP__S_BARRIER class methods ---
4573 
4575  : Inst_SOPP(iFmt, "s_barrier")
4576  {
4577  setFlag(MemBarrier);
4578  } // Inst_SOPP__S_BARRIER
4579 
4581  {
4582  } // ~Inst_SOPP__S_BARRIER
4583 
4584  // --- description from .arch file ---
4585  // Synchronize waves within a threadgroup.
4586  // If not all waves of the threadgroup have been created yet, waits for
4587  // entire group before proceeding.
4588  // If some waves in the threadgroup have already terminated, this waits on
4589  // only the surviving waves.
4590  // Barriers are legal inside trap handlers.
4591  void
4593  {
4594  Wavefront *wf = gpuDynInst->wavefront();
4595  ComputeUnit *cu = gpuDynInst->computeUnit();
4596 
4597  if (wf->hasBarrier()) {
4598  int bar_id = wf->barrierId();
4599  assert(wf->getStatus() == Wavefront::S_BARRIER);
4600  cu->incNumAtBarrier(bar_id);
4601  DPRINTF(GPUSync, "CU[%d] WF[%d][%d] Wave[%d] - Stalling at "
4602  "barrier Id%d. %d waves now at barrier, %d waves "
4603  "remain.\n", cu->cu_id, wf->simdId, wf->wfSlotId,
4604  wf->wfDynId, bar_id, cu->numAtBarrier(bar_id),
4605  cu->numYetToReachBarrier(bar_id));
4606  }
4607  } // execute
4608  // --- Inst_SOPP__S_SETKILL class methods ---
4609 
4611  : Inst_SOPP(iFmt, "s_setkill")
4612  {
4613  } // Inst_SOPP__S_SETKILL
4614 
4616  {
4617  } // ~Inst_SOPP__S_SETKILL
4618 
4619  // --- description from .arch file ---
4620  // set KILL bit to value of SIMM16[0].
4621  // Used primarily for debugging kill wave host command behavior.
4622  void
4624  {
4626  } // execute
4627  // --- Inst_SOPP__S_WAITCNT class methods ---
4628 
4630  : Inst_SOPP(iFmt, "s_waitcnt")
4631  {
4632  setFlag(ALU);
4633  setFlag(Waitcnt);
4634  } // Inst_SOPP__S_WAITCNT
4635 
4637  {
4638  } // ~Inst_SOPP__S_WAITCNT
4639 
4640  // --- description from .arch file ---
4641  // Wait for the counts of outstanding lds, vector-memory and
4642  // --- export/vmem-write-data to be at or below the specified levels.
4643  // SIMM16[3:0] = vmcount (vector memory operations),
4644  // SIMM16[6:4] = export/mem-write-data count,
4645  // SIMM16[12:8] = LGKM_cnt (scalar-mem/GDS/LDS count).
4646  void
4648  {
4649  ScalarRegI32 vm_cnt = 0;
4650  ScalarRegI32 exp_cnt = 0;
4651  ScalarRegI32 lgkm_cnt = 0;
4652  vm_cnt = bits<ScalarRegI16>(instData.SIMM16, 3, 0);
4653  exp_cnt = bits<ScalarRegI16>(instData.SIMM16, 6, 4);
4654  lgkm_cnt = bits<ScalarRegI16>(instData.SIMM16, 12, 8);
4655  gpuDynInst->wavefront()->setStatus(Wavefront::S_WAITCNT);
4656  gpuDynInst->wavefront()->setWaitCnts(vm_cnt, exp_cnt, lgkm_cnt);
4657  } // execute
4658  // --- Inst_SOPP__S_SETHALT class methods ---
4659 
4661  : Inst_SOPP(iFmt, "s_sethalt")
4662  {
4663  } // Inst_SOPP__S_SETHALT
4664 
4666  {
4667  } // ~Inst_SOPP__S_SETHALT
4668 
4669  // --- description from .arch file ---
4670  // Set HALT bit to value of SIMM16[0]; 1 = halt, 0 = resume.
4671  // The halt flag is ignored while PRIV == 1 (inside trap handlers) but the
4672  // shader will halt immediately after the handler returns if HALT is still
4673  // set at that time.
4674  void
4676  {
4678  } // execute
4679  // --- Inst_SOPP__S_SLEEP class methods ---
4680 
4682  : Inst_SOPP(iFmt, "s_sleep")
4683  {
4684  setFlag(ALU);
4685  setFlag(Sleep);
4686  } // Inst_SOPP__S_SLEEP
4687 
4689  {
4690  } // ~Inst_SOPP__S_SLEEP
4691 
4692  // --- description from .arch file ---
4693  // Cause a wave to sleep for (64 * SIMM16[2:0] + 1..64) clocks.
4694  // The exact amount of delay is approximate. Compare with S_NOP.
4695  void
4697  {
4699  gpuDynInst->wavefront()->setStatus(Wavefront::S_STALLED_SLEEP);
4700  // sleep duration is specified in multiples of 64 cycles
4701  gpuDynInst->wavefront()->setSleepTime(64 * simm16);
4702  } // execute
4703  // --- Inst_SOPP__S_SETPRIO class methods ---
4704 
4706  : Inst_SOPP(iFmt, "s_setprio")
4707  {
4708  } // Inst_SOPP__S_SETPRIO
4709 
4711  {
4712  } // ~Inst_SOPP__S_SETPRIO
4713 
4714  // --- description from .arch file ---
4715  // User settable wave priority is set to SIMM16[1:0]. 0 = lowest,
4716  // 3 = highest.
4717  // The overall wave priority is {SPIPrio[1:0] + UserPrio[1:0],
4718  // WaveAge[3:0]}.
4719  void
4721  {
4723  } // execute
4724  // --- Inst_SOPP__S_SENDMSG class methods ---
4725 
4727  : Inst_SOPP(iFmt, "s_sendmsg")
4728  {
4729  } // Inst_SOPP__S_SENDMSG
4730 
4732  {
4733  } // ~Inst_SOPP__S_SENDMSG
4734 
4735  // --- description from .arch file ---
4736  // Send a message upstream to VGT or the interrupt handler.
4737  // SIMM16[9:0] contains the message type and is documented in the shader
4738  // --- programming guide.
4739  void
4741  {
4743  } // execute
4744  // --- Inst_SOPP__S_SENDMSGHALT class methods ---
4745 
4747  : Inst_SOPP(iFmt, "s_sendmsghalt")
4748  {
4749  } // Inst_SOPP__S_SENDMSGHALT
4750 
4752  {
4753  } // ~Inst_SOPP__S_SENDMSGHALT
4754 
4755  // --- description from .arch file ---
4756  // Send a message and then HALT the wavefront; see S_SENDMSG for details.
4757  void
4759  {
4761  } // execute
4762  // --- Inst_SOPP__S_TRAP class methods ---
4763 
4765  : Inst_SOPP(iFmt, "s_trap")
4766  {
4767  } // Inst_SOPP__S_TRAP
4768 
4770  {
4771  } // ~Inst_SOPP__S_TRAP
4772 
4773  // --- description from .arch file ---
4774  // TrapID = SIMM16[7:0];
4775  // Wait for all instructions to complete;
4776  // set {TTMP1, TTMP0} = {3'h0, PCRewind[3:0], HT[0], TrapID[7:0],
4777  // PC[47:0]};
4778  // PC = TBA (trap base address);
4779  // PRIV = 1.
4780  // Enter the trap handler. This instruction may be generated internally as
4781  // well in response to a host trap (HT = 1) or an exception.
4782  // TrapID 0 is reserved for hardware use and should not be used in a
4783  // shader-generated trap.
4784  void
4786  {
4788  } // execute
4789  // --- Inst_SOPP__S_ICACHE_INV class methods ---
4790 
4792  : Inst_SOPP(iFmt, "s_icache_inv")
4793  {
4794  } // Inst_SOPP__S_ICACHE_INV
4795 
4797  {
4798  } // ~Inst_SOPP__S_ICACHE_INV
4799 
4800  // --- description from .arch file ---
4801  // Invalidate entire L1 instruction cache.
4802  // You must have 12 separate S_NOP instructions or a jump/branch
4803  // instruction after this instruction
4804  // to ensure the SQ instruction buffer is purged.
4805  void
4807  {
4809  } // execute
4810  // --- Inst_SOPP__S_INCPERFLEVEL class methods ---
4811 
4813  : Inst_SOPP(iFmt, "s_incperflevel")
4814  {
4815  } // Inst_SOPP__S_INCPERFLEVEL
4816 
4818  {
4819  } // ~Inst_SOPP__S_INCPERFLEVEL
4820 
4821  // --- description from .arch file ---
4822  // Increment performance counter specified in SIMM16[3:0] by 1.
4823  void
4825  {
4827  } // execute
4828  // --- Inst_SOPP__S_DECPERFLEVEL class methods ---
4829 
4831  : Inst_SOPP(iFmt, "s_decperflevel")
4832  {
4833  } // Inst_SOPP__S_DECPERFLEVEL
4834 
4836  {
4837  } // ~Inst_SOPP__S_DECPERFLEVEL
4838 
4839  // --- description from .arch file ---
4840  // Decrement performance counter specified in SIMM16[3:0] by 1.
4841  void
4843  {
4845  } // execute
4846  // --- Inst_SOPP__S_TTRACEDATA class methods ---
4847 
4849  : Inst_SOPP(iFmt, "s_ttracedata")
4850  {
4851  } // Inst_SOPP__S_TTRACEDATA
4852 
4854  {
4855  } // ~Inst_SOPP__S_TTRACEDATA
4856 
4857  // --- description from .arch file ---
4858  // Send M0 as user data to the thread trace stream.
4859  void
4861  {
4863  } // execute
4864  // --- Inst_SOPP__S_CBRANCH_CDBGSYS class methods ---
4865 
4867  InFmt_SOPP *iFmt)
4868  : Inst_SOPP(iFmt, "s_cbranch_cdbgsys")
4869  {
4870  setFlag(Branch);
4871  } // Inst_SOPP__S_CBRANCH_CDBGSYS
4872 
4874  {
4875  } // ~Inst_SOPP__S_CBRANCH_CDBGSYS
4876 
4877  // --- description from .arch file ---
4878  // if(conditional_debug_system != 0) then PC = PC + signext(SIMM16 * 4)
4879  // + 4;
4880  // else NOP.
4881  void
4883  {
4885  } // execute
4886  // --- Inst_SOPP__S_CBRANCH_CDBGUSER class methods ---
4887 
4889  InFmt_SOPP *iFmt)
4890  : Inst_SOPP(iFmt, "s_cbranch_cdbguser")
4891  {
4892  setFlag(Branch);
4893  } // Inst_SOPP__S_CBRANCH_CDBGUSER
4894 
4896  {
4897  } // ~Inst_SOPP__S_CBRANCH_CDBGUSER
4898 
4899  // --- description from .arch file ---
4900  // if(conditional_debug_user != 0) then PC = PC + signext(SIMM16 * 4) + 4;
4901  // else NOP.
4902  void
4904  {
4906  } // execute
4907  // --- Inst_SOPP__S_CBRANCH_CDBGSYS_OR_USER class methods ---
4908 
4910  InFmt_SOPP *iFmt)
4911  : Inst_SOPP(iFmt, "s_cbranch_cdbgsys_or_user")
4912  {
4913  setFlag(Branch);
4914  } // Inst_SOPP__S_CBRANCH_CDBGSYS_OR_USER
4915 
4918  {
4919  } // ~Inst_SOPP__S_CBRANCH_CDBGSYS_OR_USER
4920 
4921  // --- description from .arch file ---
4922  // if(conditional_debug_system || conditional_debug_user) then PC = PC +
4923  // --- signext(SIMM16 * 4) + 4;
4924  // else NOP.
4925  void
4927  {
4929  } // execute
4930  // --- Inst_SOPP__S_CBRANCH_CDBGSYS_AND_USER class methods ---
4931 
4934  : Inst_SOPP(iFmt, "s_cbranch_cdbgsys_and_user")
4935  {
4936  setFlag(Branch);
4937  } // Inst_SOPP__S_CBRANCH_CDBGSYS_AND_USER
4938 
4941  {
4942  } // ~Inst_SOPP__S_CBRANCH_CDBGSYS_AND_USER
4943 
4944  // --- description from .arch file ---
4945  // if(conditional_debug_system && conditional_debug_user) then PC = PC +
4946  // --- signext(SIMM16 * 4) + 4;
4947  // else NOP.
4948  void
4950  {
4952  } // execute
4953  // --- Inst_SOPP__S_ENDPGM_SAVED class methods ---
4954 
4956  : Inst_SOPP(iFmt, "s_endpgm_saved")
4957  {
4958  } // Inst_SOPP__S_ENDPGM_SAVED
4959 
4961  {
4962  } // ~Inst_SOPP__S_ENDPGM_SAVED
4963 
4964  // --- description from .arch file ---
4965  // End of program; signal that a wave has been saved by the context-switch
4966  // trap handler and terminate wavefront.
4967  // The hardware implicitly executes S_WAITCNT 0 before executing this
4968  // instruction.
4969  // Use S_ENDPGM in all cases unless you are executing the context-switch
4970  // save handler.
4971  void
4973  {
4975  } // execute
4976  // --- Inst_SOPP__S_SET_GPR_IDX_OFF class methods ---
4977 
4979  InFmt_SOPP *iFmt)
4980  : Inst_SOPP(iFmt, "s_set_gpr_idx_off")
4981  {
4982  } // Inst_SOPP__S_SET_GPR_IDX_OFF
4983 
4985  {
4986  } // ~Inst_SOPP__S_SET_GPR_IDX_OFF
4987 
4988  // --- description from .arch file ---
4989  // MODE.gpr_idx_en = 0.
4990  // Clear GPR indexing mode. Vector operations after this will not perform
4991  // --- relative GPR addressing regardless of the contents of M0. This
4992  // --- instruction does not modify M0.
4993  void
4995  {
4997  } // execute
4998  // --- Inst_SOPP__S_SET_GPR_IDX_MODE class methods ---
4999 
5001  InFmt_SOPP *iFmt)
5002  : Inst_SOPP(iFmt, "s_set_gpr_idx_mode")
5003  {
5004  } // Inst_SOPP__S_SET_GPR_IDX_MODE
5005 
5007  {
5008  } // ~Inst_SOPP__S_SET_GPR_IDX_MODE
5009 
5010  // --- description from .arch file ---
5011  // M0[15:12] = SIMM4.
5012  // Modify the mode used for vector GPR indexing.
5013  // The raw contents of the source field are read and used to set the enable
5014  // bits. SIMM4[0] = VSRC0_REL, SIMM4[1] = VSRC1_REL, SIMM4[2] = VSRC2_REL
5015  // and SIMM4[3] = VDST_REL.
5016  void
5018  {
5020  } // execute
5021  // --- Inst_SMEM__S_LOAD_DWORD class methods ---
5022 
5024  : Inst_SMEM(iFmt, "s_load_dword")
5025  {
5026  setFlag(MemoryRef);
5027  setFlag(Load);
5028  } // Inst_SMEM__S_LOAD_DWORD
5029 
5031  {
5032  } // ~Inst_SMEM__S_LOAD_DWORD
5033 
5040  void
5042  {
5043  Wavefront *wf = gpuDynInst->wavefront();
5044  gpuDynInst->execUnitId = wf->execUnitId;
5045  gpuDynInst->latency.init(gpuDynInst->computeUnit());
5046  gpuDynInst->latency.set(gpuDynInst->computeUnit()->clockPeriod());
5047  ScalarRegU32 offset(0);
5048  ConstScalarOperandU64 addr(gpuDynInst, instData.SBASE << 1);
5049 
5050  addr.read();
5051 
5052  if (instData.IMM) {
5053  offset = extData.OFFSET;
5054  } else {
5055  ConstScalarOperandU32 off_sgpr(gpuDynInst, extData.OFFSET);
5056  off_sgpr.read();
5057  offset = off_sgpr.rawData();
5058  }
5059 
5060  calcAddr(gpuDynInst, addr, offset);
5061 
5062  gpuDynInst->computeUnit()->scalarMemoryPipe
5063  .issueRequest(gpuDynInst);
5064  } // execute
5065 
5066  void
5068  {
5069  initMemRead<1>(gpuDynInst);
5070  } // initiateAcc
5071 
5072  void
5074  {
5075  ScalarOperandU32 sdst(gpuDynInst, instData.SDATA);
5076  sdst.write();
5077  } // completeAcc
5078  // --- Inst_SMEM__S_LOAD_DWORDX2 class methods ---
5079 
5081  : Inst_SMEM(iFmt, "s_load_dwordx2")
5082  {
5083  setFlag(MemoryRef);
5084  setFlag(Load);
5085  } // Inst_SMEM__S_LOAD_DWORDX2
5086 
5088  {
5089  } // ~Inst_SMEM__S_LOAD_DWORDX2
5090 
5095  void
5097  {
5098  Wavefront *wf = gpuDynInst->wavefront();
5099  gpuDynInst->execUnitId = wf->execUnitId;
5100  gpuDynInst->latency.init(gpuDynInst->computeUnit());
5101  gpuDynInst->latency.set(gpuDynInst->computeUnit()->clockPeriod());
5102  ScalarRegU32 offset(0);
5103  ConstScalarOperandU64 addr(gpuDynInst, instData.SBASE << 1);
5104 
5105  addr.read();
5106 
5107  if (instData.IMM) {
5108  offset = extData.OFFSET;
5109  } else {
5110  ConstScalarOperandU32 off_sgpr(gpuDynInst, extData.OFFSET);
5111  off_sgpr.read();
5112  offset = off_sgpr.rawData();
5113  }
5114 
5115  calcAddr(gpuDynInst, addr, offset);
5116 
5117  gpuDynInst->computeUnit()->scalarMemoryPipe.
5118  issueRequest(gpuDynInst);
5119  } // execute
5120 
5121  void
5123  {
5124  initMemRead<2>(gpuDynInst);
5125  } // initiateAcc
5126 
5127  void
5129  {
5130  ScalarOperandU64 sdst(gpuDynInst, instData.SDATA);
5131  sdst.write();
5132  } // completeAcc
5133  // --- Inst_SMEM__S_LOAD_DWORDX4 class methods ---
5134 
5136  : Inst_SMEM(iFmt, "s_load_dwordx4")
5137  {
5138  setFlag(MemoryRef);
5139  setFlag(Load);
5140  } // Inst_SMEM__S_LOAD_DWORDX4
5141 
5143  {
5144  } // ~Inst_SMEM__S_LOAD_DWORDX4
5145 
5146  // --- description from .arch file ---
5147  // Read 4 dwords from scalar data cache. See S_LOAD_DWORD for details on
5148  // the offset input.
5149  void
5151  {
5152  Wavefront *wf = gpuDynInst->wavefront();
5153  gpuDynInst->execUnitId = wf->execUnitId;
5154  gpuDynInst->latency.init(gpuDynInst->computeUnit());
5155  gpuDynInst->latency.set(gpuDynInst->computeUnit()->clockPeriod());
5156  ScalarRegU32 offset(0);
5157  ConstScalarOperandU64 addr(gpuDynInst, instData.SBASE << 1);
5158 
5159  addr.read();
5160 
5161  if (instData.IMM) {
5162  offset = extData.OFFSET;
5163  } else {
5164  ConstScalarOperandU32 off_sgpr(gpuDynInst, extData.OFFSET);
5165  off_sgpr.read();
5166  offset = off_sgpr.rawData();
5167  }
5168 
5169  calcAddr(gpuDynInst, addr, offset);
5170 
5171  gpuDynInst->computeUnit()->scalarMemoryPipe.
5172  issueRequest(gpuDynInst);
5173  } // execute
5174 
5175  void
5177  {
5178  initMemRead<4>(gpuDynInst);
5179  } // initiateAcc
5180 
5181  void
5183  {
5184  ScalarOperandU128 sdst(gpuDynInst, instData.SDATA);
5185  sdst.write();
5186  } // completeAcc
5187  // --- Inst_SMEM__S_LOAD_DWORDX8 class methods ---
5188 
5190  : Inst_SMEM(iFmt, "s_load_dwordx8")
5191  {
5192  setFlag(MemoryRef);
5193  setFlag(Load);
5194  } // Inst_SMEM__S_LOAD_DWORDX8
5195 
5197  {
5198  } // ~Inst_SMEM__S_LOAD_DWORDX8
5199 
5200  // --- description from .arch file ---
5201  // Read 8 dwords from scalar data cache. See S_LOAD_DWORD for details on
5202  // the offset input.
5203  void
5205  {
5206  Wavefront *wf = gpuDynInst->wavefront();
5207  gpuDynInst->execUnitId = wf->execUnitId;
5208  gpuDynInst->latency.init(gpuDynInst->computeUnit());
5209  gpuDynInst->latency.set(gpuDynInst->computeUnit()->clockPeriod());
5210  ScalarRegU32 offset(0);
5211  ConstScalarOperandU64 addr(gpuDynInst, instData.SBASE << 1);
5212 
5213