base.isa (3980:9bcb2a2e9bb8) base.isa (4004:d551cf1bba0d)
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 53 unchanged lines hidden (view full) ---

62 CarryClear=0xD,
63 CarrySet=0x5,
64 Positive=0xE,
65 Negative=0x6,
66 OverflowClear=0xF,
67 OverflowSet=0x7
68 };
69
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 53 unchanged lines hidden (view full) ---

62 CarryClear=0xD,
63 CarrySet=0x5,
64 Positive=0xE,
65 Negative=0x6,
66 OverflowClear=0xF,
67 OverflowSet=0x7
68 };
69
70 enum FpCondTest
71 {
72 FAlways=0x8,
73 FNever=0x0,
74 FUnordered=0x7,
75 FGreater=0x6,
76 FUnorderedOrGreater=0x5,
77 FLess=0x4,
78 FUnorderedOrLess=0x3,
79 FLessOrGreater=0x2,
80 FNotEqual=0x1,
81 FEqual=0x9,
82 FUnorderedOrEqual=0xA,
83 FGreaterOrEqual=0xB,
84 FUnorderedOrGreaterOrEqual=0xC,
85 FLessOrEqual=0xD,
86 FUnorderedOrLessOrEqual=0xE,
87 FOrdered=0xF
88 };
89
70 extern char * CondTestAbbrev[];
71
72 /**
73 * Base class for all SPARC static instructions.
74 */
75 class SparcStaticInst : public StaticInst
76 {
77 protected:

--- 10 unchanged lines hidden (view full) ---

88 void printReg(std::ostream &os, int reg) const;
89 void printSrcReg(std::ostream &os, int reg) const;
90 void printDestReg(std::ostream &os, int reg) const;
91
92 void printRegArray(std::ostream &os,
93 const RegIndex indexArray[], int num) const;
94 };
95
90 extern char * CondTestAbbrev[];
91
92 /**
93 * Base class for all SPARC static instructions.
94 */
95 class SparcStaticInst : public StaticInst
96 {
97 protected:

--- 10 unchanged lines hidden (view full) ---

108 void printReg(std::ostream &os, int reg) const;
109 void printSrcReg(std::ostream &os, int reg) const;
110 void printDestReg(std::ostream &os, int reg) const;
111
112 void printRegArray(std::ostream &os,
113 const RegIndex indexArray[], int num) const;
114 };
115
116 bool passesFpCondition(uint32_t fcc, uint32_t condition);
117
96 bool passesCondition(uint32_t codes, uint32_t condition);
97
98 inline int64_t sign_ext(uint64_t data, int origWidth)
99 {
100 int shiftAmount = 64 - origWidth;
101 return (((int64_t)data) << shiftAmount) >> shiftAmount;
102 }
103}};

--- 258 unchanged lines hidden (view full) ---

362 if(_numSrcRegs > 0)
363 ss << ",";
364 printReg(ss, _destRegIdx[0]);
365 }
366
367 return ss.str();
368 }
369
118 bool passesCondition(uint32_t codes, uint32_t condition);
119
120 inline int64_t sign_ext(uint64_t data, int origWidth)
121 {
122 int shiftAmount = 64 - origWidth;
123 return (((int64_t)data) << shiftAmount) >> shiftAmount;
124 }
125}};

--- 258 unchanged lines hidden (view full) ---

384 if(_numSrcRegs > 0)
385 ss << ",";
386 printReg(ss, _destRegIdx[0]);
387 }
388
389 return ss.str();
390 }
391
392 bool passesFpCondition(uint32_t fcc, uint32_t condition)
393 {
394 bool u = (fcc == 3);
395 bool g = (fcc == 2);
396 bool l = (fcc == 1);
397 bool e = (fcc == 0);
398 switch(condition)
399 {
400 case FAlways:
401 return 1;
402 case FNever:
403 return 0;
404 case FUnordered:
405 return u;
406 case FGreater:
407 return g;
408 case FUnorderedOrGreater:
409 return u || g;
410 case FLess:
411 return l;
412 case FUnorderedOrLess:
413 return u || l;
414 case FLessOrGreater:
415 return l || g;
416 case FNotEqual:
417 return l || g || u;
418 case FEqual:
419 return e;
420 case FUnorderedOrEqual:
421 return u || e;
422 case FGreaterOrEqual:
423 return g || e;
424 case FUnorderedOrGreaterOrEqual:
425 return u || g || e;
426 case FLessOrEqual:
427 return l || e;
428 case FUnorderedOrLessOrEqual:
429 return u || l || e;
430 case FOrdered:
431 return e || l || g;
432 }
433 panic("Tried testing condition nonexistant "
434 "condition code %d", condition);
435 }
436
370 bool passesCondition(uint32_t codes, uint32_t condition)
371 {
372 CondCodes condCodes;
373 condCodes.bits = 0;
374 condCodes.c = codes & 0x1 ? 1 : 0;
375 condCodes.v = codes & 0x2 ? 1 : 0;
376 condCodes.z = codes & 0x4 ? 1 : 0;
377 condCodes.n = codes & 0x8 ? 1 : 0;

--- 65 unchanged lines hidden ---
437 bool passesCondition(uint32_t codes, uint32_t condition)
438 {
439 CondCodes condCodes;
440 condCodes.bits = 0;
441 condCodes.c = codes & 0x1 ? 1 : 0;
442 condCodes.v = codes & 0x2 ? 1 : 0;
443 condCodes.z = codes & 0x4 ? 1 : 0;
444 condCodes.n = codes & 0x8 ? 1 : 0;

--- 65 unchanged lines hidden ---