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

Unified Diff: src/s390/constants-s390.h

Issue 1893713002: S390: Optimize decoding opcode format by using format table (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment to table Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/s390/constants-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/constants-s390.h
diff --git a/src/s390/constants-s390.h b/src/s390/constants-s390.h
index c313c929e66b21f3aadccca76fac0b204dd8c77b..9dfb32c7e7e74ffbe6731b8dcace9a58e06962e1 100644
--- a/src/s390/constants-s390.h
+++ b/src/s390/constants-s390.h
@@ -1080,6 +1080,7 @@ class Instruction {
THREE_NIBBLE_OPCODE // Three Nibbles - Bits 0 to 7, 12 to 15
};
+ static OpcodeFormatType OpcodeFormatTable[256];
// Helper macro to define static accessors.
// We use the cast to char* trick to bypass the strict anti-aliasing rules.
#define DECLARE_STATIC_TYPED_ACCESSOR(return_type, Name) \
@@ -1254,37 +1255,7 @@ class Instruction {
// Get Instruction Format Type
static OpcodeFormatType getOpcodeFormatType(const byte* instr) {
const byte firstByte = *instr;
- // Based on Figure B-3 in z/Architecture Principles of
- // Operation.
-
- // 1-byte opcodes
- // I, RR, RS, RSI, RX, SS Formats
- if ((0x04 <= firstByte && 0x9B >= firstByte) ||
- (0xA8 <= firstByte && 0xB1 >= firstByte) ||
- (0xBA <= firstByte && 0xBF >= firstByte) || (0xC5 == firstByte) ||
- (0xC7 == firstByte) || (0xD0 <= firstByte && 0xE2 >= firstByte) ||
- (0xE8 <= firstByte && 0xEA >= firstByte) ||
- (0xEE <= firstByte && 0xFD >= firstByte)) {
- return ONE_BYTE_OPCODE;
- }
-
- // 2-byte opcodes
- // E, IE, RRD, RRE, RRF, SIL, S, SSE Formats
- if ((0x00 == firstByte) || // Software breakpoint 0x0001
- (0x01 == firstByte) || (0xB2 == firstByte) || (0xB3 == firstByte) ||
- (0xB9 == firstByte) || (0xE5 == firstByte)) {
- return TWO_BYTE_OPCODE;
- }
-
- // 3-nibble opcodes
- // RI, RIL, SSF Formats
- if ((0xA5 == firstByte) || (0xA7 == firstByte) ||
- (0xC0 <= firstByte && 0xCC >= firstByte)) { // C5,C7 handled above
- return THREE_NIBBLE_OPCODE;
- }
- // Remaining ones are all TWO_BYTE_DISJOINT OPCODES.
- DCHECK(InstructionLength(instr) == 6);
- return TWO_BYTE_DISJOINT_OPCODE;
+ return OpcodeFormatTable[firstByte];
}
// Extract the full opcode from the instruction.
@@ -1304,11 +1275,10 @@ class Instruction {
case TWO_BYTE_DISJOINT_OPCODE:
// Two Bytes - Bits 0 to 7, 40 to 47
return static_cast<Opcode>((*instr << 8) | (*(instr + 5) & 0xFF));
- case THREE_NIBBLE_OPCODE:
+ default:
+ // case THREE_NIBBLE_OPCODE:
// Three Nibbles - Bits 0 to 7, 12 to 15
return static_cast<Opcode>((*instr << 4) | (*(instr + 1) & 0xF));
- default:
- break;
}
UNREACHABLE();
« no previous file with comments | « no previous file | src/s390/constants-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698