| Index: src/s390/simulator-s390.cc
|
| diff --git a/src/s390/simulator-s390.cc b/src/s390/simulator-s390.cc
|
| index df58740d8997c8c237e7f62524d5345a72b8d579..1a276a24d02803d2c400e6006d77e0f356c1297b 100644
|
| --- a/src/s390/simulator-s390.cc
|
| +++ b/src/s390/simulator-s390.cc
|
| @@ -1793,6 +1793,11 @@ uint32_t Simulator::ReadWU(intptr_t addr, Instruction* instr) {
|
| return *ptr;
|
| }
|
|
|
| +int64_t Simulator::ReadW64(intptr_t addr, Instruction* instr) {
|
| + int64_t* ptr = reinterpret_cast<int64_t*>(addr);
|
| + return *ptr;
|
| +}
|
| +
|
| int32_t Simulator::ReadW(intptr_t addr, Instruction* instr) {
|
| int32_t* ptr = reinterpret_cast<int32_t*>(addr);
|
| return *ptr;
|
| @@ -5558,15 +5563,31 @@ bool Simulator::DecodeSixByteArithmetic(Instruction* instr) {
|
| }
|
|
|
| int16_t Simulator::ByteReverse(int16_t hword) {
|
| +#if defined(__GNUC__)
|
| + return __builtin_bswap16(hword);
|
| +#else
|
| return (hword << 8) | ((hword >> 8) & 0x00ff);
|
| +#endif
|
| }
|
|
|
| int32_t Simulator::ByteReverse(int32_t word) {
|
| +#if defined(__GNUC__)
|
| + return __builtin_bswap32(word);
|
| +#else
|
| int32_t result = word << 24;
|
| result |= (word << 8) & 0x00ff0000;
|
| result |= (word >> 8) & 0x0000ff00;
|
| result |= (word >> 24) & 0x00000ff;
|
| return result;
|
| +#endif
|
| +}
|
| +
|
| +int64_t Simulator::ByteReverse(int64_t dword) {
|
| +#if defined(__GNUC__)
|
| + return __builtin_bswap64(dword);
|
| +#else
|
| +#error unsupport __builtin_bswap64
|
| +#endif
|
| }
|
|
|
| int Simulator::DecodeInstructionOriginal(Instruction* instr) {
|
| @@ -9982,9 +10003,18 @@ EVALUATE(KMAC) {
|
| }
|
|
|
| EVALUATE(LRVR) {
|
| - UNIMPLEMENTED();
|
| - USE(instr);
|
| - return 0;
|
| + DCHECK_OPCODE(LRVR);
|
| + DECODE_RRE_INSTRUCTION(r1, r2);
|
| + uint32_t r2_val = get_low_register<uint32_t>(r2);
|
| + uint32_t r1_val = 0;
|
| +#if defined(__GNUC__)
|
| + r1_val = __builtin_bswap32(r2_val);
|
| +#else
|
| +#error unsupport __builtin_bswap32
|
| +#endif
|
| +
|
| + set_low_register(r1, r1_val);
|
| + return length;
|
| }
|
|
|
| EVALUATE(CGR) {
|
| @@ -10783,12 +10813,6 @@ EVALUATE(CVBG) {
|
| return 0;
|
| }
|
|
|
| -EVALUATE(LRVG) {
|
| - UNIMPLEMENTED();
|
| - USE(instr);
|
| - return 0;
|
| -}
|
| -
|
| EVALUATE(LT) {
|
| DCHECK_OPCODE(LT);
|
| DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
|
| @@ -10885,6 +10909,21 @@ EVALUATE(DSGF) {
|
| return 0;
|
| }
|
|
|
| +EVALUATE(LRVG) {
|
| + DCHECK_OPCODE(LRVG);
|
| + DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
|
| + int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
|
| + int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
|
| + intptr_t mem_addr = b2_val + x2_val + d2;
|
| + int64_t mem_val = ReadW64(mem_addr, instr);
|
| +#if defined(__GNUC__)
|
| + set_register(r1, __builtin_bswap64(mem_val));
|
| +#else
|
| +#error unsupport __builtin_bswap64
|
| +#endif
|
| + return length;
|
| +}
|
| +
|
| EVALUATE(LRV) {
|
| DCHECK_OPCODE(LRV);
|
| DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
|
| @@ -10952,12 +10991,6 @@ EVALUATE(CVDG) {
|
| return 0;
|
| }
|
|
|
| -EVALUATE(STRVG) {
|
| - UNIMPLEMENTED();
|
| - USE(instr);
|
| - return 0;
|
| -}
|
| -
|
| EVALUATE(CGF) {
|
| UNIMPLEMENTED();
|
| USE(instr);
|
| @@ -10999,6 +11032,17 @@ EVALUATE(STRV) {
|
| return length;
|
| }
|
|
|
| +EVALUATE(STRVG) {
|
| + DCHECK_OPCODE(STRVG);
|
| + DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
|
| + int64_t r1_val = get_register(r1);
|
| + int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
|
| + int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
|
| + intptr_t mem_addr = b2_val + x2_val + d2;
|
| + WriteDW(mem_addr, ByteReverse(r1_val));
|
| + return length;
|
| +}
|
| +
|
| EVALUATE(STRVH) {
|
| DCHECK_OPCODE(STRVH);
|
| DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
|
|
|