Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/arm/constants-arm.h

Issue 3107027: Fix incorrect encoding of single and double precision registers for some... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/disasm-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Special Software Interrupt codes when used in the presence of the ARM 187 // Special Software Interrupt codes when used in the presence of the ARM
188 // simulator. 188 // simulator.
189 enum SoftwareInterruptCodes { 189 enum SoftwareInterruptCodes {
190 // transition to C code 190 // transition to C code
191 call_rt_redirected = 0x10, 191 call_rt_redirected = 0x10,
192 // break point 192 // break point
193 break_point = 0x20 193 break_point = 0x20
194 }; 194 };
195 195
196 196
197 // Type of VFP register. Determines register encoding.
198 enum VFPRegPrecision {
199 kSinglePrecision = 0,
200 kDoublePrecision = 1
201 };
202
203
197 typedef int32_t instr_t; 204 typedef int32_t instr_t;
198 205
199 206
200 // The class Instr enables access to individual fields defined in the ARM 207 // The class Instr enables access to individual fields defined in the ARM
201 // architecture instruction set encoding as described in figure A3-1. 208 // architecture instruction set encoding as described in figure A3-1.
202 // 209 //
203 // Example: Test whether the instruction at ptr does set the condition code 210 // Example: Test whether the instruction at ptr does set the condition code
204 // bits. 211 // bits.
205 // 212 //
206 // bool InstructionSetsConditionCodes(byte* ptr) { 213 // bool InstructionSetsConditionCodes(byte* ptr) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 inline int PField() const { return Bit(24); } 269 inline int PField() const { return Bit(24); }
263 inline int UField() const { return Bit(23); } 270 inline int UField() const { return Bit(23); }
264 inline int Opc1Field() const { return (Bit(23) << 2) | Bits(21, 20); } 271 inline int Opc1Field() const { return (Bit(23) << 2) | Bits(21, 20); }
265 inline int Opc2Field() const { return Bits(19, 16); } 272 inline int Opc2Field() const { return Bits(19, 16); }
266 inline int Opc3Field() const { return Bits(7, 6); } 273 inline int Opc3Field() const { return Bits(7, 6); }
267 inline int SzField() const { return Bit(8); } 274 inline int SzField() const { return Bit(8); }
268 inline int VLField() const { return Bit(20); } 275 inline int VLField() const { return Bit(20); }
269 inline int VCField() const { return Bit(8); } 276 inline int VCField() const { return Bit(8); }
270 inline int VAField() const { return Bits(23, 21); } 277 inline int VAField() const { return Bits(23, 21); }
271 inline int VBField() const { return Bits(6, 5); } 278 inline int VBField() const { return Bits(6, 5); }
279 inline int VFPNRegCode(VFPRegPrecision pre) {
280 return VFPGlueRegCode(pre, 16, 7);
281 }
282 inline int VFPMRegCode(VFPRegPrecision pre) {
283 return VFPGlueRegCode(pre, 0, 5);
284 }
285 inline int VFPDRegCode(VFPRegPrecision pre) {
286 return VFPGlueRegCode(pre, 12, 22);
287 }
272 288
273 // Fields used in Data processing instructions 289 // Fields used in Data processing instructions
274 inline Opcode OpcodeField() const { 290 inline Opcode OpcodeField() const {
275 return static_cast<Opcode>(Bits(24, 21)); 291 return static_cast<Opcode>(Bits(24, 21));
276 } 292 }
277 inline int SField() const { return Bit(20); } 293 inline int SField() const { return Bit(20); }
278 // with register 294 // with register
279 inline int RmField() const { return Bits(3, 0); } 295 inline int RmField() const { return Bits(3, 0); }
280 inline Shift ShiftField() const { return static_cast<Shift>(Bits(6, 5)); } 296 inline Shift ShiftField() const { return static_cast<Shift>(Bits(6, 5)); }
281 inline int RegShiftField() const { return Bit(4); } 297 inline int RegShiftField() const { return Bit(4); }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Decoding the double immediate in the vmov instruction. 352 // Decoding the double immediate in the vmov instruction.
337 double DoubleImmedVmov() const; 353 double DoubleImmedVmov() const;
338 354
339 // Instructions are read of out a code stream. The only way to get a 355 // Instructions are read of out a code stream. The only way to get a
340 // reference to an instruction is to convert a pointer. There is no way 356 // reference to an instruction is to convert a pointer. There is no way
341 // to allocate or create instances of class Instr. 357 // to allocate or create instances of class Instr.
342 // Use the At(pc) function to create references to Instr. 358 // Use the At(pc) function to create references to Instr.
343 static Instr* At(byte* pc) { return reinterpret_cast<Instr*>(pc); } 359 static Instr* At(byte* pc) { return reinterpret_cast<Instr*>(pc); }
344 360
345 private: 361 private:
362 // Join split register codes, depending on single or double precision.
363 // four_bit is the position of the least-significant bit of the four
364 // bit specifier. one_bit is the position of the additional single bit
365 // specifier.
366 inline int VFPGlueRegCode(VFPRegPrecision pre, int four_bit, int one_bit) {
367 if (pre == kSinglePrecision) {
368 return (Bits(four_bit + 3, four_bit) << 1) | Bit(one_bit);
369 }
370 return (Bit(one_bit) << 4) | Bits(four_bit + 3, four_bit);
371 }
372
346 // We need to prevent the creation of instances of class Instr. 373 // We need to prevent the creation of instances of class Instr.
347 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); 374 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr);
348 }; 375 };
349 376
350 377
351 // Helper functions for converting between register numbers and names. 378 // Helper functions for converting between register numbers and names.
352 class Registers { 379 class Registers {
353 public: 380 public:
354 // Return the name of the register. 381 // Return the name of the register.
355 static const char* Name(int reg); 382 static const char* Name(int reg);
(...skipping 23 matching lines...) Expand all
379 static int Number(const char* name, bool* is_double); 406 static int Number(const char* name, bool* is_double);
380 407
381 private: 408 private:
382 static const char* names_[kNumVFPRegisters]; 409 static const char* names_[kNumVFPRegisters];
383 }; 410 };
384 411
385 412
386 } } // namespace assembler::arm 413 } } // namespace assembler::arm
387 414
388 #endif // V8_ARM_CONSTANTS_ARM_H_ 415 #endif // V8_ARM_CONSTANTS_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698