integer.hh (8229:78bf55f23338) integer.hh (12616:4b463b4dc098)
1/*
2 * Copyright (c) 2009 The University of Edinburgh
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
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

86
87 /* We've pre-shifted the immediate values here */
88 if (a < b) { c += 0x8; }
89 else if (a > b) { c += 0x4; }
90 else { c += 0x2; }
91 return c;
92 }
93
1/*
2 * Copyright (c) 2009 The University of Edinburgh
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
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

86
87 /* We've pre-shifted the immediate values here */
88 if (a < b) { c += 0x8; }
89 else if (a > b) { c += 0x4; }
90 else { c += 0x2; }
91 return c;
92 }
93
94 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
94 std::string generateDisassembly(
95 Addr pc, const SymbolTable *symtab) const override;
95};
96
97
98/**
99 * Class for integer immediate (signed and unsigned) operations.
100 */
101class IntImmOp : public IntOp
102{

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

108 /// Constructor
109 IntImmOp(const char *mnem, MachInst _machInst, OpClass __opClass)
110 : IntOp(mnem, _machInst, __opClass),
111 imm(sext<16>(machInst.si)),
112 uimm(machInst.si)
113 {
114 }
115
96};
97
98
99/**
100 * Class for integer immediate (signed and unsigned) operations.
101 */
102class IntImmOp : public IntOp
103{

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

109 /// Constructor
110 IntImmOp(const char *mnem, MachInst _machInst, OpClass __opClass)
111 : IntOp(mnem, _machInst, __opClass),
112 imm(sext<16>(machInst.si)),
113 uimm(machInst.si)
114 {
115 }
116
116 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
117 std::string generateDisassembly(
118 Addr pc, const SymbolTable *symtab) const override;
117};
118
119
120/**
121 * Class for integer operations with a shift.
122 */
123class IntShiftOp : public IntOp
124{
125 protected:
126
127 uint32_t sh;
128
129 /// Constructor
130 IntShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
131 : IntOp(mnem, _machInst, __opClass),
132 sh(machInst.sh)
133 {
134 }
135
119};
120
121
122/**
123 * Class for integer operations with a shift.
124 */
125class IntShiftOp : public IntOp
126{
127 protected:
128
129 uint32_t sh;
130
131 /// Constructor
132 IntShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
133 : IntOp(mnem, _machInst, __opClass),
134 sh(machInst.sh)
135 {
136 }
137
136 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
138 std::string generateDisassembly(
139 Addr pc, const SymbolTable *symtab) const override;
137};
138
139
140/**
141 * Class for integer rotate operations.
142 */
143class IntRotateOp : public IntShiftOp
144{

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

163
164 uint32_t
165 rotateValue(uint32_t rs, uint32_t shift) const
166 {
167 uint32_t n = shift & 31;
168 return (rs << n) | (rs >> (32 - n));
169 }
170
140};
141
142
143/**
144 * Class for integer rotate operations.
145 */
146class IntRotateOp : public IntShiftOp
147{

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

166
167 uint32_t
168 rotateValue(uint32_t rs, uint32_t shift) const
169 {
170 uint32_t n = shift & 31;
171 return (rs << n) | (rs >> (32 - n));
172 }
173
171 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
174 std::string generateDisassembly(
175 Addr pc, const SymbolTable *symtab) const override;
172};
173
174} // namespace PowerISA
175
176#endif //__ARCH_POWER_INSTS_INTEGER_HH__
176};
177
178} // namespace PowerISA
179
180#endif //__ARCH_POWER_INSTS_INTEGER_HH__