misc.isa (7257:272f94a04b54) misc.isa (7261:5ed14bce7261)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2010 ARM Limited
4// All rights reserved
5//
6// The license below extends only to copyright in the software and shall
7// not be construed as granting a license to any other intellectual
8// property including but not limited to intellectual property relating

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

117 header_output += MsrImmDeclare.subst(msrSpsrImmIop)
118 decoder_output += MsrImmConstructor.subst(msrSpsrImmIop)
119 exec_output += PredOpExecute.subst(msrSpsrImmIop)
120
121 revCode = '''
122 uint32_t val = Op1;
123 Dest = swap_byte(val);
124 '''
1// -*- mode:c++ -*-
2
3// Copyright (c) 2010 ARM Limited
4// All rights reserved
5//
6// The license below extends only to copyright in the software and shall
7// not be construed as granting a license to any other intellectual
8// property including but not limited to intellectual property relating

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

117 header_output += MsrImmDeclare.subst(msrSpsrImmIop)
118 decoder_output += MsrImmConstructor.subst(msrSpsrImmIop)
119 exec_output += PredOpExecute.subst(msrSpsrImmIop)
120
121 revCode = '''
122 uint32_t val = Op1;
123 Dest = swap_byte(val);
124 '''
125 revIop = InstObjParams("rev", "Rev", "RevOp",
125 revIop = InstObjParams("rev", "Rev", "RegRegOp",
126 { "code": revCode,
127 "predicate_test": predicateTest }, [])
126 { "code": revCode,
127 "predicate_test": predicateTest }, [])
128 header_output += RevOpDeclare.subst(revIop)
129 decoder_output += RevOpConstructor.subst(revIop)
128 header_output += RegRegOpDeclare.subst(revIop)
129 decoder_output += RegRegOpConstructor.subst(revIop)
130 exec_output += PredOpExecute.subst(revIop)
131
132 rev16Code = '''
133 uint32_t val = Op1;
134 Dest = (bits(val, 15, 8) << 0) |
135 (bits(val, 7, 0) << 8) |
136 (bits(val, 31, 24) << 16) |
137 (bits(val, 23, 16) << 24);
138 '''
130 exec_output += PredOpExecute.subst(revIop)
131
132 rev16Code = '''
133 uint32_t val = Op1;
134 Dest = (bits(val, 15, 8) << 0) |
135 (bits(val, 7, 0) << 8) |
136 (bits(val, 31, 24) << 16) |
137 (bits(val, 23, 16) << 24);
138 '''
139 rev16Iop = InstObjParams("rev16", "Rev16", "RevOp",
139 rev16Iop = InstObjParams("rev16", "Rev16", "RegRegOp",
140 { "code": rev16Code,
141 "predicate_test": predicateTest }, [])
140 { "code": rev16Code,
141 "predicate_test": predicateTest }, [])
142 header_output += RevOpDeclare.subst(rev16Iop)
143 decoder_output += RevOpConstructor.subst(rev16Iop)
142 header_output += RegRegOpDeclare.subst(rev16Iop)
143 decoder_output += RegRegOpConstructor.subst(rev16Iop)
144 exec_output += PredOpExecute.subst(rev16Iop)
145
146 revshCode = '''
147 uint16_t val = Op1;
148 Dest = sext<16>(swap_byte(val));
149 '''
144 exec_output += PredOpExecute.subst(rev16Iop)
145
146 revshCode = '''
147 uint16_t val = Op1;
148 Dest = sext<16>(swap_byte(val));
149 '''
150 revshIop = InstObjParams("revsh", "Revsh", "RevOp",
150 revshIop = InstObjParams("revsh", "Revsh", "RegRegOp",
151 { "code": revshCode,
152 "predicate_test": predicateTest }, [])
151 { "code": revshCode,
152 "predicate_test": predicateTest }, [])
153 header_output += RevOpDeclare.subst(revshIop)
154 decoder_output += RevOpConstructor.subst(revshIop)
153 header_output += RegRegOpDeclare.subst(revshIop)
154 decoder_output += RegRegOpConstructor.subst(revshIop)
155 exec_output += PredOpExecute.subst(revshIop)
156
157 rbitCode = '''
158 uint8_t *opBytes = (uint8_t *)&Op1;
159 uint32_t resTemp;
160 uint8_t *destBytes = (uint8_t *)&resTemp;
161 // This reverses the bytes and bits of the input, or so says the
162 // internet.
163 for (int i = 0; i < 4; i++) {
164 uint32_t temp = opBytes[i];
165 temp = (temp * 0x0802 & 0x22110) | (temp * 0x8020 & 0x88440);
166 destBytes[3 - i] = (temp * 0x10101) >> 16;
167 }
168 Dest = resTemp;
169 '''
155 exec_output += PredOpExecute.subst(revshIop)
156
157 rbitCode = '''
158 uint8_t *opBytes = (uint8_t *)&Op1;
159 uint32_t resTemp;
160 uint8_t *destBytes = (uint8_t *)&resTemp;
161 // This reverses the bytes and bits of the input, or so says the
162 // internet.
163 for (int i = 0; i < 4; i++) {
164 uint32_t temp = opBytes[i];
165 temp = (temp * 0x0802 & 0x22110) | (temp * 0x8020 & 0x88440);
166 destBytes[3 - i] = (temp * 0x10101) >> 16;
167 }
168 Dest = resTemp;
169 '''
170 rbitIop = InstObjParams("rbit", "Rbit", "RevOp",
170 rbitIop = InstObjParams("rbit", "Rbit", "RegRegOp",
171 { "code": rbitCode,
172 "predicate_test": predicateTest }, [])
171 { "code": rbitCode,
172 "predicate_test": predicateTest }, [])
173 header_output += RevOpDeclare.subst(rbitIop)
174 decoder_output += RevOpConstructor.subst(rbitIop)
173 header_output += RegRegOpDeclare.subst(rbitIop)
174 decoder_output += RegRegOpConstructor.subst(rbitIop)
175 exec_output += PredOpExecute.subst(rbitIop)
176
177 clzCode = '''
178 Dest = (Op1 == 0) ? 32 : (31 - findMsbSet(Op1));
179 '''
175 exec_output += PredOpExecute.subst(rbitIop)
176
177 clzCode = '''
178 Dest = (Op1 == 0) ? 32 : (31 - findMsbSet(Op1));
179 '''
180 clzIop = InstObjParams("clz", "Clz", "RevOp",
180 clzIop = InstObjParams("clz", "Clz", "RegRegOp",
181 { "code": clzCode,
182 "predicate_test": predicateTest }, [])
181 { "code": clzCode,
182 "predicate_test": predicateTest }, [])
183 header_output += RevOpDeclare.subst(clzIop)
184 decoder_output += RevOpConstructor.subst(clzIop)
183 header_output += RegRegOpDeclare.subst(clzIop)
184 decoder_output += RegRegOpConstructor.subst(clzIop)
185 exec_output += PredOpExecute.subst(clzIop)
186
187 ssatCode = '''
188 int32_t operand = shift_rm_imm(Op1, shiftAmt, shiftType, 0);
189 int32_t res;
190 if (satInt(res, operand, imm))
191 CondCodes = CondCodes | (1 << 27);
192 else

--- 311 unchanged lines hidden ---
185 exec_output += PredOpExecute.subst(clzIop)
186
187 ssatCode = '''
188 int32_t operand = shift_rm_imm(Op1, shiftAmt, shiftType, 0);
189 int32_t res;
190 if (satInt(res, operand, imm))
191 CondCodes = CondCodes | (1 << 27);
192 else

--- 311 unchanged lines hidden ---