gem5  v22.1.0.0
integer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 The University of Edinburgh
3  * Copyright (c) 2021 IBM Corporation
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __ARCH_POWER_INSTS_INTEGER_HH__
31 #define __ARCH_POWER_INSTS_INTEGER_HH__
32 
34 #include "arch/power/regs/misc.hh"
35 #include "base/bitfield.hh"
36 #include "base/cprintf.hh"
37 
38 namespace gem5
39 {
40 
41 namespace PowerISA
42 {
43 
54 class IntOp : public PowerStaticInst
55 {
56  protected:
57 
58  bool rc;
59  bool oe;
60 
61  // Needed for srawi only
62  uint32_t sh;
63 
65  IntOp(const char *mnem, MachInst _machInst, OpClass __opClass)
66  : PowerStaticInst(mnem, _machInst, __opClass),
67  rc(machInst.rc),
68  oe(machInst.oe)
69  {
70  }
71 
72  /* Compute the CR (condition register) field using signed comparison */
73  inline uint32_t
74  makeCRFieldSigned(int64_t a, int64_t b, bool so) const
75  {
76  Cr cr = 0;
77 
78  if (a < b) { cr.cr0.lt = 1; }
79  else if (a > b) { cr.cr0.gt = 1; }
80  else { cr.cr0.eq = 1; }
81  if (so) { cr.cr0.so = 1; }
82 
83  return cr.cr0;
84  }
85 
86  /* Compute the CR (condition register) field using unsigned comparison */
87  inline uint32_t
88  makeCRFieldUnsigned(uint64_t a, uint64_t b, bool so) const
89  {
90  Cr cr = 0;
91 
92  if (a < b) { cr.cr0.lt = 1; }
93  else if (a > b) { cr.cr0.gt = 1; }
94  else { cr.cr0.eq = 1; }
95  if (so) { cr.cr0.so = 1; }
96 
97  return cr.cr0;
98  }
99 
100  std::string generateDisassembly(
101  Addr pc, const loader::SymbolTable *symtab) const override;
102 };
103 
104 
108 class IntImmOp : public IntOp
109 {
110  protected:
111 
112  int32_t si;
113  uint32_t ui;
114 
116  IntImmOp(const char *mnem, MachInst _machInst, OpClass __opClass)
117  : IntOp(mnem, _machInst, __opClass),
118  si(sext<16>(machInst.si)),
119  ui(machInst.si)
120  {
121  }
122 
123  std::string generateDisassembly(
124  Addr pc, const loader::SymbolTable *symtab) const override;
125 };
126 
127 
131 class IntArithOp : public IntOp
132 {
133  protected:
134 
136  IntArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
137  : IntOp(mnem, _machInst, __opClass)
138  {
139  }
140 
141  /* Compute 128-bit sum of 128-bit to 64-bit unsigned integer addition */
142  inline std::tuple<uint64_t, uint64_t>
143  add(uint64_t ralo, uint64_t rahi, uint64_t rb) const
144  {
145  uint64_t slo, shi;
146  #if defined(__SIZEOF_INT128__)
147  __uint128_t ra = ((__uint128_t)rahi << 64) | ralo;
148  __uint128_t sum = ra + rb;
149  slo = sum;
150  shi = sum >> 64;
151  #else
152  shi = rahi + ((ralo + rb) < ralo);
153  slo = ralo + rb;
154  #endif
155  return std::make_tuple(slo, shi);
156  }
157 
158  /* Compute 128-bit sum of 128-bit to 64-bit signed integer addition */
159  inline std::tuple<uint64_t, int64_t>
160  add(uint64_t ralo, int64_t rahi, int64_t rb) const
161  {
162  uint64_t slo;
163  int64_t shi;
164  #if defined(__SIZEOF_INT128__)
165  __int128_t ra = ((__int128_t)rahi << 64) | ralo;
166  __int128_t sum = (__int128_t)ra + rb;
167  slo = sum;
168  shi = sum >> 64;
169  #else
170  if (rb < 0) {
171  shi = rahi - 1;
172  slo = ralo + rb;
173  if (slo < rb) {
174  shi++;
175  }
176  } else {
177  shi = rahi;
178  slo = ralo + rb;
179  if (slo < rb) {
180  shi++;
181  }
182  }
183  #endif
184  return std::make_tuple(slo, shi);
185  }
186 
191  inline std::tuple<uint64_t, uint64_t>
192  multiply(uint64_t ra, uint64_t rb) const
193  {
194  uint64_t plo, phi;
195  #if defined(__SIZEOF_INT128__)
196  __uint128_t prod = (__uint128_t)ra * rb;
197  plo = prod;
198  phi = prod >> 64;
199  #else
200  uint64_t ralo = (uint32_t)ra, rahi = ra >> 32;
201  uint64_t rblo = (uint32_t)rb, rbhi = rb >> 32;
202  uint64_t pp0 = ralo * rblo;
203  uint64_t pp1 = rahi * rblo;
204  uint64_t pp2 = ralo * rbhi;
205  uint64_t pp3 = rahi * rbhi;
206  uint64_t c = ((uint32_t)pp1) + ((uint32_t)pp2) + (pp0 >> 32);
207  phi = pp3 + (pp2 >> 32) + (pp1 >> 32) + (c >> 32);
208  plo = (c << 32) | ((uint32_t)pp0);
209  #endif
210  return std::make_tuple(plo, phi);
211  }
212 
213  /* Compute 128-bit product of 64-bit signed integer multiplication */
214  inline std::tuple<uint64_t, int64_t>
215  multiply(int64_t ra, int64_t rb) const
216  {
217  uint64_t plo, phi;
218  #if defined(__SIZEOF_INT128__)
219  __int128_t prod = (__int128_t)ra * rb;
220  plo = prod;
221  phi = prod >> 64;
222  #else
223  std::tie(plo, phi) = multiply((uint64_t)ra, (uint64_t)rb);
224  if (rb < 0) phi -= (uint64_t)ra;
225  if (ra < 0) phi -= (uint64_t)rb;
226  #endif
227  return std::make_tuple(plo, (int64_t)phi);
228  }
229 
234  inline std::tuple<uint64_t, uint64_t>
235  multiplyAdd(uint64_t ra, uint64_t rb, uint64_t rc) const
236  {
237  uint64_t rlo, rhi;
238  #if defined(__SIZEOF_INT128__)
239  __uint128_t res = ((__uint128_t)ra * rb) + rc;
240  rlo = res;
241  rhi = res >> 64;
242  #else
243  uint64_t plo, phi;
244  std::tie(plo, phi) = multiply(ra, rb);
245  std::tie(rlo, rhi) = add(plo, phi, rc);
246  #endif
247  return std::make_tuple(rlo, rhi);
248  }
249 
254  inline std::tuple<uint64_t, int64_t>
255  multiplyAdd(int64_t ra, int64_t rb, int64_t rc) const
256  {
257  uint64_t rlo;
258  int64_t rhi;
259  #if defined(__SIZEOF_INT128__)
260  __int128_t res = (__int128_t)ra * rb + rc;
261  rlo = res;
262  rhi = res >> 64;
263  #else
264  uint64_t plo;
265  int64_t phi;
266  std::tie(plo, phi) = multiply(ra, rb);
267  std::tie(rlo, rhi) = add(plo, phi, rc);
268  #endif
269  return std::make_tuple(rlo, rhi);
270  }
271 
277  inline std::tuple<bool, uint64_t, uint64_t>
278  divide(uint64_t ralo, uint64_t rahi, uint64_t rb) const
279  {
280  bool ov;
281  uint64_t q, r;
282  #if defined(__SIZEOF_INT128__)
283  if (rb == 0) {
284  ov = true;
285  } else {
286  __uint128_t ra = ((__uint128_t)rahi << 64) | ralo;
287  __uint128_t res = ra / rb;
288  q = res;
289  r = ra % rb;
290  ov = res > UINT64_MAX;
291  }
292  #else
293  uint64_t c = 0;
294 
295  if (rb == 0) {
296  ov = true;
297  } else if (rahi == 0) {
298  q = ralo / rb;
299  r = ralo % rb;
300  ov = false;
301  } else if (rahi >= rb) {
302  ov = true;
303  } else {
304  for (int i = 0; i < 64; ++i) {
305  c = rahi >> 63;
306  rahi = (rahi << 1) | (ralo >> 63);
307  if (c || (rahi >= rb)) {
308  rahi -= rb;
309  c = 1;
310  } else {
311  c = 0;
312  }
313  ralo = (ralo << 1) | c;
314  }
315  q = ralo;
316  r = rahi;
317  ov = false;
318  }
319  #endif
320  return std::make_tuple(ov, q, r);
321  }
322 
327  inline std::tuple<bool, int64_t, int64_t>
328  divide(uint64_t ralo, int64_t rahi, int64_t rb) const
329  {
330  bool ov;
331  int64_t q, r;
332  #if defined(__SIZEOF_INT128__)
333  if (rb == 0) {
334  ov = true;
335  } else {
336  __int128_t ra = ((__int128_t)rahi << 64) | ralo;
337  __int128_t res = ra / rb;
338  q = res;
339  r = ra % rb;
340  ov = res != q;
341  }
342  #else
343  bool raneg = rahi < 0;
344  bool rbneg = rb < 0;
345 
346  if (raneg) {
347  ralo = ~(ralo);
348  rahi = ~(rahi);
349  if (ralo == -1ULL) {
350  ralo = 0;
351  rahi++;
352  } else {
353  ralo++;
354  }
355  }
356 
357  if (rbneg) rb = -rb;
358  std::tie(ov, q, r) = divide(ralo, (uint64_t)rahi, (uint64_t)rb);
359  if (raneg ^ rbneg) q = -q;
360  if (raneg) r = -r;
361  if (!ov) ov = ((q < 0) ^ (raneg ^ rbneg));
362  #endif
363  return std::make_tuple(ov, q, r);
364  }
365 
366  std::string generateDisassembly(
367  Addr pc, const loader::SymbolTable *symtab) const override;
368 };
369 
370 
374 class IntImmArithOp : public IntArithOp
375 {
376  protected:
377 
378  int32_t si;
379 
381  IntImmArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
382  : IntArithOp(mnem, _machInst, __opClass),
383  si(sext<16>(machInst.si))
384  {
385  }
386 
387  std::string generateDisassembly(
388  Addr pc, const loader::SymbolTable *symtab) const override;
389 };
390 
391 
396 {
397  protected:
398 
399  int64_t d;
400 
402  IntDispArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
403  : IntArithOp(mnem, _machInst, __opClass),
404  d(sext<16>((machInst.d0 << 6) | (machInst.d1 << 1) | machInst.d2))
405  {
406  }
407 
408  std::string generateDisassembly(
409  Addr pc, const loader::SymbolTable *symtab) const override;
410 };
411 
412 
416 class IntCompOp : public IntOp
417 {
418  protected:
419 
420  bool l;
421  uint8_t bf;
422 
424  IntCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
425  : IntOp(mnem, _machInst, __opClass),
426  l(machInst.l),
427  bf(machInst.bf)
428  {
429  }
430 
431  std::string generateDisassembly(
432  Addr pc, const loader::SymbolTable *symtab) const override;
433 };
434 
435 
439 class IntImmCompOp : public IntCompOp
440 {
441  protected:
442 
443  int32_t si;
444 
446  IntImmCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
447  : IntCompOp(mnem, _machInst, __opClass),
448  si(sext<16>(machInst.si))
449  {
450  }
451 
452  std::string generateDisassembly(
453  Addr pc, const loader::SymbolTable *symtab) const override;
454 };
455 
456 
461 {
462  protected:
463 
464  uint32_t ui;
465 
467  IntImmCompLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
468  : IntCompOp(mnem, _machInst, __opClass),
469  ui(machInst.ui)
470  {
471  }
472 
473  std::string generateDisassembly(
474  Addr pc, const loader::SymbolTable *symtab) const override;
475 };
476 
477 
481 class IntLogicOp : public IntOp
482 {
483  protected:
484 
486  IntLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
487  : IntOp(mnem, _machInst, __opClass)
488  {
489  }
490 
491  /* Compute the number of consecutive zero bits starting from the
492  leftmost bit and moving right in a 32-bit integer */
493  inline int
494  findLeadingZeros(uint32_t rs) const
495  {
496  if (rs) {
497  #if defined(__GNUC__) || (defined(__clang__) && \
498  __has_builtin(__builtin_clz))
499  return __builtin_clz(rs);
500  #else
501  return 31 - findMsbSet(rs);
502  #endif
503  } else {
504  return 32;
505  }
506  }
507 
508  /* Compute the number of consecutive zero bits starting from the
509  leftmost bit and moving right in a 64-bit integer */
510  inline int
511  findLeadingZeros(uint64_t rs) const
512  {
513  if (rs) {
514  #if defined(__GNUC__) || (defined(__clang__) && \
515  __has_builtin(__builtin_clzll))
516  return __builtin_clzll(rs);
517  #else
518  return 63 - findMsbSet(rs);
519  #endif
520  } else {
521  return 64;
522  }
523  }
524 
525  /* Compute the number of consecutive zero bits starting from the
526  rightmost bit and moving left in a 32-bit integer */
527  inline int
528  findTrailingZeros(uint32_t rs) const
529  {
530  if (rs) {
531  #if defined(__GNUC__) || (defined(__clang__) && \
532  __has_builtin(__builtin_ctz))
533  return __builtin_ctz(rs);
534  #else
535  return findLsbSet(rs);
536  #endif
537  } else {
538  return 32;
539  }
540  }
541 
542  /* Compute the number of consecutive zero bits starting from the
543  rightmost bit and moving left in a 64-bit integer */
544  inline int
545  findTrailingZeros(uint64_t rs) const
546  {
547  if (rs) {
548  #if defined(__GNUC__) || (defined(__clang__) && \
549  __has_builtin(__builtin_ctzll))
550  return __builtin_ctzll(rs);
551  #else
552  return findLsbSet(rs);
553  #endif
554  } else {
555  return 64;
556  }
557  }
558 
559  std::string generateDisassembly(
560  Addr pc, const loader::SymbolTable *symtab) const override;
561 };
562 
563 
567 class IntImmLogicOp : public IntLogicOp
568 {
569  protected:
570 
571  uint32_t ui;
572 
574  IntImmLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
575  : IntLogicOp(mnem, _machInst, __opClass),
576  ui(machInst.ui)
577  {
578  }
579 
580  std::string generateDisassembly(
581  Addr pc, const loader::SymbolTable *symtab) const override;
582 };
583 
584 
589 class IntShiftOp : public IntOp
590 {
591  protected:
592 
593  uint8_t sh;
594 
596  IntShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
597  : IntOp(mnem, _machInst, __opClass),
598  sh(machInst.sh)
599  {
600  }
601 
602  std::string generateDisassembly(
603  Addr pc, const loader::SymbolTable *symtab) const override;
604 };
605 
606 
611 class IntConcatShiftOp : public IntOp
612 {
613  protected:
614 
615  uint8_t sh;
616 
618  IntConcatShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
619  : IntOp(mnem, _machInst, __opClass),
620  sh((machInst.shn << 5) | machInst.sh)
621  {
622  }
623 
624  std::string generateDisassembly(
625  Addr pc, const loader::SymbolTable *symtab) const override;
626 };
627 
628 
634 class IntRotateOp : public IntShiftOp
635 {
636  protected:
637 
638  uint8_t mb;
639  uint8_t me;
640 
642  IntRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
643  : IntShiftOp(mnem, _machInst, __opClass),
644  mb(machInst.mb),
645  me(machInst.me)
646  {
647  }
648 
649  inline uint64_t
650  rotate(uint32_t value, uint32_t shift) const
651  {
652  uint64_t res;
653  shift = shift & 0x1f;
654  res = value;
655  res = (res << 32) | res;
656  res = (res << shift) | (res >> (32 - shift));
657  return res;
658  }
659 
660  inline uint64_t
661  bitmask(uint32_t begin, uint32_t end) const
662  {
663  begin = begin & 0x1f;
664  end = end & 0x1f;
665  if (begin <= end) {
666  return mask(31 - begin, 31 - end);
667  } else {
668  return ~mask(31 - (end + 1), 31 - (begin - 1));
669  }
670  }
671 
672  std::string generateDisassembly(
673  Addr pc, const loader::SymbolTable *symtab) const override;
674 };
675 
676 
683 {
684  protected:
685 
686  uint8_t mb;
687  uint8_t me;
688 
690  IntConcatRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
691  : IntConcatShiftOp(mnem, _machInst, __opClass),
692  mb((machInst.mbn << 5) | machInst.mb),
693  me((machInst.men << 5) | machInst.mb)
694  {
695  }
696 
697  inline uint64_t
698  rotate(uint64_t value, uint32_t shift) const
699  {
700  shift = shift & 0x3f;
701  return (value << shift) | (value >> (64 - shift));
702  }
703 
704  inline uint64_t
705  bitmask(uint32_t begin, uint32_t end) const
706  {
707  begin = begin & 0x3f;
708  end = end & 0x3f;
709  if (begin <= end) {
710  return mask(63 - begin, 63 - end);
711  } else {
712  return ~mask(63 - (end + 1), 63 - (begin - 1));
713  }
714  }
715 
716  std::string generateDisassembly(
717  Addr pc, const loader::SymbolTable *symtab) const override;
718 };
719 
720 
724 class IntTrapOp : public IntOp
725 {
726  protected:
727  uint8_t to;
728 
730  IntTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
731  : IntOp(mnem, _machInst, __opClass),
732  to(machInst.to)
733  {
734  }
735 
736  inline bool
737  checkTrap(int64_t a, int64_t b) const
738  {
739  if (((to & 0x10) && (a < b)) ||
740  ((to & 0x08) && (a > b)) ||
741  ((to & 0x04) && (a == b)) ||
742  ((to & 0x02) && ((uint64_t)a < (uint64_t)b)) ||
743  ((to & 0x01) && ((uint64_t)a > (uint64_t)b))) {
744  return true;
745  }
746 
747  return false;
748  }
749 
750  inline std::string
751  suffix() const
752  {
753  std::string str;
754 
755  switch (to) {
756  case 1: str = "lgt"; break;
757  case 2: str = "llt"; break;
758  case 4: str = "eq"; break;
759  case 5: str = "lge"; break;
760  case 6: str = "lle"; break;
761  case 8: str = "gt"; break;
762  case 12: str = "ge"; break;
763  case 16: str = "lt"; break;
764  case 20: str = "le"; break;
765  case 24: str = "ne"; break;
766  case 31: str = "u"; break;
767  }
768 
769  return str;
770  }
771 
772  std::string generateDisassembly(
773  Addr pc, const loader::SymbolTable *symtab) const override;
774 };
775 
776 
780 class IntImmTrapOp : public IntTrapOp
781 {
782  protected:
783  int32_t si;
784 
786  IntImmTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
787  : IntTrapOp(mnem, _machInst, __opClass),
788  si(sext<16>(machInst.si))
789  {
790  }
791 
792  std::string generateDisassembly(
793  Addr pc, const loader::SymbolTable *symtab) const override;
794 };
795 
796 } // namespace PowerISA
797 } // namespace gem5
798 
799 #endif //__ARCH_POWER_INSTS_INTEGER_HH__
Class for integer arithmetic operations.
Definition: integer.hh:132
std::tuple< bool, int64_t, int64_t > divide(uint64_t ralo, int64_t rahi, int64_t rb) const
Compute overflow, 64-bit quotient and 64-bit remainder of 128-bit by 64-bit signed integer division.
Definition: integer.hh:328
IntArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:136
std::tuple< uint64_t, int64_t > add(uint64_t ralo, int64_t rahi, int64_t rb) const
Definition: integer.hh:160
std::tuple< uint64_t, int64_t > multiplyAdd(int64_t ra, int64_t rb, int64_t rc) const
Compute 128-bit result of 64-bit signed integer multiplication followed by addition.
Definition: integer.hh:255
std::tuple< uint64_t, int64_t > multiply(int64_t ra, int64_t rb) const
Definition: integer.hh:215
std::tuple< bool, uint64_t, uint64_t > divide(uint64_t ralo, uint64_t rahi, uint64_t rb) const
Compute overflow, 64-bit quotient and 64-bit remainder of 128-bit by 64-bit unsigned integer division...
Definition: integer.hh:278
std::tuple< uint64_t, uint64_t > multiplyAdd(uint64_t ra, uint64_t rb, uint64_t rc) const
Compute 128-bit result of 64-bit unsigned integer multiplication followed by addition.
Definition: integer.hh:235
std::tuple< uint64_t, uint64_t > multiply(uint64_t ra, uint64_t rb) const
Compute 128-bit product of 64-bit unsigned integer multiplication based on https://stackoverflow....
Definition: integer.hh:192
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:119
std::tuple< uint64_t, uint64_t > add(uint64_t ralo, uint64_t rahi, uint64_t rb) const
Definition: integer.hh:143
Class for integer compare operations.
Definition: integer.hh:417
IntCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:424
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:394
Class for integer rotate operations with a shift amount obtained from a register or by concatenating ...
Definition: integer.hh:683
IntConcatRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:690
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:753
uint64_t bitmask(uint32_t begin, uint32_t end) const
Definition: integer.hh:705
uint64_t rotate(uint64_t value, uint32_t shift) const
Definition: integer.hh:698
Class for integer shift operations with a shift value obtained from a register or by concatenating im...
Definition: integer.hh:612
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:606
IntConcatShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:618
Class for integer arithmetic operations with displacement.
Definition: integer.hh:396
IntDispArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:402
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:237
Class for integer immediate arithmetic operations.
Definition: integer.hh:375
IntImmArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:381
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:177
Class for integer immediate compare logical operations.
Definition: integer.hh:461
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:496
IntImmCompLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:467
Class for integer immediate compare operations.
Definition: integer.hh:440
IntImmCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:446
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:447
Class for integer immediate logical operations.
Definition: integer.hh:568
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:346
IntImmLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:574
Class for integer immediate (signed and unsigned) operations.
Definition: integer.hh:109
IntImmOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:116
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:94
Class for integer immediate trap operations.
Definition: integer.hh:781
IntImmTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:786
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:885
Class for integer logical operations.
Definition: integer.hh:482
int findLeadingZeros(uint64_t rs) const
Definition: integer.hh:511
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:282
IntLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:486
int findTrailingZeros(uint64_t rs) const
Definition: integer.hh:545
int findLeadingZeros(uint32_t rs) const
Definition: integer.hh:494
int findTrailingZeros(uint32_t rs) const
Definition: integer.hh:528
We provide a base class for integer operations and then inherit for several other classes.
Definition: integer.hh:55
uint32_t makeCRFieldUnsigned(uint64_t a, uint64_t b, bool so) const
Definition: integer.hh:88
uint32_t makeCRFieldSigned(int64_t a, int64_t b, bool so) const
Definition: integer.hh:74
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:38
IntOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:65
Class for integer rotate operations with a shift amount obtained from a register or an immediate and ...
Definition: integer.hh:635
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:668
uint64_t bitmask(uint32_t begin, uint32_t end) const
Definition: integer.hh:661
uint64_t rotate(uint32_t value, uint32_t shift) const
Definition: integer.hh:650
IntRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:642
Class for integer operations with a shift value obtained from a register or an instruction field.
Definition: integer.hh:590
IntShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:596
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:545
Class for integer trap operations.
Definition: integer.hh:725
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:834
std::string suffix() const
Definition: integer.hh:751
bool checkTrap(int64_t a, int64_t b) const
Definition: integer.hh:737
IntTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:730
constexpr int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
Definition: bitfield.hh:260
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
constexpr uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
Definition: bitfield.hh:126
constexpr int findLsbSet(uint64_t val)
Returns the bit position of the LSB that is set in the input.
Definition: bitfield.hh:296
Bitfield< 7 > b
Definition: misc_types.hh:388
Bitfield< 27 > q
Definition: misc_types.hh:55
Bitfield< 7 > i
Definition: misc_types.hh:67
Bitfield< 8 > a
Definition: misc_types.hh:66
Bitfield< 6, 5 > shift
Definition: types.hh:117
Bitfield< 4 > pc
constexpr RegId Cr
Definition: int.hh:138
Bitfield< 28 > so
Definition: misc.hh:59
Bitfield< 5 > men
Definition: types.hh:58
Bitfield< 20, 16 > d1
Definition: types.hh:66
Bitfield< 30 > ov
Definition: misc.hh:66
uint32_t MachInst
Definition: types.hh:44
Bitfield< 20, 16 > ra
Definition: types.hh:50
Bitfield< 1 > shn
Definition: types.hh:54
Bitfield< 15, 6 > d0
Definition: types.hh:65
Bitfield< 5 > mbn
Definition: types.hh:56
Bitfield< 1, 0 > d2
Definition: types.hh:67
Bitfield< 18 > sum
Definition: misc.hh:560
Bitfield< 5 > r
Definition: pagetable.hh:60
Bitfield< 2 > c
Definition: pagetable.hh:63
static RegIndex cr(int index)
Definition: misc.hh:421
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147

Generated on Wed Dec 21 2022 10:22:27 for gem5 by doxygen 1.9.1