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

Side by Side Diff: src/s390/simulator-s390.cc

Issue 2005493002: S390: Added remaining generated instructions to S390 simulator EVALUATE code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed DecodeInstructionOriginal from unimplemented instructions; they will now return 0. Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdarg.h> 5 #include <stdarg.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <cmath> 7 #include <cmath>
8 8
9 #if V8_TARGET_ARCH_S390 9 #if V8_TARGET_ARCH_S390
10 10
(...skipping 5947 matching lines...) Expand 10 before | Expand all | Expand 10 after
5958 int b1 = AS(SIYInstruction)->B1Value(); \ 5958 int b1 = AS(SIYInstruction)->B1Value(); \
5959 intptr_t d1 = AS(SIYInstruction)->D1Value(); \ 5959 intptr_t d1 = AS(SIYInstruction)->D1Value(); \
5960 uint8_t i2 = AS(SIYInstruction)->I2Value(); \ 5960 uint8_t i2 = AS(SIYInstruction)->I2Value(); \
5961 int length = 6; 5961 int length = 6;
5962 5962
5963 #define DECODE_RRE_INSTRUCTION(r1, r2) \ 5963 #define DECODE_RRE_INSTRUCTION(r1, r2) \
5964 int r1 = AS(RREInstruction)->R1Value(); \ 5964 int r1 = AS(RREInstruction)->R1Value(); \
5965 int r2 = AS(RREInstruction)->R2Value(); \ 5965 int r2 = AS(RREInstruction)->R2Value(); \
5966 int length = 4; 5966 int length = 4;
5967 5967
5968 #define DECODE_RRE_INSTRUCTION_M3(r1, r2, m3) \
5969 int r1 = AS(RREInstruction)->R1Value(); \
5970 int r2 = AS(RREInstruction)->R2Value(); \
5971 int m3 = AS(RREInstruction)->M3Value(); \
5972 int length = 4;
5973
5968 #define DECODE_RRE_INSTRUCTION_NO_R2(r1) \ 5974 #define DECODE_RRE_INSTRUCTION_NO_R2(r1) \
5969 int r1 = AS(RREInstruction)->R1Value(); \ 5975 int r1 = AS(RREInstruction)->R1Value(); \
5970 int length = 4; 5976 int length = 4;
5971 5977
5972 #define DECODE_RRD_INSTRUCTION(r1, r2, r3) \ 5978 #define DECODE_RRD_INSTRUCTION(r1, r2, r3) \
5973 int r1 = AS(RRDInstruction)->R1Value(); \ 5979 int r1 = AS(RRDInstruction)->R1Value(); \
5974 int r2 = AS(RRDInstruction)->R2Value(); \ 5980 int r2 = AS(RRDInstruction)->R2Value(); \
5975 int r3 = AS(RRDInstruction)->R3Value(); \ 5981 int r3 = AS(RRDInstruction)->R3Value(); \
5976 int length = 4; 5982 int length = 4;
5977 5983
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
6369 6375
6370 EVALUATE(BKPT) { 6376 EVALUATE(BKPT) {
6371 DCHECK_OPCODE(BKPT); 6377 DCHECK_OPCODE(BKPT);
6372 set_pc(get_pc() + 2); 6378 set_pc(get_pc() + 2);
6373 S390Debugger dbg(this); 6379 S390Debugger dbg(this);
6374 dbg.Debug(); 6380 dbg.Debug();
6375 int length = 2; 6381 int length = 2;
6376 return length; 6382 return length;
6377 } 6383 }
6378 6384
6379 EVALUATE(SPM) { return DecodeInstructionOriginal(instr); } 6385 EVALUATE(SPM) {
6386 UNIMPLEMENTED();
6387 USE(instr);
6388 return 0;
6389 }
6380 6390
6381 EVALUATE(BALR) { return DecodeInstructionOriginal(instr); } 6391 EVALUATE(BALR) {
6392 UNIMPLEMENTED();
6393 USE(instr);
6394 return 0;
6395 }
6382 6396
6383 EVALUATE(BCTR) { return DecodeInstructionOriginal(instr); } 6397 EVALUATE(BCTR) {
6398 UNIMPLEMENTED();
6399 USE(instr);
6400 return 0;
6401 }
6384 6402
6385 EVALUATE(BCR) { 6403 EVALUATE(BCR) {
6386 DCHECK_OPCODE(BCR); 6404 DCHECK_OPCODE(BCR);
6387 DECODE_RR_INSTRUCTION(r1, r2); 6405 DECODE_RR_INSTRUCTION(r1, r2);
6388 if (TestConditionCode(Condition(r1))) { 6406 if (TestConditionCode(Condition(r1))) {
6389 intptr_t r2_val = get_register(r2); 6407 intptr_t r2_val = get_register(r2);
6390 #if (!V8_TARGET_ARCH_S390X && V8_HOST_ARCH_S390) 6408 #if (!V8_TARGET_ARCH_S390X && V8_HOST_ARCH_S390)
6391 // On 31-bit, the top most bit may be 0 or 1, but is ignored by the 6409 // On 31-bit, the top most bit may be 0 or 1, but is ignored by the
6392 // hardware. Cleanse the top bit before jumping to it, unless it's one 6410 // hardware. Cleanse the top bit before jumping to it, unless it's one
6393 // of the special PCs 6411 // of the special PCs
6394 if (r2_val != bad_lr && r2_val != end_sim_pc) r2_val &= 0x7FFFFFFF; 6412 if (r2_val != bad_lr && r2_val != end_sim_pc) r2_val &= 0x7FFFFFFF;
6395 #endif 6413 #endif
6396 set_pc(r2_val); 6414 set_pc(r2_val);
6397 } 6415 }
6398 6416
6399 return length; 6417 return length;
6400 } 6418 }
6401 6419
6402 EVALUATE(SVC) { return DecodeInstructionOriginal(instr); } 6420 EVALUATE(SVC) {
6421 UNIMPLEMENTED();
6422 USE(instr);
6423 return 0;
6424 }
6403 6425
6404 EVALUATE(BSM) { return DecodeInstructionOriginal(instr); } 6426 EVALUATE(BSM) {
6427 UNIMPLEMENTED();
6428 USE(instr);
6429 return 0;
6430 }
6405 6431
6406 EVALUATE(BASSM) { return DecodeInstructionOriginal(instr); } 6432 EVALUATE(BASSM) {
6433 UNIMPLEMENTED();
6434 USE(instr);
6435 return 0;
6436 }
6407 6437
6408 EVALUATE(BASR) { 6438 EVALUATE(BASR) {
6409 DCHECK_OPCODE(BASR); 6439 DCHECK_OPCODE(BASR);
6410 DECODE_RR_INSTRUCTION(r1, r2); 6440 DECODE_RR_INSTRUCTION(r1, r2);
6411 intptr_t link_addr = get_pc() + 2; 6441 intptr_t link_addr = get_pc() + 2;
6412 // If R2 is zero, the BASR does not branch. 6442 // If R2 is zero, the BASR does not branch.
6413 int64_t r2_val = (r2 == 0) ? link_addr : get_register(r2); 6443 int64_t r2_val = (r2 == 0) ? link_addr : get_register(r2);
6414 #if (!V8_TARGET_ARCH_S390X && V8_HOST_ARCH_S390) 6444 #if (!V8_TARGET_ARCH_S390X && V8_HOST_ARCH_S390)
6415 // On 31-bit, the top most bit may be 0 or 1, which can cause issues 6445 // On 31-bit, the top most bit may be 0 or 1, which can cause issues
6416 // for stackwalker. The top bit should either be cleanse before being 6446 // for stackwalker. The top bit should either be cleanse before being
6417 // pushed onto the stack, or during stack walking when dereferenced. 6447 // pushed onto the stack, or during stack walking when dereferenced.
6418 // For simulator, we'll take the worst case scenario and always tag 6448 // For simulator, we'll take the worst case scenario and always tag
6419 // the high bit, to flush out more problems. 6449 // the high bit, to flush out more problems.
6420 link_addr |= 0x80000000; 6450 link_addr |= 0x80000000;
6421 #endif 6451 #endif
6422 set_register(r1, link_addr); 6452 set_register(r1, link_addr);
6423 set_pc(r2_val); 6453 set_pc(r2_val);
6424 return length; 6454 return length;
6425 } 6455 }
6426 6456
6427 EVALUATE(MVCL) { return DecodeInstructionOriginal(instr); } 6457 EVALUATE(MVCL) {
6458 UNIMPLEMENTED();
6459 USE(instr);
6460 return 0;
6461 }
6428 6462
6429 EVALUATE(CLCL) { return DecodeInstructionOriginal(instr); } 6463 EVALUATE(CLCL) {
6464 UNIMPLEMENTED();
6465 USE(instr);
6466 return 0;
6467 }
6430 6468
6431 EVALUATE(LPR) { return DecodeInstructionOriginal(instr); } 6469 EVALUATE(LPR) {
6470 UNIMPLEMENTED();
6471 USE(instr);
6472 return 0;
6473 }
6432 6474
6433 EVALUATE(LNR) { 6475 EVALUATE(LNR) {
6434 DCHECK_OPCODE(LNR); 6476 DCHECK_OPCODE(LNR);
6435 // Load Negative (32) 6477 // Load Negative (32)
6436 DECODE_RR_INSTRUCTION(r1, r2); 6478 DECODE_RR_INSTRUCTION(r1, r2);
6437 int32_t r2_val = get_low_register<int32_t>(r2); 6479 int32_t r2_val = get_low_register<int32_t>(r2);
6438 r2_val = (r2_val >= 0) ? -r2_val : r2_val; // If pos, then negate it. 6480 r2_val = (r2_val >= 0) ? -r2_val : r2_val; // If pos, then negate it.
6439 set_low_register(r1, r2_val); 6481 set_low_register(r1, r2_val);
6440 condition_reg_ = (r2_val == 0) ? CC_EQ : CC_LT; // CC0 - result is zero 6482 condition_reg_ = (r2_val == 0) ? CC_EQ : CC_LT; // CC0 - result is zero
6441 // CC1 - result is negative 6483 // CC1 - result is negative
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
6595 } 6637 }
6596 6638
6597 EVALUATE(LDR) { 6639 EVALUATE(LDR) {
6598 DCHECK_OPCODE(LDR); 6640 DCHECK_OPCODE(LDR);
6599 DECODE_RR_INSTRUCTION(r1, r2); 6641 DECODE_RR_INSTRUCTION(r1, r2);
6600 int64_t r2_val = get_d_register(r2); 6642 int64_t r2_val = get_d_register(r2);
6601 set_d_register(r1, r2_val); 6643 set_d_register(r1, r2_val);
6602 return length; 6644 return length;
6603 } 6645 }
6604 6646
6605 EVALUATE(CDR) { return DecodeInstructionOriginal(instr); } 6647 EVALUATE(CDR) {
6648 UNIMPLEMENTED();
6649 USE(instr);
6650 return 0;
6651 }
6606 6652
6607 EVALUATE(LER) { return DecodeInstructionOriginal(instr); } 6653 EVALUATE(LER) {
6654 UNIMPLEMENTED();
6655 USE(instr);
6656 return 0;
6657 }
6608 6658
6609 EVALUATE(STH) { 6659 EVALUATE(STH) {
6610 DCHECK_OPCODE(STH); 6660 DCHECK_OPCODE(STH);
6611 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6661 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6612 int16_t r1_val = get_low_register<int32_t>(r1); 6662 int16_t r1_val = get_low_register<int32_t>(r1);
6613 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6663 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6614 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6664 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6615 intptr_t mem_addr = b2_val + x2_val + d2_val; 6665 intptr_t mem_addr = b2_val + x2_val + d2_val;
6616 WriteH(mem_addr, r1_val, instr); 6666 WriteH(mem_addr, r1_val, instr);
6617 6667
(...skipping 15 matching lines...) Expand all
6633 // Store Character/Byte 6683 // Store Character/Byte
6634 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6684 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6635 uint8_t r1_val = get_low_register<int32_t>(r1); 6685 uint8_t r1_val = get_low_register<int32_t>(r1);
6636 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6686 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6637 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6687 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6638 intptr_t mem_addr = b2_val + x2_val + d2_val; 6688 intptr_t mem_addr = b2_val + x2_val + d2_val;
6639 WriteB(mem_addr, r1_val); 6689 WriteB(mem_addr, r1_val);
6640 return length; 6690 return length;
6641 } 6691 }
6642 6692
6643 EVALUATE(IC_z) { return DecodeInstructionOriginal(instr); } 6693 EVALUATE(IC_z) {
6694 UNIMPLEMENTED();
6695 USE(instr);
6696 return 0;
6697 }
6644 6698
6645 EVALUATE(EX) { 6699 EVALUATE(EX) {
6646 DCHECK_OPCODE(EX); 6700 DCHECK_OPCODE(EX);
6647 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6701 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6648 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6702 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6649 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6703 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6650 int32_t r1_val = get_low_register<int32_t>(r1); 6704 int32_t r1_val = get_low_register<int32_t>(r1);
6651 6705
6652 SixByteInstr the_instr = Instruction::InstructionBits( 6706 SixByteInstr the_instr = Instruction::InstructionBits(
6653 reinterpret_cast<const byte*>(b2_val + x2_val + d2_val)); 6707 reinterpret_cast<const byte*>(b2_val + x2_val + d2_val));
6654 int inst_length = Instruction::InstructionLength( 6708 int inst_length = Instruction::InstructionLength(
6655 reinterpret_cast<const byte*>(b2_val + x2_val + d2_val)); 6709 reinterpret_cast<const byte*>(b2_val + x2_val + d2_val));
6656 6710
6657 char new_instr_buf[8]; 6711 char new_instr_buf[8];
6658 char* addr = reinterpret_cast<char*>(&new_instr_buf[0]); 6712 char* addr = reinterpret_cast<char*>(&new_instr_buf[0]);
6659 the_instr |= static_cast<SixByteInstr>(r1_val & 0xff) 6713 the_instr |= static_cast<SixByteInstr>(r1_val & 0xff)
6660 << (8 * inst_length - 16); 6714 << (8 * inst_length - 16);
6661 Instruction::SetInstructionBits<SixByteInstr>( 6715 Instruction::SetInstructionBits<SixByteInstr>(
6662 reinterpret_cast<byte*>(addr), static_cast<SixByteInstr>(the_instr)); 6716 reinterpret_cast<byte*>(addr), static_cast<SixByteInstr>(the_instr));
6663 ExecuteInstruction(reinterpret_cast<Instruction*>(addr), false); 6717 ExecuteInstruction(reinterpret_cast<Instruction*>(addr), false);
6664 return length; 6718 return length;
6665 } 6719 }
6666 6720
6667 EVALUATE(BAL) { return DecodeInstructionOriginal(instr); } 6721 EVALUATE(BAL) {
6722 UNIMPLEMENTED();
6723 USE(instr);
6724 return 0;
6725 }
6668 6726
6669 EVALUATE(BCT) { return DecodeInstructionOriginal(instr); } 6727 EVALUATE(BCT) {
6728 UNIMPLEMENTED();
6729 USE(instr);
6730 return 0;
6731 }
6670 6732
6671 EVALUATE(BC) { return DecodeInstructionOriginal(instr); } 6733 EVALUATE(BC) {
6734 UNIMPLEMENTED();
6735 USE(instr);
6736 return 0;
6737 }
6672 6738
6673 EVALUATE(LH) { 6739 EVALUATE(LH) {
6674 DCHECK_OPCODE(LH); 6740 DCHECK_OPCODE(LH);
6675 // Load Halfword 6741 // Load Halfword
6676 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6742 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6677 6743
6678 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6744 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6679 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6745 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6680 intptr_t mem_addr = x2_val + b2_val + d2_val; 6746 intptr_t mem_addr = x2_val + b2_val + d2_val;
6681 6747
6682 int32_t result = static_cast<int32_t>(ReadH(mem_addr, instr)); 6748 int32_t result = static_cast<int32_t>(ReadH(mem_addr, instr));
6683 set_low_register(r1, result); 6749 set_low_register(r1, result);
6684 return length; 6750 return length;
6685 } 6751 }
6686 6752
6687 EVALUATE(CH) { return DecodeInstructionOriginal(instr); } 6753 EVALUATE(CH) {
6754 UNIMPLEMENTED();
6755 USE(instr);
6756 return 0;
6757 }
6688 6758
6689 EVALUATE(AH) { 6759 EVALUATE(AH) {
6690 DCHECK_OPCODE(AH); 6760 DCHECK_OPCODE(AH);
6691 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6761 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6692 int32_t r1_val = get_low_register<int32_t>(r1); 6762 int32_t r1_val = get_low_register<int32_t>(r1);
6693 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6763 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6694 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6764 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6695 intptr_t addr = b2_val + x2_val + d2_val; 6765 intptr_t addr = b2_val + x2_val + d2_val;
6696 int32_t mem_val = static_cast<int32_t>(ReadH(addr, instr)); 6766 int32_t mem_val = static_cast<int32_t>(ReadH(addr, instr));
6697 int32_t alu_out = 0; 6767 int32_t alu_out = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
6730 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6800 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6731 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6801 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6732 intptr_t addr = b2_val + x2_val + d2_val; 6802 intptr_t addr = b2_val + x2_val + d2_val;
6733 int32_t mem_val = static_cast<int32_t>(ReadH(addr, instr)); 6803 int32_t mem_val = static_cast<int32_t>(ReadH(addr, instr));
6734 int32_t alu_out = 0; 6804 int32_t alu_out = 0;
6735 alu_out = r1_val * mem_val; 6805 alu_out = r1_val * mem_val;
6736 set_low_register(r1, alu_out); 6806 set_low_register(r1, alu_out);
6737 return length; 6807 return length;
6738 } 6808 }
6739 6809
6740 EVALUATE(BAS) { return DecodeInstructionOriginal(instr); } 6810 EVALUATE(BAS) {
6811 UNIMPLEMENTED();
6812 USE(instr);
6813 return 0;
6814 }
6741 6815
6742 EVALUATE(CVD) { return DecodeInstructionOriginal(instr); } 6816 EVALUATE(CVD) {
6817 UNIMPLEMENTED();
6818 USE(instr);
6819 return 0;
6820 }
6743 6821
6744 EVALUATE(CVB) { return DecodeInstructionOriginal(instr); } 6822 EVALUATE(CVB) {
6823 UNIMPLEMENTED();
6824 USE(instr);
6825 return 0;
6826 }
6745 6827
6746 EVALUATE(LAE) { return DecodeInstructionOriginal(instr); } 6828 EVALUATE(LAE) {
6829 UNIMPLEMENTED();
6830 USE(instr);
6831 return 0;
6832 }
6747 6833
6748 EVALUATE(N) { 6834 EVALUATE(N) {
6749 DCHECK_OPCODE(N); 6835 DCHECK_OPCODE(N);
6750 // 32-bit Reg-Mem instructions 6836 // 32-bit Reg-Mem instructions
6751 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6837 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6752 int32_t r1_val = get_low_register<int32_t>(r1); 6838 int32_t r1_val = get_low_register<int32_t>(r1);
6753 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6839 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6754 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6840 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6755 int32_t mem_val = ReadW(b2_val + x2_val + d2_val, instr); 6841 int32_t mem_val = ReadW(b2_val + x2_val + d2_val, instr);
6756 int32_t alu_out = 0; 6842 int32_t alu_out = 0;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
6843 int32_t alu_out = 0; 6929 int32_t alu_out = 0;
6844 bool isOF = false; 6930 bool isOF = false;
6845 isOF = CheckOverflowForIntSub(r1_val, mem_val, int32_t); 6931 isOF = CheckOverflowForIntSub(r1_val, mem_val, int32_t);
6846 alu_out = r1_val - mem_val; 6932 alu_out = r1_val - mem_val;
6847 SetS390ConditionCode<int32_t>(alu_out, 0); 6933 SetS390ConditionCode<int32_t>(alu_out, 0);
6848 SetS390OverflowCode(isOF); 6934 SetS390OverflowCode(isOF);
6849 set_low_register(r1, alu_out); 6935 set_low_register(r1, alu_out);
6850 return length; 6936 return length;
6851 } 6937 }
6852 6938
6853 EVALUATE(M) { return DecodeInstructionOriginal(instr); } 6939 EVALUATE(M) {
6940 UNIMPLEMENTED();
6941 USE(instr);
6942 return 0;
6943 }
6854 6944
6855 EVALUATE(D) { return DecodeInstructionOriginal(instr); } 6945 EVALUATE(D) {
6946 UNIMPLEMENTED();
6947 USE(instr);
6948 return 0;
6949 }
6856 6950
6857 EVALUATE(AL) { return DecodeInstructionOriginal(instr); } 6951 EVALUATE(AL) {
6952 UNIMPLEMENTED();
6953 USE(instr);
6954 return 0;
6955 }
6858 6956
6859 EVALUATE(SL) { return DecodeInstructionOriginal(instr); } 6957 EVALUATE(SL) {
6958 UNIMPLEMENTED();
6959 USE(instr);
6960 return 0;
6961 }
6860 6962
6861 EVALUATE(STD) { 6963 EVALUATE(STD) {
6862 DCHECK_OPCODE(STD); 6964 DCHECK_OPCODE(STD);
6863 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6965 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6864 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6966 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6865 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6967 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6866 intptr_t addr = b2_val + x2_val + d2_val; 6968 intptr_t addr = b2_val + x2_val + d2_val;
6867 int64_t frs_val = get_d_register(r1); 6969 int64_t frs_val = get_d_register(r1);
6868 WriteDW(addr, frs_val); 6970 WriteDW(addr, frs_val);
6869 return length; 6971 return length;
6870 } 6972 }
6871 6973
6872 EVALUATE(LD) { 6974 EVALUATE(LD) {
6873 DCHECK_OPCODE(LD); 6975 DCHECK_OPCODE(LD);
6874 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6976 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6875 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6977 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6876 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6978 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6877 intptr_t addr = b2_val + x2_val + d2_val; 6979 intptr_t addr = b2_val + x2_val + d2_val;
6878 int64_t dbl_val = *reinterpret_cast<int64_t*>(addr); 6980 int64_t dbl_val = *reinterpret_cast<int64_t*>(addr);
6879 set_d_register(r1, dbl_val); 6981 set_d_register(r1, dbl_val);
6880 return length; 6982 return length;
6881 } 6983 }
6882 6984
6883 EVALUATE(CD) { return DecodeInstructionOriginal(instr); } 6985 EVALUATE(CD) {
6986 UNIMPLEMENTED();
6987 USE(instr);
6988 return 0;
6989 }
6884 6990
6885 EVALUATE(STE) { 6991 EVALUATE(STE) {
6886 DCHECK_OPCODE(STE); 6992 DCHECK_OPCODE(STE);
6887 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 6993 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6888 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 6994 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6889 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 6995 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6890 intptr_t addr = b2_val + x2_val + d2_val; 6996 intptr_t addr = b2_val + x2_val + d2_val;
6891 int64_t frs_val = get_d_register(r1) >> 32; 6997 int64_t frs_val = get_d_register(r1) >> 32;
6892 WriteW(addr, static_cast<int32_t>(frs_val), instr); 6998 WriteW(addr, static_cast<int32_t>(frs_val), instr);
6893 return length; 6999 return length;
(...skipping 14 matching lines...) Expand all
6908 DCHECK_OPCODE(LE); 7014 DCHECK_OPCODE(LE);
6909 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); 7015 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val);
6910 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 7016 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
6911 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 7017 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
6912 intptr_t addr = b2_val + x2_val + d2_val; 7018 intptr_t addr = b2_val + x2_val + d2_val;
6913 float float_val = *reinterpret_cast<float*>(addr); 7019 float float_val = *reinterpret_cast<float*>(addr);
6914 set_d_register_from_float32(r1, float_val); 7020 set_d_register_from_float32(r1, float_val);
6915 return length; 7021 return length;
6916 } 7022 }
6917 7023
6918 EVALUATE(BRXH) { return DecodeInstructionOriginal(instr); } 7024 EVALUATE(BRXH) {
7025 UNIMPLEMENTED();
7026 USE(instr);
7027 return 0;
7028 }
6919 7029
6920 EVALUATE(BRXLE) { return DecodeInstructionOriginal(instr); } 7030 EVALUATE(BRXLE) {
7031 UNIMPLEMENTED();
7032 USE(instr);
7033 return 0;
7034 }
6921 7035
6922 EVALUATE(BXH) { 7036 EVALUATE(BXH) {
6923 DCHECK_OPCODE(BXH); 7037 DCHECK_OPCODE(BXH);
6924 DECODE_RS_A_INSTRUCTION(r1, r3, b2, d2); 7038 DECODE_RS_A_INSTRUCTION(r1, r3, b2, d2);
6925 7039
6926 // r1_val is the first operand, r3_val is the increment 7040 // r1_val is the first operand, r3_val is the increment
6927 int32_t r1_val = r1 == 0 ? 0 : get_register(r1); 7041 int32_t r1_val = r1 == 0 ? 0 : get_register(r1);
6928 int32_t r3_val = r2 == 0 ? 0 : get_register(r3); 7042 int32_t r3_val = r2 == 0 ? 0 : get_register(r3);
6929 intptr_t b2_val = b2 == 0 ? 0 : get_register(b2); 7043 intptr_t b2_val = b2 == 0 ? 0 : get_register(b2);
6930 intptr_t branch_address = b2_val + d2; 7044 intptr_t branch_address = b2_val + d2;
6931 // increment r1_val 7045 // increment r1_val
6932 r1_val += r3_val; 7046 r1_val += r3_val;
6933 7047
6934 // if the increment is even, then it designates a pair of registers 7048 // if the increment is even, then it designates a pair of registers
6935 // and the contents of the even and odd registers of the pair are used as 7049 // and the contents of the even and odd registers of the pair are used as
6936 // the increment and compare value respectively. If the increment is odd, 7050 // the increment and compare value respectively. If the increment is odd,
6937 // the increment itself is used as both the increment and compare value 7051 // the increment itself is used as both the increment and compare value
6938 int32_t compare_val = r3 % 2 == 0 ? get_register(r3 + 1) : r3_val; 7052 int32_t compare_val = r3 % 2 == 0 ? get_register(r3 + 1) : r3_val;
6939 if (r1_val > compare_val) { 7053 if (r1_val > compare_val) {
6940 // branch to address if r1_val is greater than compare value 7054 // branch to address if r1_val is greater than compare value
6941 set_pc(branch_address); 7055 set_pc(branch_address);
6942 } 7056 }
6943 7057
6944 // update contents of register in r1 with the new incremented value 7058 // update contents of register in r1 with the new incremented value
6945 set_register(r1, r1_val); 7059 set_register(r1, r1_val);
6946 7060
6947 return length; 7061 return length;
6948 } 7062 }
6949 7063
6950 EVALUATE(BXLE) { return DecodeInstructionOriginal(instr); } 7064 EVALUATE(BXLE) {
7065 UNIMPLEMENTED();
7066 USE(instr);
7067 return 0;
7068 }
6951 7069
6952 EVALUATE(SRL) { 7070 EVALUATE(SRL) {
6953 DCHECK_OPCODE(SRL); 7071 DCHECK_OPCODE(SRL);
6954 DECODE_RS_A_INSTRUCTION_NO_R3(r1, b2, d2); 7072 DECODE_RS_A_INSTRUCTION_NO_R3(r1, b2, d2);
6955 // only takes rightmost 6bits 7073 // only takes rightmost 6bits
6956 int64_t b2_val = b2 == 0 ? 0 : get_register(b2); 7074 int64_t b2_val = b2 == 0 ? 0 : get_register(b2);
6957 int shiftBits = (b2_val + d2) & 0x3F; 7075 int shiftBits = (b2_val + d2) & 0x3F;
6958 uint32_t r1_val = get_low_register<uint32_t>(r1); 7076 uint32_t r1_val = get_low_register<uint32_t>(r1);
6959 uint32_t alu_out = 0; 7077 uint32_t alu_out = 0;
6960 alu_out = r1_val >> shiftBits; 7078 alu_out = r1_val >> shiftBits;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
7053 int64_t opnd1 = static_cast<int64_t>(get_low_register<int32_t>(r1)) << 32; 7171 int64_t opnd1 = static_cast<int64_t>(get_low_register<int32_t>(r1)) << 32;
7054 int64_t opnd2 = static_cast<uint64_t>(get_low_register<uint32_t>(r1 + 1)); 7172 int64_t opnd2 = static_cast<uint64_t>(get_low_register<uint32_t>(r1 + 1));
7055 int64_t r1_val = opnd1 + opnd2; 7173 int64_t r1_val = opnd1 + opnd2;
7056 int64_t alu_out = r1_val >> shiftBits; 7174 int64_t alu_out = r1_val >> shiftBits;
7057 set_low_register(r1, alu_out >> 32); 7175 set_low_register(r1, alu_out >> 32);
7058 set_low_register(r1 + 1, alu_out & 0x00000000FFFFFFFF); 7176 set_low_register(r1 + 1, alu_out & 0x00000000FFFFFFFF);
7059 SetS390ConditionCode<int32_t>(alu_out, 0); 7177 SetS390ConditionCode<int32_t>(alu_out, 0);
7060 return length; 7178 return length;
7061 } 7179 }
7062 7180
7063 EVALUATE(SLDA) { return DecodeInstructionOriginal(instr); } 7181 EVALUATE(SLDA) {
7182 UNIMPLEMENTED();
7183 USE(instr);
7184 return 0;
7185 }
7064 7186
7065 EVALUATE(STM) { 7187 EVALUATE(STM) {
7066 DCHECK_OPCODE(STM); 7188 DCHECK_OPCODE(STM);
7067 DECODE_RS_A_INSTRUCTION(r1, r3, rb, d2); 7189 DECODE_RS_A_INSTRUCTION(r1, r3, rb, d2);
7068 // Store Multiple 32-bits. 7190 // Store Multiple 32-bits.
7069 int offset = d2; 7191 int offset = d2;
7070 // Regs roll around if r3 is less than r1. 7192 // Regs roll around if r3 is less than r1.
7071 // Artifically increase r3 by 16 so we can calculate 7193 // Artifically increase r3 by 16 so we can calculate
7072 // the number of regs stored properly. 7194 // the number of regs stored properly.
7073 if (r3 < r1) r3 += 16; 7195 if (r3 < r1) r3 += 16;
(...skipping 22 matching lines...) Expand all
7096 if (0 == selected_bits) { 7218 if (0 == selected_bits) {
7097 condition_reg_ = CC_EQ; // CC0 7219 condition_reg_ = CC_EQ; // CC0
7098 } else if (selected_bits == imm_val) { 7220 } else if (selected_bits == imm_val) {
7099 condition_reg_ = 0x1; // CC3 7221 condition_reg_ = 0x1; // CC3
7100 } else { 7222 } else {
7101 condition_reg_ = 0x4; // CC1 7223 condition_reg_ = 0x4; // CC1
7102 } 7224 }
7103 return length; 7225 return length;
7104 } 7226 }
7105 7227
7106 EVALUATE(MVI) { return DecodeInstructionOriginal(instr); } 7228 EVALUATE(MVI) {
7229 UNIMPLEMENTED();
7230 USE(instr);
7231 return 0;
7232 }
7107 7233
7108 EVALUATE(TS) { return DecodeInstructionOriginal(instr); } 7234 EVALUATE(TS) {
7235 UNIMPLEMENTED();
7236 USE(instr);
7237 return 0;
7238 }
7109 7239
7110 EVALUATE(NI) { return DecodeInstructionOriginal(instr); } 7240 EVALUATE(NI) {
7241 UNIMPLEMENTED();
7242 USE(instr);
7243 return 0;
7244 }
7111 7245
7112 EVALUATE(CLI) { 7246 EVALUATE(CLI) {
7113 DCHECK_OPCODE(CLI); 7247 DCHECK_OPCODE(CLI);
7114 // Compare Immediate (Mem - Imm) (8) 7248 // Compare Immediate (Mem - Imm) (8)
7115 DECODE_SI_INSTRUCTION_I_UINT8(b1, d1_val, imm_val) 7249 DECODE_SI_INSTRUCTION_I_UINT8(b1, d1_val, imm_val)
7116 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1); 7250 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1);
7117 intptr_t addr = b1_val + d1_val; 7251 intptr_t addr = b1_val + d1_val;
7118 uint8_t mem_val = ReadB(addr); 7252 uint8_t mem_val = ReadB(addr);
7119 SetS390ConditionCode<uint8_t>(mem_val, imm_val); 7253 SetS390ConditionCode<uint8_t>(mem_val, imm_val);
7120 return length; 7254 return length;
7121 } 7255 }
7122 7256
7123 EVALUATE(OI) { return DecodeInstructionOriginal(instr); } 7257 EVALUATE(OI) {
7258 UNIMPLEMENTED();
7259 USE(instr);
7260 return 0;
7261 }
7124 7262
7125 EVALUATE(XI) { return DecodeInstructionOriginal(instr); } 7263 EVALUATE(XI) {
7264 UNIMPLEMENTED();
7265 USE(instr);
7266 return 0;
7267 }
7126 7268
7127 EVALUATE(LM) { 7269 EVALUATE(LM) {
7128 DCHECK_OPCODE(LM); 7270 DCHECK_OPCODE(LM);
7129 DECODE_RS_A_INSTRUCTION(r1, r3, rb, d2); 7271 DECODE_RS_A_INSTRUCTION(r1, r3, rb, d2);
7130 // Store Multiple 32-bits. 7272 // Store Multiple 32-bits.
7131 int offset = d2; 7273 int offset = d2;
7132 // Regs roll around if r3 is less than r1. 7274 // Regs roll around if r3 is less than r1.
7133 // Artifically increase r3 by 16 so we can calculate 7275 // Artifically increase r3 by 16 so we can calculate
7134 // the number of regs stored properly. 7276 // the number of regs stored properly.
7135 if (r3 < r1) r3 += 16; 7277 if (r3 < r1) r3 += 16;
7136 7278
7137 int32_t rb_val = (rb == 0) ? 0 : get_low_register<int32_t>(rb); 7279 int32_t rb_val = (rb == 0) ? 0 : get_low_register<int32_t>(rb);
7138 7280
7139 // Store each register in ascending order. 7281 // Store each register in ascending order.
7140 for (int i = 0; i <= r3 - r1; i++) { 7282 for (int i = 0; i <= r3 - r1; i++) {
7141 int32_t value = ReadW(rb_val + offset + 4 * i, instr); 7283 int32_t value = ReadW(rb_val + offset + 4 * i, instr);
7142 set_low_register((r1 + i) % 16, value); 7284 set_low_register((r1 + i) % 16, value);
7143 } 7285 }
7144 return length; 7286 return length;
7145 } 7287 }
7146 7288
7147 EVALUATE(MVCLE) { return DecodeInstructionOriginal(instr); } 7289 EVALUATE(MVCLE) {
7290 UNIMPLEMENTED();
7291 USE(instr);
7292 return 0;
7293 }
7148 7294
7149 EVALUATE(CLCLE) { return DecodeInstructionOriginal(instr); } 7295 EVALUATE(CLCLE) {
7296 UNIMPLEMENTED();
7297 USE(instr);
7298 return 0;
7299 }
7150 7300
7151 EVALUATE(MC) { return DecodeInstructionOriginal(instr); } 7301 EVALUATE(MC) {
7302 UNIMPLEMENTED();
7303 USE(instr);
7304 return 0;
7305 }
7152 7306
7153 EVALUATE(CDS) { return DecodeInstructionOriginal(instr); } 7307 EVALUATE(CDS) {
7308 UNIMPLEMENTED();
7309 USE(instr);
7310 return 0;
7311 }
7154 7312
7155 EVALUATE(STCM) { return DecodeInstructionOriginal(instr); } 7313 EVALUATE(STCM) {
7314 UNIMPLEMENTED();
7315 USE(instr);
7316 return 0;
7317 }
7156 7318
7157 EVALUATE(ICM) { return DecodeInstructionOriginal(instr); } 7319 EVALUATE(ICM) {
7320 UNIMPLEMENTED();
7321 USE(instr);
7322 return 0;
7323 }
7158 7324
7159 EVALUATE(BPRP) { return DecodeInstructionOriginal(instr); } 7325 EVALUATE(BPRP) {
7326 UNIMPLEMENTED();
7327 USE(instr);
7328 return 0;
7329 }
7160 7330
7161 EVALUATE(BPP) { return DecodeInstructionOriginal(instr); } 7331 EVALUATE(BPP) {
7332 UNIMPLEMENTED();
7333 USE(instr);
7334 return 0;
7335 }
7162 7336
7163 EVALUATE(TRTR) { return DecodeInstructionOriginal(instr); } 7337 EVALUATE(TRTR) {
7338 UNIMPLEMENTED();
7339 USE(instr);
7340 return 0;
7341 }
7164 7342
7165 EVALUATE(MVN) { return DecodeInstructionOriginal(instr); } 7343 EVALUATE(MVN) {
7344 UNIMPLEMENTED();
7345 USE(instr);
7346 return 0;
7347 }
7166 7348
7167 EVALUATE(MVC) { 7349 EVALUATE(MVC) {
7168 DCHECK_OPCODE(MVC); 7350 DCHECK_OPCODE(MVC);
7169 // Move Character 7351 // Move Character
7170 SSInstruction* ssInstr = reinterpret_cast<SSInstruction*>(instr); 7352 SSInstruction* ssInstr = reinterpret_cast<SSInstruction*>(instr);
7171 int b1 = ssInstr->B1Value(); 7353 int b1 = ssInstr->B1Value();
7172 intptr_t d1 = ssInstr->D1Value(); 7354 intptr_t d1 = ssInstr->D1Value();
7173 int b2 = ssInstr->B2Value(); 7355 int b2 = ssInstr->B2Value();
7174 intptr_t d2 = ssInstr->D2Value(); 7356 intptr_t d2 = ssInstr->D2Value();
7175 int length = ssInstr->Length(); 7357 int length = ssInstr->Length();
7176 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1); 7358 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1);
7177 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 7359 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
7178 intptr_t src_addr = b2_val + d2; 7360 intptr_t src_addr = b2_val + d2;
7179 intptr_t dst_addr = b1_val + d1; 7361 intptr_t dst_addr = b1_val + d1;
7180 // remember that the length is the actual length - 1 7362 // remember that the length is the actual length - 1
7181 for (int i = 0; i < length + 1; ++i) { 7363 for (int i = 0; i < length + 1; ++i) {
7182 WriteB(dst_addr++, ReadB(src_addr++)); 7364 WriteB(dst_addr++, ReadB(src_addr++));
7183 } 7365 }
7184 length = 6; 7366 length = 6;
7185 return length; 7367 return length;
7186 } 7368 }
7187 7369
7188 EVALUATE(MVZ) { return DecodeInstructionOriginal(instr); } 7370 EVALUATE(MVZ) {
7189 7371 UNIMPLEMENTED();
7190 EVALUATE(NC) { return DecodeInstructionOriginal(instr); } 7372 USE(instr);
7191 7373 return 0;
7192 EVALUATE(CLC) { return DecodeInstructionOriginal(instr); } 7374 }
7193 7375
7194 EVALUATE(OC) { return DecodeInstructionOriginal(instr); } 7376 EVALUATE(NC) {
7195 7377 UNIMPLEMENTED();
7196 EVALUATE(XC) { return DecodeInstructionOriginal(instr); } 7378 USE(instr);
7197 7379 return 0;
7198 EVALUATE(MVCP) { return DecodeInstructionOriginal(instr); } 7380 }
7199 7381
7200 EVALUATE(TR) { return DecodeInstructionOriginal(instr); } 7382 EVALUATE(CLC) {
7201 7383 UNIMPLEMENTED();
7202 EVALUATE(TRT) { return DecodeInstructionOriginal(instr); } 7384 USE(instr);
7203 7385 return 0;
7204 EVALUATE(ED) { return DecodeInstructionOriginal(instr); } 7386 }
7205 7387
7206 EVALUATE(EDMK) { return DecodeInstructionOriginal(instr); } 7388 EVALUATE(OC) {
7207 7389 UNIMPLEMENTED();
7208 EVALUATE(PKU) { return DecodeInstructionOriginal(instr); } 7390 USE(instr);
7209 7391 return 0;
7210 EVALUATE(UNPKU) { return DecodeInstructionOriginal(instr); } 7392 }
7211 7393
7212 EVALUATE(MVCIN) { return DecodeInstructionOriginal(instr); } 7394 EVALUATE(XC) {
7213 7395 UNIMPLEMENTED();
7214 EVALUATE(PKA) { return DecodeInstructionOriginal(instr); } 7396 USE(instr);
7215 7397 return 0;
7216 EVALUATE(UNPKA) { return DecodeInstructionOriginal(instr); } 7398 }
7217 7399
7218 EVALUATE(PLO) { return DecodeInstructionOriginal(instr); } 7400 EVALUATE(MVCP) {
7219 7401 UNIMPLEMENTED();
7220 EVALUATE(LMD) { return DecodeInstructionOriginal(instr); } 7402 USE(instr);
7221 7403 return 0;
7222 EVALUATE(SRP) { return DecodeInstructionOriginal(instr); } 7404 }
7223 7405
7224 EVALUATE(MVO) { return DecodeInstructionOriginal(instr); } 7406 EVALUATE(TR) {
7225 7407 UNIMPLEMENTED();
7226 EVALUATE(PACK) { return DecodeInstructionOriginal(instr); } 7408 USE(instr);
7227 7409 return 0;
7228 EVALUATE(UNPK) { return DecodeInstructionOriginal(instr); } 7410 }
7229 7411
7230 EVALUATE(ZAP) { return DecodeInstructionOriginal(instr); } 7412 EVALUATE(TRT) {
7231 7413 UNIMPLEMENTED();
7232 EVALUATE(AP) { return DecodeInstructionOriginal(instr); } 7414 USE(instr);
7233 7415 return 0;
7234 EVALUATE(SP) { return DecodeInstructionOriginal(instr); } 7416 }
7235 7417
7236 EVALUATE(MP) { return DecodeInstructionOriginal(instr); } 7418 EVALUATE(ED) {
7237 7419 UNIMPLEMENTED();
7238 EVALUATE(DP) { return DecodeInstructionOriginal(instr); } 7420 USE(instr);
7239 7421 return 0;
7240 EVALUATE(UPT) { return DecodeInstructionOriginal(instr); } 7422 }
7241 7423
7242 EVALUATE(PFPO) { return DecodeInstructionOriginal(instr); } 7424 EVALUATE(EDMK) {
7243 7425 UNIMPLEMENTED();
7244 EVALUATE(IIHH) { return DecodeInstructionOriginal(instr); } 7426 USE(instr);
7245 7427 return 0;
7246 EVALUATE(IIHL) { return DecodeInstructionOriginal(instr); } 7428 }
7247 7429
7248 EVALUATE(IILH) { return DecodeInstructionOriginal(instr); } 7430 EVALUATE(PKU) {
7249 7431 UNIMPLEMENTED();
7250 EVALUATE(IILL) { return DecodeInstructionOriginal(instr); } 7432 USE(instr);
7251 7433 return 0;
7252 EVALUATE(NIHH) { return DecodeInstructionOriginal(instr); } 7434 }
7253 7435
7254 EVALUATE(NIHL) { return DecodeInstructionOriginal(instr); } 7436 EVALUATE(UNPKU) {
7437 UNIMPLEMENTED();
7438 USE(instr);
7439 return 0;
7440 }
7441
7442 EVALUATE(MVCIN) {
7443 UNIMPLEMENTED();
7444 USE(instr);
7445 return 0;
7446 }
7447
7448 EVALUATE(PKA) {
7449 UNIMPLEMENTED();
7450 USE(instr);
7451 return 0;
7452 }
7453
7454 EVALUATE(UNPKA) {
7455 UNIMPLEMENTED();
7456 USE(instr);
7457 return 0;
7458 }
7459
7460 EVALUATE(PLO) {
7461 UNIMPLEMENTED();
7462 USE(instr);
7463 return 0;
7464 }
7465
7466 EVALUATE(LMD) {
7467 UNIMPLEMENTED();
7468 USE(instr);
7469 return 0;
7470 }
7471
7472 EVALUATE(SRP) {
7473 UNIMPLEMENTED();
7474 USE(instr);
7475 return 0;
7476 }
7477
7478 EVALUATE(MVO) {
7479 UNIMPLEMENTED();
7480 USE(instr);
7481 return 0;
7482 }
7483
7484 EVALUATE(PACK) {
7485 UNIMPLEMENTED();
7486 USE(instr);
7487 return 0;
7488 }
7489
7490 EVALUATE(UNPK) {
7491 UNIMPLEMENTED();
7492 USE(instr);
7493 return 0;
7494 }
7495
7496 EVALUATE(ZAP) {
7497 UNIMPLEMENTED();
7498 USE(instr);
7499 return 0;
7500 }
7501
7502 EVALUATE(AP) {
7503 UNIMPLEMENTED();
7504 USE(instr);
7505 return 0;
7506 }
7507
7508 EVALUATE(SP) {
7509 UNIMPLEMENTED();
7510 USE(instr);
7511 return 0;
7512 }
7513
7514 EVALUATE(MP) {
7515 UNIMPLEMENTED();
7516 USE(instr);
7517 return 0;
7518 }
7519
7520 EVALUATE(DP) {
7521 UNIMPLEMENTED();
7522 USE(instr);
7523 return 0;
7524 }
7525
7526 EVALUATE(UPT) {
7527 UNIMPLEMENTED();
7528 USE(instr);
7529 return 0;
7530 }
7531
7532 EVALUATE(PFPO) {
7533 UNIMPLEMENTED();
7534 USE(instr);
7535 return 0;
7536 }
7537
7538 EVALUATE(IIHH) {
7539 UNIMPLEMENTED();
7540 USE(instr);
7541 return 0;
7542 }
7543
7544 EVALUATE(IIHL) {
7545 UNIMPLEMENTED();
7546 USE(instr);
7547 return 0;
7548 }
7549
7550 EVALUATE(IILH) {
7551 UNIMPLEMENTED();
7552 USE(instr);
7553 return 0;
7554 }
7555
7556 EVALUATE(IILL) {
7557 UNIMPLEMENTED();
7558 USE(instr);
7559 return 0;
7560 }
7561
7562 EVALUATE(NIHH) {
7563 UNIMPLEMENTED();
7564 USE(instr);
7565 return 0;
7566 }
7567
7568 EVALUATE(NIHL) {
7569 UNIMPLEMENTED();
7570 USE(instr);
7571 return 0;
7572 }
7255 7573
7256 EVALUATE(NILH) { 7574 EVALUATE(NILH) {
7257 DCHECK_OPCODE(NILH); 7575 DCHECK_OPCODE(NILH);
7258 DECODE_RI_A_INSTRUCTION(instr, r1, i); 7576 DECODE_RI_A_INSTRUCTION(instr, r1, i);
7259 int32_t r1_val = get_low_register<int32_t>(r1); 7577 int32_t r1_val = get_low_register<int32_t>(r1);
7260 // CC is set based on the 16 bits that are AND'd 7578 // CC is set based on the 16 bits that are AND'd
7261 SetS390BitWiseConditionCode<uint16_t>((r1_val >> 16) & i); 7579 SetS390BitWiseConditionCode<uint16_t>((r1_val >> 16) & i);
7262 i = (i << 16) | 0x0000FFFF; 7580 i = (i << 16) | 0x0000FFFF;
7263 set_low_register(r1, r1_val & i); 7581 set_low_register(r1, r1_val & i);
7264 return length; 7582 return length;
7265 } 7583 }
7266 7584
7267 EVALUATE(NILL) { 7585 EVALUATE(NILL) {
7268 DCHECK_OPCODE(NILL); 7586 DCHECK_OPCODE(NILL);
7269 DECODE_RI_A_INSTRUCTION(instr, r1, i); 7587 DECODE_RI_A_INSTRUCTION(instr, r1, i);
7270 int32_t r1_val = get_low_register<int32_t>(r1); 7588 int32_t r1_val = get_low_register<int32_t>(r1);
7271 // CC is set based on the 16 bits that are AND'd 7589 // CC is set based on the 16 bits that are AND'd
7272 SetS390BitWiseConditionCode<uint16_t>(r1_val & i); 7590 SetS390BitWiseConditionCode<uint16_t>(r1_val & i);
7273 i |= 0xFFFF0000; 7591 i |= 0xFFFF0000;
7274 set_low_register(r1, r1_val & i); 7592 set_low_register(r1, r1_val & i);
7275 return length; 7593 return length;
7276 } 7594 }
7277 7595
7278 EVALUATE(OIHH) { return DecodeInstructionOriginal(instr); } 7596 EVALUATE(OIHH) {
7597 UNIMPLEMENTED();
7598 USE(instr);
7599 return 0;
7600 }
7279 7601
7280 EVALUATE(OIHL) { return DecodeInstructionOriginal(instr); } 7602 EVALUATE(OIHL) {
7603 UNIMPLEMENTED();
7604 USE(instr);
7605 return 0;
7606 }
7281 7607
7282 EVALUATE(OILH) { 7608 EVALUATE(OILH) {
7283 DCHECK_OPCODE(OILH); 7609 DCHECK_OPCODE(OILH);
7284 DECODE_RI_A_INSTRUCTION(instr, r1, i); 7610 DECODE_RI_A_INSTRUCTION(instr, r1, i);
7285 int32_t r1_val = get_low_register<int32_t>(r1); 7611 int32_t r1_val = get_low_register<int32_t>(r1);
7286 // CC is set based on the 16 bits that are AND'd 7612 // CC is set based on the 16 bits that are AND'd
7287 SetS390BitWiseConditionCode<uint16_t>((r1_val >> 16) | i); 7613 SetS390BitWiseConditionCode<uint16_t>((r1_val >> 16) | i);
7288 i = i << 16; 7614 i = i << 16;
7289 set_low_register(r1, r1_val | i); 7615 set_low_register(r1, r1_val | i);
7290 return length; 7616 return length;
7291 } 7617 }
7292 7618
7293 EVALUATE(OILL) { 7619 EVALUATE(OILL) {
7294 DCHECK_OPCODE(OILL); 7620 DCHECK_OPCODE(OILL);
7295 DECODE_RI_A_INSTRUCTION(instr, r1, i); 7621 DECODE_RI_A_INSTRUCTION(instr, r1, i);
7296 int32_t r1_val = get_low_register<int32_t>(r1); 7622 int32_t r1_val = get_low_register<int32_t>(r1);
7297 // CC is set based on the 16 bits that are AND'd 7623 // CC is set based on the 16 bits that are AND'd
7298 SetS390BitWiseConditionCode<uint16_t>(r1_val | i); 7624 SetS390BitWiseConditionCode<uint16_t>(r1_val | i);
7299 set_low_register(r1, r1_val | i); 7625 set_low_register(r1, r1_val | i);
7300 return length; 7626 return length;
7301 } 7627 }
7302 7628
7303 EVALUATE(LLIHH) { return DecodeInstructionOriginal(instr); } 7629 EVALUATE(LLIHH) {
7630 UNIMPLEMENTED();
7631 USE(instr);
7632 return 0;
7633 }
7304 7634
7305 EVALUATE(LLIHL) { return DecodeInstructionOriginal(instr); } 7635 EVALUATE(LLIHL) {
7636 UNIMPLEMENTED();
7637 USE(instr);
7638 return 0;
7639 }
7306 7640
7307 EVALUATE(LLILH) { return DecodeInstructionOriginal(instr); } 7641 EVALUATE(LLILH) {
7642 UNIMPLEMENTED();
7643 USE(instr);
7644 return 0;
7645 }
7308 7646
7309 EVALUATE(LLILL) { return DecodeInstructionOriginal(instr); } 7647 EVALUATE(LLILL) {
7648 UNIMPLEMENTED();
7649 USE(instr);
7650 return 0;
7651 }
7310 7652
7311 EVALUATE(TMLH) { return DecodeInstructionOriginal(instr); } 7653 EVALUATE(TMLH) {
7654 UNIMPLEMENTED();
7655 USE(instr);
7656 return 0;
7657 }
7312 7658
7313 EVALUATE(TMLL) { 7659 EVALUATE(TMLL) {
7314 DCHECK_OPCODE(TMLL); 7660 DCHECK_OPCODE(TMLL);
7315 DECODE_RI_A_INSTRUCTION(instr, r1, i2); 7661 DECODE_RI_A_INSTRUCTION(instr, r1, i2);
7316 int mask = i2 & 0x0000FFFF; 7662 int mask = i2 & 0x0000FFFF;
7317 if (mask == 0) { 7663 if (mask == 0) {
7318 condition_reg_ = 0x0; 7664 condition_reg_ = 0x0;
7319 return length; 7665 return length;
7320 } 7666 }
7321 uint32_t r1_val = get_low_register<uint32_t>(r1); 7667 uint32_t r1_val = get_low_register<uint32_t>(r1);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
7361 } else { 7707 } else {
7362 // leftmost bit is zero 7708 // leftmost bit is zero
7363 condition_reg_ = 0x4; 7709 condition_reg_ = 0x4;
7364 } 7710 }
7365 return length; // Done! 7711 return length; // Done!
7366 } 7712 }
7367 } 7713 }
7368 return length; 7714 return length;
7369 } 7715 }
7370 7716
7371 EVALUATE(TMHH) { return DecodeInstructionOriginal(instr); } 7717 EVALUATE(TMHH) {
7718 UNIMPLEMENTED();
7719 USE(instr);
7720 return 0;
7721 }
7372 7722
7373 EVALUATE(TMHL) { return DecodeInstructionOriginal(instr); } 7723 EVALUATE(TMHL) {
7724 UNIMPLEMENTED();
7725 USE(instr);
7726 return 0;
7727 }
7374 7728
7375 EVALUATE(BRAS) { 7729 EVALUATE(BRAS) {
7376 DCHECK_OPCODE(BRAS); 7730 DCHECK_OPCODE(BRAS);
7377 // Branch Relative and Save 7731 // Branch Relative and Save
7378 DECODE_RI_B_INSTRUCTION(instr, r1, d2) 7732 DECODE_RI_B_INSTRUCTION(instr, r1, d2)
7379 intptr_t pc = get_pc(); 7733 intptr_t pc = get_pc();
7380 // Set PC of next instruction to register 7734 // Set PC of next instruction to register
7381 set_register(r1, pc + sizeof(FourByteInstr)); 7735 set_register(r1, pc + sizeof(FourByteInstr));
7382 // Update PC to branch target 7736 // Update PC to branch target
7383 set_pc(pc + d2 * 2); 7737 set_pc(pc + d2 * 2);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
7472 } 7826 }
7473 7827
7474 EVALUATE(LARL) { 7828 EVALUATE(LARL) {
7475 DCHECK_OPCODE(LARL); 7829 DCHECK_OPCODE(LARL);
7476 DECODE_RIL_B_INSTRUCTION(r1, i2); 7830 DECODE_RIL_B_INSTRUCTION(r1, i2);
7477 intptr_t offset = i2 * 2; 7831 intptr_t offset = i2 * 2;
7478 set_register(r1, get_pc() + offset); 7832 set_register(r1, get_pc() + offset);
7479 return length; 7833 return length;
7480 } 7834 }
7481 7835
7482 EVALUATE(LGFI) { return DecodeInstructionOriginal(instr); } 7836 EVALUATE(LGFI) {
7837 UNIMPLEMENTED();
7838 USE(instr);
7839 return 0;
7840 }
7483 7841
7484 EVALUATE(BRASL) { 7842 EVALUATE(BRASL) {
7485 DCHECK_OPCODE(BRASL); 7843 DCHECK_OPCODE(BRASL);
7486 // Branch and Save Relative Long 7844 // Branch and Save Relative Long
7487 DECODE_RIL_B_INSTRUCTION(r1, i2); 7845 DECODE_RIL_B_INSTRUCTION(r1, i2);
7488 intptr_t d2 = i2; 7846 intptr_t d2 = i2;
7489 intptr_t pc = get_pc(); 7847 intptr_t pc = get_pc();
7490 set_register(r1, pc + 6); // save next instruction to register 7848 set_register(r1, pc + 6); // save next instruction to register
7491 set_pc(pc + d2 * 2); // update register 7849 set_pc(pc + d2 * 2); // update register
7492 return length; 7850 return length;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
7703 } 8061 }
7704 8062
7705 EVALUATE(CLFI) { 8063 EVALUATE(CLFI) {
7706 DCHECK_OPCODE(CLFI); 8064 DCHECK_OPCODE(CLFI);
7707 // Compare Logical with Immediate (32) 8065 // Compare Logical with Immediate (32)
7708 DECODE_RIL_A_INSTRUCTION(r1, imm); 8066 DECODE_RIL_A_INSTRUCTION(r1, imm);
7709 SetS390ConditionCode<uint32_t>(get_low_register<uint32_t>(r1), imm); 8067 SetS390ConditionCode<uint32_t>(get_low_register<uint32_t>(r1), imm);
7710 return length; 8068 return length;
7711 } 8069 }
7712 8070
7713 EVALUATE(LLHRL) { return DecodeInstructionOriginal(instr); } 8071 EVALUATE(LLHRL) {
7714 8072 UNIMPLEMENTED();
7715 EVALUATE(LGHRL) { return DecodeInstructionOriginal(instr); } 8073 USE(instr);
7716 8074 return 0;
7717 EVALUATE(LHRL) { return DecodeInstructionOriginal(instr); } 8075 }
7718 8076
7719 EVALUATE(LLGHRL) { return DecodeInstructionOriginal(instr); } 8077 EVALUATE(LGHRL) {
7720 8078 UNIMPLEMENTED();
7721 EVALUATE(STHRL) { return DecodeInstructionOriginal(instr); } 8079 USE(instr);
7722 8080 return 0;
7723 EVALUATE(LGRL) { return DecodeInstructionOriginal(instr); } 8081 }
7724 8082
7725 EVALUATE(STGRL) { return DecodeInstructionOriginal(instr); } 8083 EVALUATE(LHRL) {
7726 8084 UNIMPLEMENTED();
7727 EVALUATE(LGFRL) { return DecodeInstructionOriginal(instr); } 8085 USE(instr);
7728 8086 return 0;
7729 EVALUATE(LRL) { return DecodeInstructionOriginal(instr); } 8087 }
7730 8088
7731 EVALUATE(LLGFRL) { return DecodeInstructionOriginal(instr); } 8089 EVALUATE(LLGHRL) {
7732 8090 UNIMPLEMENTED();
7733 EVALUATE(STRL) { return DecodeInstructionOriginal(instr); } 8091 USE(instr);
7734 8092 return 0;
7735 EVALUATE(EXRL) { return DecodeInstructionOriginal(instr); } 8093 }
7736 8094
7737 EVALUATE(PFDRL) { return DecodeInstructionOriginal(instr); } 8095 EVALUATE(STHRL) {
7738 8096 UNIMPLEMENTED();
7739 EVALUATE(CGHRL) { return DecodeInstructionOriginal(instr); } 8097 USE(instr);
7740 8098 return 0;
7741 EVALUATE(CHRL) { return DecodeInstructionOriginal(instr); } 8099 }
7742 8100
7743 EVALUATE(CGRL) { return DecodeInstructionOriginal(instr); } 8101 EVALUATE(LGRL) {
7744 8102 UNIMPLEMENTED();
7745 EVALUATE(CGFRL) { return DecodeInstructionOriginal(instr); } 8103 USE(instr);
7746 8104 return 0;
7747 EVALUATE(ECTG) { return DecodeInstructionOriginal(instr); } 8105 }
7748 8106
7749 EVALUATE(CSST) { return DecodeInstructionOriginal(instr); } 8107 EVALUATE(STGRL) {
7750 8108 UNIMPLEMENTED();
7751 EVALUATE(LPD) { return DecodeInstructionOriginal(instr); } 8109 USE(instr);
7752 8110 return 0;
7753 EVALUATE(LPDG) { return DecodeInstructionOriginal(instr); } 8111 }
7754 8112
7755 EVALUATE(BRCTH) { return DecodeInstructionOriginal(instr); } 8113 EVALUATE(LGFRL) {
7756 8114 UNIMPLEMENTED();
7757 EVALUATE(AIH) { return DecodeInstructionOriginal(instr); } 8115 USE(instr);
7758 8116 return 0;
7759 EVALUATE(ALSIH) { return DecodeInstructionOriginal(instr); } 8117 }
7760 8118
7761 EVALUATE(ALSIHN) { return DecodeInstructionOriginal(instr); } 8119 EVALUATE(LRL) {
7762 8120 UNIMPLEMENTED();
7763 EVALUATE(CIH) { return DecodeInstructionOriginal(instr); } 8121 USE(instr);
7764 8122 return 0;
7765 EVALUATE(STCK) { return DecodeInstructionOriginal(instr); } 8123 }
7766 8124
7767 EVALUATE(CFC) { return DecodeInstructionOriginal(instr); } 8125 EVALUATE(LLGFRL) {
7768 8126 UNIMPLEMENTED();
7769 EVALUATE(IPM) { return DecodeInstructionOriginal(instr); } 8127 USE(instr);
7770 8128 return 0;
7771 EVALUATE(HSCH) { return DecodeInstructionOriginal(instr); } 8129 }
7772 8130
7773 EVALUATE(MSCH) { return DecodeInstructionOriginal(instr); } 8131 EVALUATE(STRL) {
7774 8132 UNIMPLEMENTED();
7775 EVALUATE(SSCH) { return DecodeInstructionOriginal(instr); } 8133 USE(instr);
7776 8134 return 0;
7777 EVALUATE(STSCH) { return DecodeInstructionOriginal(instr); } 8135 }
7778 8136
7779 EVALUATE(TSCH) { return DecodeInstructionOriginal(instr); } 8137 EVALUATE(EXRL) {
7780 8138 UNIMPLEMENTED();
7781 EVALUATE(TPI) { return DecodeInstructionOriginal(instr); } 8139 USE(instr);
7782 8140 return 0;
7783 EVALUATE(SAL) { return DecodeInstructionOriginal(instr); } 8141 }
7784 8142
7785 EVALUATE(RSCH) { return DecodeInstructionOriginal(instr); } 8143 EVALUATE(PFDRL) {
7786 8144 UNIMPLEMENTED();
7787 EVALUATE(STCRW) { return DecodeInstructionOriginal(instr); } 8145 USE(instr);
7788 8146 return 0;
7789 EVALUATE(STCPS) { return DecodeInstructionOriginal(instr); } 8147 }
7790 8148
7791 EVALUATE(RCHP) { return DecodeInstructionOriginal(instr); } 8149 EVALUATE(CGHRL) {
7792 8150 UNIMPLEMENTED();
7793 EVALUATE(SCHM) { return DecodeInstructionOriginal(instr); } 8151 USE(instr);
7794 8152 return 0;
7795 EVALUATE(CKSM) { return DecodeInstructionOriginal(instr); } 8153 }
7796 8154
7797 EVALUATE(SAR) { return DecodeInstructionOriginal(instr); } 8155 EVALUATE(CHRL) {
7798 8156 UNIMPLEMENTED();
7799 EVALUATE(EAR) { return DecodeInstructionOriginal(instr); } 8157 USE(instr);
8158 return 0;
8159 }
8160
8161 EVALUATE(CGRL) {
8162 UNIMPLEMENTED();
8163 USE(instr);
8164 return 0;
8165 }
8166
8167 EVALUATE(CGFRL) {
8168 UNIMPLEMENTED();
8169 USE(instr);
8170 return 0;
8171 }
8172
8173 EVALUATE(ECTG) {
8174 UNIMPLEMENTED();
8175 USE(instr);
8176 return 0;
8177 }
8178
8179 EVALUATE(CSST) {
8180 UNIMPLEMENTED();
8181 USE(instr);
8182 return 0;
8183 }
8184
8185 EVALUATE(LPD) {
8186 UNIMPLEMENTED();
8187 USE(instr);
8188 return 0;
8189 }
8190
8191 EVALUATE(LPDG) {
8192 UNIMPLEMENTED();
8193 USE(instr);
8194 return 0;
8195 }
8196
8197 EVALUATE(BRCTH) {
8198 UNIMPLEMENTED();
8199 USE(instr);
8200 return 0;
8201 }
8202
8203 EVALUATE(AIH) {
8204 UNIMPLEMENTED();
8205 USE(instr);
8206 return 0;
8207 }
8208
8209 EVALUATE(ALSIH) {
8210 UNIMPLEMENTED();
8211 USE(instr);
8212 return 0;
8213 }
8214
8215 EVALUATE(ALSIHN) {
8216 UNIMPLEMENTED();
8217 USE(instr);
8218 return 0;
8219 }
8220
8221 EVALUATE(CIH) {
8222 UNIMPLEMENTED();
8223 USE(instr);
8224 return 0;
8225 }
8226
8227 EVALUATE(STCK) {
8228 UNIMPLEMENTED();
8229 USE(instr);
8230 return 0;
8231 }
8232
8233 EVALUATE(CFC) {
8234 UNIMPLEMENTED();
8235 USE(instr);
8236 return 0;
8237 }
8238
8239 EVALUATE(IPM) {
8240 UNIMPLEMENTED();
8241 USE(instr);
8242 return 0;
8243 }
8244
8245 EVALUATE(HSCH) {
8246 UNIMPLEMENTED();
8247 USE(instr);
8248 return 0;
8249 }
8250
8251 EVALUATE(MSCH) {
8252 UNIMPLEMENTED();
8253 USE(instr);
8254 return 0;
8255 }
8256
8257 EVALUATE(SSCH) {
8258 UNIMPLEMENTED();
8259 USE(instr);
8260 return 0;
8261 }
8262
8263 EVALUATE(STSCH) {
8264 UNIMPLEMENTED();
8265 USE(instr);
8266 return 0;
8267 }
8268
8269 EVALUATE(TSCH) {
8270 UNIMPLEMENTED();
8271 USE(instr);
8272 return 0;
8273 }
8274
8275 EVALUATE(TPI) {
8276 UNIMPLEMENTED();
8277 USE(instr);
8278 return 0;
8279 }
8280
8281 EVALUATE(SAL) {
8282 UNIMPLEMENTED();
8283 USE(instr);
8284 return 0;
8285 }
8286
8287 EVALUATE(RSCH) {
8288 UNIMPLEMENTED();
8289 USE(instr);
8290 return 0;
8291 }
8292
8293 EVALUATE(STCRW) {
8294 UNIMPLEMENTED();
8295 USE(instr);
8296 return 0;
8297 }
8298
8299 EVALUATE(STCPS) {
8300 UNIMPLEMENTED();
8301 USE(instr);
8302 return 0;
8303 }
8304
8305 EVALUATE(RCHP) {
8306 UNIMPLEMENTED();
8307 USE(instr);
8308 return 0;
8309 }
8310
8311 EVALUATE(SCHM) {
8312 UNIMPLEMENTED();
8313 USE(instr);
8314 return 0;
8315 }
8316
8317 EVALUATE(CKSM) {
8318 UNIMPLEMENTED();
8319 USE(instr);
8320 return 0;
8321 }
8322
8323 EVALUATE(SAR) {
8324 UNIMPLEMENTED();
8325 USE(instr);
8326 return 0;
8327 }
8328
8329 EVALUATE(EAR) {
8330 UNIMPLEMENTED();
8331 USE(instr);
8332 return 0;
8333 }
7800 8334
7801 EVALUATE(MSR) { 8335 EVALUATE(MSR) {
7802 DCHECK_OPCODE(MSR); 8336 DCHECK_OPCODE(MSR);
7803 DECODE_RRE_INSTRUCTION(r1, r2); 8337 DECODE_RRE_INSTRUCTION(r1, r2);
7804 int32_t r1_val = get_low_register<int32_t>(r1); 8338 int32_t r1_val = get_low_register<int32_t>(r1);
7805 int32_t r2_val = get_low_register<int32_t>(r2); 8339 int32_t r2_val = get_low_register<int32_t>(r2);
7806 set_low_register(r1, r1_val * r2_val); 8340 set_low_register(r1, r1_val * r2_val);
7807 return length; 8341 return length;
7808 } 8342 }
7809 8343
7810 EVALUATE(MVST) { return DecodeInstructionOriginal(instr); } 8344 EVALUATE(MVST) {
8345 UNIMPLEMENTED();
8346 USE(instr);
8347 return 0;
8348 }
7811 8349
7812 EVALUATE(CUSE) { return DecodeInstructionOriginal(instr); } 8350 EVALUATE(CUSE) {
8351 UNIMPLEMENTED();
8352 USE(instr);
8353 return 0;
8354 }
7813 8355
7814 EVALUATE(SRST) { return DecodeInstructionOriginal(instr); } 8356 EVALUATE(SRST) {
8357 UNIMPLEMENTED();
8358 USE(instr);
8359 return 0;
8360 }
7815 8361
7816 EVALUATE(XSCH) { return DecodeInstructionOriginal(instr); } 8362 EVALUATE(XSCH) {
8363 UNIMPLEMENTED();
8364 USE(instr);
8365 return 0;
8366 }
7817 8367
7818 EVALUATE(STCKE) { return DecodeInstructionOriginal(instr); } 8368 EVALUATE(STCKE) {
8369 UNIMPLEMENTED();
8370 USE(instr);
8371 return 0;
8372 }
7819 8373
7820 EVALUATE(STCKF) { return DecodeInstructionOriginal(instr); } 8374 EVALUATE(STCKF) {
8375 UNIMPLEMENTED();
8376 USE(instr);
8377 return 0;
8378 }
7821 8379
7822 EVALUATE(SRNM) { return DecodeInstructionOriginal(instr); } 8380 EVALUATE(SRNM) {
8381 UNIMPLEMENTED();
8382 USE(instr);
8383 return 0;
8384 }
7823 8385
7824 EVALUATE(STFPC) { return DecodeInstructionOriginal(instr); } 8386 EVALUATE(STFPC) {
8387 UNIMPLEMENTED();
8388 USE(instr);
8389 return 0;
8390 }
7825 8391
7826 EVALUATE(LFPC) { return DecodeInstructionOriginal(instr); } 8392 EVALUATE(LFPC) {
8393 UNIMPLEMENTED();
8394 USE(instr);
8395 return 0;
8396 }
7827 8397
7828 EVALUATE(TRE) { return DecodeInstructionOriginal(instr); } 8398 EVALUATE(TRE) {
8399 UNIMPLEMENTED();
8400 USE(instr);
8401 return 0;
8402 }
7829 8403
7830 EVALUATE(CUUTF) { return DecodeInstructionOriginal(instr); } 8404 EVALUATE(CUUTF) {
8405 UNIMPLEMENTED();
8406 USE(instr);
8407 return 0;
8408 }
7831 8409
7832 EVALUATE(CUTFU) { return DecodeInstructionOriginal(instr); } 8410 EVALUATE(CUTFU) {
8411 UNIMPLEMENTED();
8412 USE(instr);
8413 return 0;
8414 }
7833 8415
7834 EVALUATE(STFLE) { return DecodeInstructionOriginal(instr); } 8416 EVALUATE(STFLE) {
8417 UNIMPLEMENTED();
8418 USE(instr);
8419 return 0;
8420 }
7835 8421
7836 EVALUATE(SRNMB) { return DecodeInstructionOriginal(instr); } 8422 EVALUATE(SRNMB) {
8423 UNIMPLEMENTED();
8424 USE(instr);
8425 return 0;
8426 }
7837 8427
7838 EVALUATE(SRNMT) { return DecodeInstructionOriginal(instr); } 8428 EVALUATE(SRNMT) {
8429 UNIMPLEMENTED();
8430 USE(instr);
8431 return 0;
8432 }
7839 8433
7840 EVALUATE(LFAS) { return DecodeInstructionOriginal(instr); } 8434 EVALUATE(LFAS) {
8435 UNIMPLEMENTED();
8436 USE(instr);
8437 return 0;
8438 }
7841 8439
7842 EVALUATE(PPA) { return DecodeInstructionOriginal(instr); } 8440 EVALUATE(PPA) {
8441 UNIMPLEMENTED();
8442 USE(instr);
8443 return 0;
8444 }
7843 8445
7844 EVALUATE(ETND) { return DecodeInstructionOriginal(instr); } 8446 EVALUATE(ETND) {
8447 UNIMPLEMENTED();
8448 USE(instr);
8449 return 0;
8450 }
7845 8451
7846 EVALUATE(TEND) { return DecodeInstructionOriginal(instr); } 8452 EVALUATE(TEND) {
8453 UNIMPLEMENTED();
8454 USE(instr);
8455 return 0;
8456 }
7847 8457
7848 EVALUATE(NIAI) { return DecodeInstructionOriginal(instr); } 8458 EVALUATE(NIAI) {
8459 UNIMPLEMENTED();
8460 USE(instr);
8461 return 0;
8462 }
7849 8463
7850 EVALUATE(TABORT) { return DecodeInstructionOriginal(instr); } 8464 EVALUATE(TABORT) {
8465 UNIMPLEMENTED();
8466 USE(instr);
8467 return 0;
8468 }
7851 8469
7852 EVALUATE(TRAP4) { return DecodeInstructionOriginal(instr); } 8470 EVALUATE(TRAP4) {
8471 DCHECK_OPCODE(TRAP4);
8472 int length = 4;
8473 // whack the space of the caller allocated stack
8474 int64_t sp_addr = get_register(sp);
8475 for (int i = 0; i < kCalleeRegisterSaveAreaSize / kPointerSize; ++i) {
8476 // we dont want to whack the RA (r14)
8477 if (i != 14) (reinterpret_cast<intptr_t*>(sp_addr))[i] = 0xdeadbabe;
8478 }
8479 SoftwareInterrupt(instr);
8480 return length;
8481 }
7853 8482
7854 EVALUATE(LPEBR) { 8483 EVALUATE(LPEBR) {
7855 DCHECK_OPCODE(LPEBR); 8484 DCHECK_OPCODE(LPEBR);
7856 DECODE_RRE_INSTRUCTION(r1, r2); 8485 DECODE_RRE_INSTRUCTION(r1, r2);
7857 float fr1_val = get_float32_from_d_register(r1); 8486 float fr1_val = get_float32_from_d_register(r1);
7858 float fr2_val = get_float32_from_d_register(r2); 8487 float fr2_val = get_float32_from_d_register(r2);
7859 fr1_val = std::fabs(fr2_val); 8488 fr1_val = std::fabs(fr2_val);
7860 set_d_register_from_float32(r1, fr1_val); 8489 set_d_register_from_float32(r1, fr1_val);
7861 if (fr2_val != fr2_val) { // input is NaN 8490 if (fr2_val != fr2_val) { // input is NaN
7862 condition_reg_ = CC_OF; 8491 condition_reg_ = CC_OF;
7863 } else if (fr2_val == 0) { 8492 } else if (fr2_val == 0) {
7864 condition_reg_ = CC_EQ; 8493 condition_reg_ = CC_EQ;
7865 } else { 8494 } else {
7866 condition_reg_ = CC_GT; 8495 condition_reg_ = CC_GT;
7867 } 8496 }
7868 8497
7869 return length; 8498 return length;
7870 } 8499 }
7871 8500
7872 EVALUATE(LNEBR) { return DecodeInstructionOriginal(instr); } 8501 EVALUATE(LNEBR) {
8502 UNIMPLEMENTED();
8503 USE(instr);
8504 return 0;
8505 }
7873 8506
7874 EVALUATE(LTEBR) { 8507 EVALUATE(LTEBR) {
7875 DCHECK_OPCODE(LTEBR); 8508 DCHECK_OPCODE(LTEBR);
7876 DECODE_RRE_INSTRUCTION(r1, r2); 8509 DECODE_RRE_INSTRUCTION(r1, r2);
7877 int64_t r2_val = get_d_register(r2); 8510 int64_t r2_val = get_d_register(r2);
7878 float fr2_val = get_float32_from_d_register(r2); 8511 float fr2_val = get_float32_from_d_register(r2);
7879 SetS390ConditionCode<float>(fr2_val, 0.0); 8512 SetS390ConditionCode<float>(fr2_val, 0.0);
7880 set_d_register(r1, r2_val); 8513 set_d_register(r1, r2_val);
7881 return length; 8514 return length;
7882 } 8515 }
7883 8516
7884 EVALUATE(LCEBR) { return DecodeInstructionOriginal(instr); } 8517 EVALUATE(LCEBR) {
8518 UNIMPLEMENTED();
8519 USE(instr);
8520 return 0;
8521 }
7885 8522
7886 EVALUATE(LDEBR) { 8523 EVALUATE(LDEBR) {
7887 DCHECK_OPCODE(LDEBR); 8524 DCHECK_OPCODE(LDEBR);
7888 DECODE_RRE_INSTRUCTION(r1, r2); 8525 DECODE_RRE_INSTRUCTION(r1, r2);
7889 float fp_val = get_float32_from_d_register(r2); 8526 float fp_val = get_float32_from_d_register(r2);
7890 double db_val = static_cast<double>(fp_val); 8527 double db_val = static_cast<double>(fp_val);
7891 set_d_register_from_double(r1, db_val); 8528 set_d_register_from_double(r1, db_val);
7892 return length; 8529 return length;
7893 } 8530 }
7894 8531
7895 EVALUATE(LXDBR) { return DecodeInstructionOriginal(instr); } 8532 EVALUATE(LXDBR) {
8533 UNIMPLEMENTED();
8534 USE(instr);
8535 return 0;
8536 }
7896 8537
7897 EVALUATE(LXEBR) { return DecodeInstructionOriginal(instr); } 8538 EVALUATE(LXEBR) {
8539 UNIMPLEMENTED();
8540 USE(instr);
8541 return 0;
8542 }
7898 8543
7899 EVALUATE(MXDBR) { return DecodeInstructionOriginal(instr); } 8544 EVALUATE(MXDBR) {
8545 UNIMPLEMENTED();
8546 USE(instr);
8547 return 0;
8548 }
7900 8549
7901 EVALUATE(KEBR) { return DecodeInstructionOriginal(instr); } 8550 EVALUATE(KEBR) {
8551 UNIMPLEMENTED();
8552 USE(instr);
8553 return 0;
8554 }
7902 8555
7903 EVALUATE(CEBR) { 8556 EVALUATE(CEBR) {
7904 DCHECK_OPCODE(CEBR); 8557 DCHECK_OPCODE(CEBR);
7905 DECODE_RRE_INSTRUCTION(r1, r2); 8558 DECODE_RRE_INSTRUCTION(r1, r2);
7906 float fr1_val = get_float32_from_d_register(r1); 8559 float fr1_val = get_float32_from_d_register(r1);
7907 float fr2_val = get_float32_from_d_register(r2); 8560 float fr2_val = get_float32_from_d_register(r2);
7908 if (isNaN(fr1_val) || isNaN(fr2_val)) { 8561 if (isNaN(fr1_val) || isNaN(fr2_val)) {
7909 condition_reg_ = CC_OF; 8562 condition_reg_ = CC_OF;
7910 } else { 8563 } else {
7911 SetS390ConditionCode<float>(fr1_val, fr2_val); 8564 SetS390ConditionCode<float>(fr1_val, fr2_val);
(...skipping 19 matching lines...) Expand all
7931 DECODE_RRE_INSTRUCTION(r1, r2); 8584 DECODE_RRE_INSTRUCTION(r1, r2);
7932 float fr1_val = get_float32_from_d_register(r1); 8585 float fr1_val = get_float32_from_d_register(r1);
7933 float fr2_val = get_float32_from_d_register(r2); 8586 float fr2_val = get_float32_from_d_register(r2);
7934 fr1_val -= fr2_val; 8587 fr1_val -= fr2_val;
7935 set_d_register_from_float32(r1, fr1_val); 8588 set_d_register_from_float32(r1, fr1_val);
7936 SetS390ConditionCode<float>(fr1_val, 0); 8589 SetS390ConditionCode<float>(fr1_val, 0);
7937 8590
7938 return length; 8591 return length;
7939 } 8592 }
7940 8593
7941 EVALUATE(MDEBR) { return DecodeInstructionOriginal(instr); } 8594 EVALUATE(MDEBR) {
8595 UNIMPLEMENTED();
8596 USE(instr);
8597 return 0;
8598 }
7942 8599
7943 EVALUATE(DEBR) { 8600 EVALUATE(DEBR) {
7944 DCHECK_OPCODE(DEBR); 8601 DCHECK_OPCODE(DEBR);
7945 DECODE_RRE_INSTRUCTION(r1, r2); 8602 DECODE_RRE_INSTRUCTION(r1, r2);
7946 float fr1_val = get_float32_from_d_register(r1); 8603 float fr1_val = get_float32_from_d_register(r1);
7947 float fr2_val = get_float32_from_d_register(r2); 8604 float fr2_val = get_float32_from_d_register(r2);
7948 fr1_val /= fr2_val; 8605 fr1_val /= fr2_val;
7949 set_d_register_from_float32(r1, fr1_val); 8606 set_d_register_from_float32(r1, fr1_val);
7950 SetS390ConditionCode<float>(fr1_val, 0); 8607 SetS390ConditionCode<float>(fr1_val, 0);
7951 8608
7952 return length; 8609 return length;
7953 } 8610 }
7954 8611
7955 EVALUATE(MAEBR) { return DecodeInstructionOriginal(instr); } 8612 EVALUATE(MAEBR) {
8613 UNIMPLEMENTED();
8614 USE(instr);
8615 return 0;
8616 }
7956 8617
7957 EVALUATE(MSEBR) { return DecodeInstructionOriginal(instr); } 8618 EVALUATE(MSEBR) {
8619 UNIMPLEMENTED();
8620 USE(instr);
8621 return 0;
8622 }
7958 8623
7959 EVALUATE(LPDBR) { 8624 EVALUATE(LPDBR) {
7960 DCHECK_OPCODE(LPDBR); 8625 DCHECK_OPCODE(LPDBR);
7961 DECODE_RRE_INSTRUCTION(r1, r2); 8626 DECODE_RRE_INSTRUCTION(r1, r2);
7962 double r1_val = get_double_from_d_register(r1); 8627 double r1_val = get_double_from_d_register(r1);
7963 double r2_val = get_double_from_d_register(r2); 8628 double r2_val = get_double_from_d_register(r2);
7964 r1_val = std::fabs(r2_val); 8629 r1_val = std::fabs(r2_val);
7965 set_d_register_from_double(r1, r1_val); 8630 set_d_register_from_double(r1, r1_val);
7966 if (r2_val != r2_val) { // input is NaN 8631 if (r2_val != r2_val) { // input is NaN
7967 condition_reg_ = CC_OF; 8632 condition_reg_ = CC_OF;
7968 } else if (r2_val == 0) { 8633 } else if (r2_val == 0) {
7969 condition_reg_ = CC_EQ; 8634 condition_reg_ = CC_EQ;
7970 } else { 8635 } else {
7971 condition_reg_ = CC_GT; 8636 condition_reg_ = CC_GT;
7972 } 8637 }
7973 return length; 8638 return length;
7974 } 8639 }
7975 8640
7976 EVALUATE(LNDBR) { return DecodeInstructionOriginal(instr); } 8641 EVALUATE(LNDBR) {
8642 UNIMPLEMENTED();
8643 USE(instr);
8644 return 0;
8645 }
7977 8646
7978 EVALUATE(LTDBR) { 8647 EVALUATE(LTDBR) {
7979 DCHECK_OPCODE(LTDBR); 8648 DCHECK_OPCODE(LTDBR);
7980 DECODE_RRE_INSTRUCTION(r1, r2); 8649 DECODE_RRE_INSTRUCTION(r1, r2);
7981 int64_t r2_val = get_d_register(r2); 8650 int64_t r2_val = get_d_register(r2);
7982 SetS390ConditionCode<double>(bit_cast<double, int64_t>(r2_val), 0.0); 8651 SetS390ConditionCode<double>(bit_cast<double, int64_t>(r2_val), 0.0);
7983 set_d_register(r1, r2_val); 8652 set_d_register(r1, r2_val);
7984 return length; 8653 return length;
7985 } 8654 }
7986 8655
(...skipping 29 matching lines...) Expand all
8016 EVALUATE(SQDBR) { 8685 EVALUATE(SQDBR) {
8017 DCHECK_OPCODE(SQDBR); 8686 DCHECK_OPCODE(SQDBR);
8018 DECODE_RRE_INSTRUCTION(r1, r2); 8687 DECODE_RRE_INSTRUCTION(r1, r2);
8019 double r1_val = get_double_from_d_register(r1); 8688 double r1_val = get_double_from_d_register(r1);
8020 double r2_val = get_double_from_d_register(r2); 8689 double r2_val = get_double_from_d_register(r2);
8021 r1_val = std::sqrt(r2_val); 8690 r1_val = std::sqrt(r2_val);
8022 set_d_register_from_double(r1, r1_val); 8691 set_d_register_from_double(r1, r1_val);
8023 return length; 8692 return length;
8024 } 8693 }
8025 8694
8026 EVALUATE(SQXBR) { return DecodeInstructionOriginal(instr); } 8695 EVALUATE(SQXBR) {
8696 UNIMPLEMENTED();
8697 USE(instr);
8698 return 0;
8699 }
8027 8700
8028 EVALUATE(MEEBR) { 8701 EVALUATE(MEEBR) {
8029 DCHECK_OPCODE(MEEBR); 8702 DCHECK_OPCODE(MEEBR);
8030 DECODE_RRE_INSTRUCTION(r1, r2); 8703 DECODE_RRE_INSTRUCTION(r1, r2);
8031 float fr1_val = get_float32_from_d_register(r1); 8704 float fr1_val = get_float32_from_d_register(r1);
8032 float fr2_val = get_float32_from_d_register(r2); 8705 float fr2_val = get_float32_from_d_register(r2);
8033 fr1_val *= fr2_val; 8706 fr1_val *= fr2_val;
8034 set_d_register_from_float32(r1, fr1_val); 8707 set_d_register_from_float32(r1, fr1_val);
8035 SetS390ConditionCode<float>(fr1_val, 0); 8708 SetS390ConditionCode<float>(fr1_val, 0);
8036 return length; 8709 return length;
8037 } 8710 }
8038 8711
8039 EVALUATE(KDBR) { return DecodeInstructionOriginal(instr); } 8712 EVALUATE(KDBR) {
8713 UNIMPLEMENTED();
8714 USE(instr);
8715 return 0;
8716 }
8040 8717
8041 EVALUATE(CDBR) { 8718 EVALUATE(CDBR) {
8042 DCHECK_OPCODE(CDBR); 8719 DCHECK_OPCODE(CDBR);
8043 DECODE_RRE_INSTRUCTION(r1, r2); 8720 DECODE_RRE_INSTRUCTION(r1, r2);
8044 double r1_val = get_double_from_d_register(r1); 8721 double r1_val = get_double_from_d_register(r1);
8045 double r2_val = get_double_from_d_register(r2); 8722 double r2_val = get_double_from_d_register(r2);
8046 if (isNaN(r1_val) || isNaN(r2_val)) { 8723 if (isNaN(r1_val) || isNaN(r2_val)) {
8047 condition_reg_ = CC_OF; 8724 condition_reg_ = CC_OF;
8048 } else { 8725 } else {
8049 SetS390ConditionCode<double>(r1_val, r2_val); 8726 SetS390ConditionCode<double>(r1_val, r2_val);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
8100 DECODE_RRD_INSTRUCTION(r1, r2, r3); 8777 DECODE_RRD_INSTRUCTION(r1, r2, r3);
8101 double r1_val = get_double_from_d_register(r1); 8778 double r1_val = get_double_from_d_register(r1);
8102 double r2_val = get_double_from_d_register(r2); 8779 double r2_val = get_double_from_d_register(r2);
8103 double r3_val = get_double_from_d_register(r3); 8780 double r3_val = get_double_from_d_register(r3);
8104 r1_val += r2_val * r3_val; 8781 r1_val += r2_val * r3_val;
8105 set_d_register_from_double(r1, r1_val); 8782 set_d_register_from_double(r1, r1_val);
8106 SetS390ConditionCode<double>(r1_val, 0); 8783 SetS390ConditionCode<double>(r1_val, 0);
8107 return length; 8784 return length;
8108 } 8785 }
8109 8786
8110 EVALUATE(MSDBR) { return DecodeInstructionOriginal(instr); } 8787 EVALUATE(MSDBR) {
8788 UNIMPLEMENTED();
8789 USE(instr);
8790 return 0;
8791 }
8111 8792
8112 EVALUATE(LPXBR) { return DecodeInstructionOriginal(instr); } 8793 EVALUATE(LPXBR) {
8794 UNIMPLEMENTED();
8795 USE(instr);
8796 return 0;
8797 }
8113 8798
8114 EVALUATE(LNXBR) { return DecodeInstructionOriginal(instr); } 8799 EVALUATE(LNXBR) {
8800 UNIMPLEMENTED();
8801 USE(instr);
8802 return 0;
8803 }
8115 8804
8116 EVALUATE(LTXBR) { return DecodeInstructionOriginal(instr); } 8805 EVALUATE(LTXBR) {
8806 UNIMPLEMENTED();
8807 USE(instr);
8808 return 0;
8809 }
8117 8810
8118 EVALUATE(LCXBR) { return DecodeInstructionOriginal(instr); } 8811 EVALUATE(LCXBR) {
8812 UNIMPLEMENTED();
8813 USE(instr);
8814 return 0;
8815 }
8119 8816
8120 EVALUATE(LEDBRA) { return DecodeInstructionOriginal(instr); } 8817 EVALUATE(LEDBRA) {
8818 DCHECK_OPCODE(LEDBRA);
8819 DECODE_RRE_INSTRUCTION(r1, r2);
8820 double r2_val = get_double_from_d_register(r2);
8821 set_d_register_from_float32(r1, static_cast<float>(r2_val));
8822 return length;
8823 }
8121 8824
8122 EVALUATE(LDXBRA) { return DecodeInstructionOriginal(instr); } 8825 EVALUATE(LDXBRA) {
8826 UNIMPLEMENTED();
8827 USE(instr);
8828 return 0;
8829 }
8123 8830
8124 EVALUATE(LEXBRA) { return DecodeInstructionOriginal(instr); } 8831 EVALUATE(LEXBRA) {
8832 UNIMPLEMENTED();
8833 USE(instr);
8834 return 0;
8835 }
8125 8836
8126 EVALUATE(FIXBRA) { return DecodeInstructionOriginal(instr); } 8837 EVALUATE(FIXBRA) {
8838 UNIMPLEMENTED();
8839 USE(instr);
8840 return 0;
8841 }
8127 8842
8128 EVALUATE(KXBR) { return DecodeInstructionOriginal(instr); } 8843 EVALUATE(KXBR) {
8844 UNIMPLEMENTED();
8845 USE(instr);
8846 return 0;
8847 }
8129 8848
8130 EVALUATE(CXBR) { return DecodeInstructionOriginal(instr); } 8849 EVALUATE(CXBR) {
8850 UNIMPLEMENTED();
8851 USE(instr);
8852 return 0;
8853 }
8131 8854
8132 EVALUATE(AXBR) { return DecodeInstructionOriginal(instr); } 8855 EVALUATE(AXBR) {
8856 UNIMPLEMENTED();
8857 USE(instr);
8858 return 0;
8859 }
8133 8860
8134 EVALUATE(SXBR) { return DecodeInstructionOriginal(instr); } 8861 EVALUATE(SXBR) {
8862 UNIMPLEMENTED();
8863 USE(instr);
8864 return 0;
8865 }
8135 8866
8136 EVALUATE(MXBR) { return DecodeInstructionOriginal(instr); } 8867 EVALUATE(MXBR) {
8868 UNIMPLEMENTED();
8869 USE(instr);
8870 return 0;
8871 }
8137 8872
8138 EVALUATE(DXBR) { return DecodeInstructionOriginal(instr); } 8873 EVALUATE(DXBR) {
8874 UNIMPLEMENTED();
8875 USE(instr);
8876 return 0;
8877 }
8139 8878
8140 EVALUATE(TBEDR) { return DecodeInstructionOriginal(instr); } 8879 EVALUATE(TBEDR) {
8880 UNIMPLEMENTED();
8881 USE(instr);
8882 return 0;
8883 }
8141 8884
8142 EVALUATE(TBDR) { return DecodeInstructionOriginal(instr); } 8885 EVALUATE(TBDR) {
8886 UNIMPLEMENTED();
8887 USE(instr);
8888 return 0;
8889 }
8143 8890
8144 EVALUATE(DIEBR) { return DecodeInstructionOriginal(instr); } 8891 EVALUATE(DIEBR) {
8892 UNIMPLEMENTED();
8893 USE(instr);
8894 return 0;
8895 }
8145 8896
8146 EVALUATE(FIEBRA) { 8897 EVALUATE(FIEBRA) {
8147 DCHECK_OPCODE(FIEBRA); 8898 DCHECK_OPCODE(FIEBRA);
8148 DECODE_RRF_E_INSTRUCTION(r1, r2, m3, m4); 8899 DECODE_RRF_E_INSTRUCTION(r1, r2, m3, m4);
8149 float r2_val = get_float32_from_d_register(r2); 8900 float r2_val = get_float32_from_d_register(r2);
8150 CHECK(m4 == 0); 8901 CHECK(m4 == 0);
8151 switch (m3) { 8902 switch (m3) {
8152 case Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0: 8903 case Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0:
8153 set_d_register_from_float32(r1, round(r2_val)); 8904 set_d_register_from_float32(r1, round(r2_val));
8154 break; 8905 break;
8155 case Assembler::FIDBRA_ROUND_TOWARD_0: 8906 case Assembler::FIDBRA_ROUND_TOWARD_0:
8156 set_d_register_from_float32(r1, trunc(r2_val)); 8907 set_d_register_from_float32(r1, trunc(r2_val));
8157 break; 8908 break;
8158 case Assembler::FIDBRA_ROUND_TOWARD_POS_INF: 8909 case Assembler::FIDBRA_ROUND_TOWARD_POS_INF:
8159 set_d_register_from_float32(r1, std::ceil(r2_val)); 8910 set_d_register_from_float32(r1, std::ceil(r2_val));
8160 break; 8911 break;
8161 case Assembler::FIDBRA_ROUND_TOWARD_NEG_INF: 8912 case Assembler::FIDBRA_ROUND_TOWARD_NEG_INF:
8162 set_d_register_from_float32(r1, std::floor(r2_val)); 8913 set_d_register_from_float32(r1, std::floor(r2_val));
8163 break; 8914 break;
8164 default: 8915 default:
8165 UNIMPLEMENTED(); 8916 UNIMPLEMENTED();
8166 break; 8917 break;
8167 } 8918 }
8168 return length; 8919 return length;
8169 } 8920 }
8170 8921
8171 EVALUATE(THDER) { return DecodeInstructionOriginal(instr); } 8922 EVALUATE(THDER) {
8923 UNIMPLEMENTED();
8924 USE(instr);
8925 return 0;
8926 }
8172 8927
8173 EVALUATE(THDR) { return DecodeInstructionOriginal(instr); } 8928 EVALUATE(THDR) {
8929 UNIMPLEMENTED();
8930 USE(instr);
8931 return 0;
8932 }
8174 8933
8175 EVALUATE(DIDBR) { return DecodeInstructionOriginal(instr); } 8934 EVALUATE(DIDBR) {
8935 UNIMPLEMENTED();
8936 USE(instr);
8937 return 0;
8938 }
8176 8939
8177 EVALUATE(FIDBRA) { 8940 EVALUATE(FIDBRA) {
8178 DCHECK_OPCODE(FIDBRA); 8941 DCHECK_OPCODE(FIDBRA);
8179 DECODE_RRF_E_INSTRUCTION(r1, r2, m3, m4); 8942 DECODE_RRF_E_INSTRUCTION(r1, r2, m3, m4);
8180 double r2_val = get_double_from_d_register(r2); 8943 double r2_val = get_double_from_d_register(r2);
8181 CHECK(m4 == 0); 8944 CHECK(m4 == 0);
8182 switch (m3) { 8945 switch (m3) {
8183 case Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0: 8946 case Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0:
8184 set_d_register_from_double(r1, round(r2_val)); 8947 set_d_register_from_double(r1, round(r2_val));
8185 break; 8948 break;
8186 case Assembler::FIDBRA_ROUND_TOWARD_0: 8949 case Assembler::FIDBRA_ROUND_TOWARD_0:
8187 set_d_register_from_double(r1, trunc(r2_val)); 8950 set_d_register_from_double(r1, trunc(r2_val));
8188 break; 8951 break;
8189 case Assembler::FIDBRA_ROUND_TOWARD_POS_INF: 8952 case Assembler::FIDBRA_ROUND_TOWARD_POS_INF:
8190 set_d_register_from_double(r1, std::ceil(r2_val)); 8953 set_d_register_from_double(r1, std::ceil(r2_val));
8191 break; 8954 break;
8192 case Assembler::FIDBRA_ROUND_TOWARD_NEG_INF: 8955 case Assembler::FIDBRA_ROUND_TOWARD_NEG_INF:
8193 set_d_register_from_double(r1, std::floor(r2_val)); 8956 set_d_register_from_double(r1, std::floor(r2_val));
8194 break; 8957 break;
8195 default: 8958 default:
8196 UNIMPLEMENTED(); 8959 UNIMPLEMENTED();
8197 break; 8960 break;
8198 } 8961 }
8199 return length; 8962 return length;
8200 } 8963 }
8201 8964
8202 EVALUATE(LXR) { return DecodeInstructionOriginal(instr); } 8965 EVALUATE(LXR) {
8966 UNIMPLEMENTED();
8967 USE(instr);
8968 return 0;
8969 }
8203 8970
8204 EVALUATE(LPDFR) { return DecodeInstructionOriginal(instr); } 8971 EVALUATE(LPDFR) {
8972 UNIMPLEMENTED();
8973 USE(instr);
8974 return 0;
8975 }
8205 8976
8206 EVALUATE(LNDFR) { return DecodeInstructionOriginal(instr); } 8977 EVALUATE(LNDFR) {
8978 UNIMPLEMENTED();
8979 USE(instr);
8980 return 0;
8981 }
8207 8982
8208 EVALUATE(LCDFR) { return DecodeInstructionOriginal(instr); } 8983 EVALUATE(LCDFR) {
8984 UNIMPLEMENTED();
8985 USE(instr);
8986 return 0;
8987 }
8209 8988
8210 EVALUATE(LZER) { return DecodeInstructionOriginal(instr); } 8989 EVALUATE(LZER) {
8990 UNIMPLEMENTED();
8991 USE(instr);
8992 return 0;
8993 }
8211 8994
8212 EVALUATE(LZDR) { 8995 EVALUATE(LZDR) {
8213 DCHECK_OPCODE(LZDR); 8996 DCHECK_OPCODE(LZDR);
8214 DECODE_RRE_INSTRUCTION_NO_R2(r1); 8997 DECODE_RRE_INSTRUCTION_NO_R2(r1);
8215 set_d_register_from_double(r1, 0.0); 8998 set_d_register_from_double(r1, 0.0);
8216 return length; 8999 return length;
8217 } 9000 }
8218 9001
8219 EVALUATE(LZXR) { return DecodeInstructionOriginal(instr); } 9002 EVALUATE(LZXR) {
9003 UNIMPLEMENTED();
9004 USE(instr);
9005 return 0;
9006 }
8220 9007
8221 EVALUATE(SFPC) { return DecodeInstructionOriginal(instr); } 9008 EVALUATE(SFPC) {
9009 UNIMPLEMENTED();
9010 USE(instr);
9011 return 0;
9012 }
8222 9013
8223 EVALUATE(SFASR) { return DecodeInstructionOriginal(instr); } 9014 EVALUATE(SFASR) {
9015 UNIMPLEMENTED();
9016 USE(instr);
9017 return 0;
9018 }
8224 9019
8225 EVALUATE(EFPC) { return DecodeInstructionOriginal(instr); } 9020 EVALUATE(EFPC) {
9021 UNIMPLEMENTED();
9022 USE(instr);
9023 return 0;
9024 }
8226 9025
8227 EVALUATE(CELFBR) { 9026 EVALUATE(CELFBR) {
8228 DCHECK_OPCODE(CELFBR); 9027 DCHECK_OPCODE(CELFBR);
8229 DECODE_RRE_INSTRUCTION(r1, r2); 9028 DECODE_RRE_INSTRUCTION(r1, r2);
8230 uint32_t r2_val = get_low_register<uint32_t>(r2); 9029 uint32_t r2_val = get_low_register<uint32_t>(r2);
8231 float r1_val = static_cast<float>(r2_val); 9030 float r1_val = static_cast<float>(r2_val);
8232 set_d_register_from_float32(r1, r1_val); 9031 set_d_register_from_float32(r1, r1_val);
8233 return length; 9032 return length;
8234 } 9033 }
8235 9034
8236 EVALUATE(CDLFBR) { 9035 EVALUATE(CDLFBR) {
8237 DCHECK_OPCODE(CDLFBR); 9036 DCHECK_OPCODE(CDLFBR);
8238 DECODE_RRE_INSTRUCTION(r1, r2); 9037 DECODE_RRE_INSTRUCTION(r1, r2);
8239 uint32_t r2_val = get_low_register<uint32_t>(r2); 9038 uint32_t r2_val = get_low_register<uint32_t>(r2);
8240 double r1_val = static_cast<double>(r2_val); 9039 double r1_val = static_cast<double>(r2_val);
8241 set_d_register_from_double(r1, r1_val); 9040 set_d_register_from_double(r1, r1_val);
8242 return length; 9041 return length;
8243 } 9042 }
8244 9043
8245 EVALUATE(CXLFBR) { return DecodeInstructionOriginal(instr); } 9044 EVALUATE(CXLFBR) {
8246 9045 UNIMPLEMENTED();
8247 EVALUATE(CEFBRA) { return DecodeInstructionOriginal(instr); } 9046 USE(instr);
8248 9047 return 0;
8249 EVALUATE(CDFBRA) { return DecodeInstructionOriginal(instr); } 9048 }
8250 9049
8251 EVALUATE(CXFBRA) { return DecodeInstructionOriginal(instr); } 9050 EVALUATE(CEFBRA) {
8252 9051 DCHECK_OPCODE(CEFBRA);
8253 EVALUATE(CFEBRA) { return DecodeInstructionOriginal(instr); } 9052 DECODE_RRE_INSTRUCTION(r1, r2);
8254 9053 int32_t fr2_val = get_low_register<int32_t>(r2);
8255 EVALUATE(CFDBRA) { return DecodeInstructionOriginal(instr); } 9054 float fr1_val = static_cast<float>(fr2_val);
8256 9055 set_d_register_from_float32(r1, fr1_val);
8257 EVALUATE(CFXBRA) { return DecodeInstructionOriginal(instr); } 9056 return length;
9057 }
9058
9059 EVALUATE(CDFBRA) {
9060 DCHECK_OPCODE(CDFBRA);
9061 DECODE_RRE_INSTRUCTION(r1, r2);
9062 int32_t r2_val = get_low_register<int32_t>(r2);
9063 double r1_val = static_cast<double>(r2_val);
9064 set_d_register_from_double(r1, r1_val);
9065 return length;
9066 }
9067
9068 EVALUATE(CXFBRA) {
9069 UNIMPLEMENTED();
9070 USE(instr);
9071 return 0;
9072 }
9073
9074 EVALUATE(CFEBRA) {
9075 DCHECK_OPCODE(CFEBRA);
9076 DECODE_RRE_INSTRUCTION_M3(r1, r2, mask_val);
9077 float r2_fval = get_float32_from_d_register(r2);
9078 int32_t r1_val = 0;
9079
9080 SetS390RoundConditionCode(r2_fval, INT32_MAX, INT32_MIN);
9081
9082 switch (mask_val) {
9083 case CURRENT_ROUNDING_MODE:
9084 case ROUND_TO_PREPARE_FOR_SHORTER_PRECISION: {
9085 r1_val = static_cast<int32_t>(r2_fval);
9086 break;
9087 }
9088 case ROUND_TO_NEAREST_WITH_TIES_AWAY_FROM_0: {
9089 float ceil_val = std::ceil(r2_fval);
9090 float floor_val = std::floor(r2_fval);
9091 float sub_val1 = std::fabs(r2_fval - floor_val);
9092 float sub_val2 = std::fabs(r2_fval - ceil_val);
9093 if (sub_val1 > sub_val2) {
9094 r1_val = static_cast<int32_t>(ceil_val);
9095 } else if (sub_val1 < sub_val2) {
9096 r1_val = static_cast<int32_t>(floor_val);
9097 } else { // round away from zero:
9098 if (r2_fval > 0.0) {
9099 r1_val = static_cast<int32_t>(ceil_val);
9100 } else {
9101 r1_val = static_cast<int32_t>(floor_val);
9102 }
9103 }
9104 break;
9105 }
9106 case ROUND_TO_NEAREST_WITH_TIES_TO_EVEN: {
9107 float ceil_val = std::ceil(r2_fval);
9108 float floor_val = std::floor(r2_fval);
9109 float sub_val1 = std::fabs(r2_fval - floor_val);
9110 float sub_val2 = std::fabs(r2_fval - ceil_val);
9111 if (sub_val1 > sub_val2) {
9112 r1_val = static_cast<int32_t>(ceil_val);
9113 } else if (sub_val1 < sub_val2) {
9114 r1_val = static_cast<int32_t>(floor_val);
9115 } else { // check which one is even:
9116 int32_t c_v = static_cast<int32_t>(ceil_val);
9117 int32_t f_v = static_cast<int32_t>(floor_val);
9118 if (f_v % 2 == 0)
9119 r1_val = f_v;
9120 else
9121 r1_val = c_v;
9122 }
9123 break;
9124 }
9125 case ROUND_TOWARD_0: {
9126 // check for overflow, cast r2_fval to 64bit integer
9127 // then check value within the range of INT_MIN and INT_MAX
9128 // and set condition code accordingly
9129 int64_t temp = static_cast<int64_t>(r2_fval);
9130 if (temp < INT_MIN || temp > INT_MAX) {
9131 condition_reg_ = CC_OF;
9132 }
9133 r1_val = static_cast<int32_t>(r2_fval);
9134 break;
9135 }
9136 case ROUND_TOWARD_PLUS_INFINITE: {
9137 r1_val = static_cast<int32_t>(std::ceil(r2_fval));
9138 break;
9139 }
9140 case ROUND_TOWARD_MINUS_INFINITE: {
9141 // check for overflow, cast r2_fval to 64bit integer
9142 // then check value within the range of INT_MIN and INT_MAX
9143 // and set condition code accordingly
9144 int64_t temp = static_cast<int64_t>(std::floor(r2_fval));
9145 if (temp < INT_MIN || temp > INT_MAX) {
9146 condition_reg_ = CC_OF;
9147 }
9148 r1_val = static_cast<int32_t>(std::floor(r2_fval));
9149 break;
9150 }
9151 default:
9152 UNREACHABLE();
9153 }
9154 set_low_register(r1, r1_val);
9155 return length;
9156 }
9157
9158 EVALUATE(CFDBRA) {
9159 DCHECK_OPCODE(CFDBRA);
9160 DECODE_RRE_INSTRUCTION_M3(r1, r2, mask_val);
9161 double r2_val = get_double_from_d_register(r2);
9162 int32_t r1_val = 0;
9163
9164 SetS390RoundConditionCode(r2_val, INT32_MAX, INT32_MIN);
9165
9166 switch (mask_val) {
9167 case CURRENT_ROUNDING_MODE:
9168 case ROUND_TO_PREPARE_FOR_SHORTER_PRECISION: {
9169 r1_val = static_cast<int32_t>(r2_val);
9170 break;
9171 }
9172 case ROUND_TO_NEAREST_WITH_TIES_AWAY_FROM_0: {
9173 double ceil_val = std::ceil(r2_val);
9174 double floor_val = std::floor(r2_val);
9175 double sub_val1 = std::fabs(r2_val - floor_val);
9176 double sub_val2 = std::fabs(r2_val - ceil_val);
9177 if (sub_val1 > sub_val2) {
9178 r1_val = static_cast<int32_t>(ceil_val);
9179 } else if (sub_val1 < sub_val2) {
9180 r1_val = static_cast<int32_t>(floor_val);
9181 } else { // round away from zero:
9182 if (r2_val > 0.0) {
9183 r1_val = static_cast<int32_t>(ceil_val);
9184 } else {
9185 r1_val = static_cast<int32_t>(floor_val);
9186 }
9187 }
9188 break;
9189 }
9190 case ROUND_TO_NEAREST_WITH_TIES_TO_EVEN: {
9191 double ceil_val = std::ceil(r2_val);
9192 double floor_val = std::floor(r2_val);
9193 double sub_val1 = std::fabs(r2_val - floor_val);
9194 double sub_val2 = std::fabs(r2_val - ceil_val);
9195 if (sub_val1 > sub_val2) {
9196 r1_val = static_cast<int32_t>(ceil_val);
9197 } else if (sub_val1 < sub_val2) {
9198 r1_val = static_cast<int32_t>(floor_val);
9199 } else { // check which one is even:
9200 int32_t c_v = static_cast<int32_t>(ceil_val);
9201 int32_t f_v = static_cast<int32_t>(floor_val);
9202 if (f_v % 2 == 0)
9203 r1_val = f_v;
9204 else
9205 r1_val = c_v;
9206 }
9207 break;
9208 }
9209 case ROUND_TOWARD_0: {
9210 // check for overflow, cast r2_val to 64bit integer
9211 // then check value within the range of INT_MIN and INT_MAX
9212 // and set condition code accordingly
9213 int64_t temp = static_cast<int64_t>(r2_val);
9214 if (temp < INT_MIN || temp > INT_MAX) {
9215 condition_reg_ = CC_OF;
9216 }
9217 r1_val = static_cast<int32_t>(r2_val);
9218 break;
9219 }
9220 case ROUND_TOWARD_PLUS_INFINITE: {
9221 r1_val = static_cast<int32_t>(std::ceil(r2_val));
9222 break;
9223 }
9224 case ROUND_TOWARD_MINUS_INFINITE: {
9225 // check for overflow, cast r2_val to 64bit integer
9226 // then check value within the range of INT_MIN and INT_MAX
9227 // and set condition code accordingly
9228 int64_t temp = static_cast<int64_t>(std::floor(r2_val));
9229 if (temp < INT_MIN || temp > INT_MAX) {
9230 condition_reg_ = CC_OF;
9231 }
9232 r1_val = static_cast<int32_t>(std::floor(r2_val));
9233 break;
9234 }
9235 default:
9236 UNREACHABLE();
9237 }
9238 set_low_register(r1, r1_val);
9239 return length;
9240 }
9241
9242 EVALUATE(CFXBRA) {
9243 UNIMPLEMENTED();
9244 USE(instr);
9245 return 0;
9246 }
8258 9247
8259 EVALUATE(CLFEBR) { 9248 EVALUATE(CLFEBR) {
8260 DCHECK_OPCODE(CLFEBR); 9249 DCHECK_OPCODE(CLFEBR);
8261 DECODE_RRE_INSTRUCTION(r1, r2); 9250 DECODE_RRE_INSTRUCTION(r1, r2);
8262 float r2_val = get_float32_from_d_register(r2); 9251 float r2_val = get_float32_from_d_register(r2);
8263 uint32_t r1_val = static_cast<uint32_t>(r2_val); 9252 uint32_t r1_val = static_cast<uint32_t>(r2_val);
8264 set_low_register(r1, r1_val); 9253 set_low_register(r1, r1_val);
8265 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX); 9254 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX);
8266 return length; 9255 return length;
8267 } 9256 }
8268 9257
8269 EVALUATE(CLFDBR) { 9258 EVALUATE(CLFDBR) {
8270 DCHECK_OPCODE(CLFDBR); 9259 DCHECK_OPCODE(CLFDBR);
8271 DECODE_RRE_INSTRUCTION(r1, r2); 9260 DECODE_RRE_INSTRUCTION(r1, r2);
8272 double r2_val = get_double_from_d_register(r2); 9261 double r2_val = get_double_from_d_register(r2);
8273 uint32_t r1_val = static_cast<uint32_t>(r2_val); 9262 uint32_t r1_val = static_cast<uint32_t>(r2_val);
8274 set_low_register(r1, r1_val); 9263 set_low_register(r1, r1_val);
8275 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX); 9264 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX);
8276 return length; 9265 return length;
8277 } 9266 }
8278 9267
8279 EVALUATE(CLFXBR) { return DecodeInstructionOriginal(instr); } 9268 EVALUATE(CLFXBR) {
9269 UNIMPLEMENTED();
9270 USE(instr);
9271 return 0;
9272 }
8280 9273
8281 EVALUATE(CELGBR) { 9274 EVALUATE(CELGBR) {
8282 DCHECK_OPCODE(CELGBR); 9275 DCHECK_OPCODE(CELGBR);
8283 DECODE_RRE_INSTRUCTION(r1, r2); 9276 DECODE_RRE_INSTRUCTION(r1, r2);
8284 uint64_t r2_val = get_register(r2); 9277 uint64_t r2_val = get_register(r2);
8285 float r1_val = static_cast<float>(r2_val); 9278 float r1_val = static_cast<float>(r2_val);
8286 set_d_register_from_float32(r1, r1_val); 9279 set_d_register_from_float32(r1, r1_val);
8287 return length; 9280 return length;
8288 } 9281 }
8289 9282
8290 EVALUATE(CDLGBR) { 9283 EVALUATE(CDLGBR) {
8291 DCHECK_OPCODE(CDLGBR); 9284 DCHECK_OPCODE(CDLGBR);
8292 DECODE_RRE_INSTRUCTION(r1, r2); 9285 DECODE_RRE_INSTRUCTION(r1, r2);
8293 uint64_t r2_val = get_register(r2); 9286 uint64_t r2_val = get_register(r2);
8294 double r1_val = static_cast<double>(r2_val); 9287 double r1_val = static_cast<double>(r2_val);
8295 set_d_register_from_double(r1, r1_val); 9288 set_d_register_from_double(r1, r1_val);
8296 return length; 9289 return length;
8297 } 9290 }
8298 9291
8299 EVALUATE(CXLGBR) { return DecodeInstructionOriginal(instr); } 9292 EVALUATE(CXLGBR) {
9293 UNIMPLEMENTED();
9294 USE(instr);
9295 return 0;
9296 }
8300 9297
8301 EVALUATE(CEGBRA) { return DecodeInstructionOriginal(instr); } 9298 EVALUATE(CEGBRA) {
9299 DCHECK_OPCODE(CEGBRA);
9300 DECODE_RRE_INSTRUCTION(r1, r2);
9301 int64_t fr2_val = get_register(r2);
9302 float fr1_val = static_cast<float>(fr2_val);
9303 set_d_register_from_float32(r1, fr1_val);
9304 return length;
9305 }
8302 9306
8303 EVALUATE(CDGBRA) { return DecodeInstructionOriginal(instr); } 9307 EVALUATE(CDGBRA) {
9308 DCHECK_OPCODE(CDGBRA);
9309 DECODE_RRE_INSTRUCTION(r1, r2);
9310 int64_t r2_val = get_register(r2);
9311 double r1_val = static_cast<double>(r2_val);
9312 set_d_register_from_double(r1, r1_val);
9313 return length;
9314 }
8304 9315
8305 EVALUATE(CXGBRA) { return DecodeInstructionOriginal(instr); } 9316 EVALUATE(CXGBRA) {
9317 UNIMPLEMENTED();
9318 USE(instr);
9319 return 0;
9320 }
8306 9321
8307 EVALUATE(CGEBRA) { return DecodeInstructionOriginal(instr); } 9322 EVALUATE(CGEBRA) {
9323 DCHECK_OPCODE(CGEBRA);
9324 DECODE_RRE_INSTRUCTION_M3(r1, r2, mask_val);
9325 float r2_fval = get_float32_from_d_register(r2);
9326 int64_t r1_val = 0;
8308 9327
8309 EVALUATE(CGDBRA) { return DecodeInstructionOriginal(instr); } 9328 SetS390RoundConditionCode(r2_fval, INT64_MAX, INT64_MIN);
8310 9329
8311 EVALUATE(CGXBRA) { return DecodeInstructionOriginal(instr); } 9330 switch (mask_val) {
9331 case CURRENT_ROUNDING_MODE:
9332 case ROUND_TO_NEAREST_WITH_TIES_AWAY_FROM_0:
9333 case ROUND_TO_PREPARE_FOR_SHORTER_PRECISION: {
9334 UNIMPLEMENTED();
9335 break;
9336 }
9337 case ROUND_TO_NEAREST_WITH_TIES_TO_EVEN: {
9338 float ceil_val = std::ceil(r2_fval);
9339 float floor_val = std::floor(r2_fval);
9340 if (std::abs(r2_fval - floor_val) > std::abs(r2_fval - ceil_val)) {
9341 r1_val = static_cast<int64_t>(ceil_val);
9342 } else if (std::abs(r2_fval - floor_val) < std::abs(r2_fval - ceil_val)) {
9343 r1_val = static_cast<int64_t>(floor_val);
9344 } else { // check which one is even:
9345 int64_t c_v = static_cast<int64_t>(ceil_val);
9346 int64_t f_v = static_cast<int64_t>(floor_val);
9347 if (f_v % 2 == 0)
9348 r1_val = f_v;
9349 else
9350 r1_val = c_v;
9351 }
9352 break;
9353 }
9354 case ROUND_TOWARD_0: {
9355 r1_val = static_cast<int64_t>(r2_fval);
9356 break;
9357 }
9358 case ROUND_TOWARD_PLUS_INFINITE: {
9359 r1_val = static_cast<int64_t>(std::ceil(r2_fval));
9360 break;
9361 }
9362 case ROUND_TOWARD_MINUS_INFINITE: {
9363 r1_val = static_cast<int64_t>(std::floor(r2_fval));
9364 break;
9365 }
9366 default:
9367 UNREACHABLE();
9368 }
9369 set_register(r1, r1_val);
9370 return length;
9371 }
9372
9373 EVALUATE(CGDBRA) {
9374 DCHECK_OPCODE(CGDBRA);
9375 DECODE_RRE_INSTRUCTION_M3(r1, r2, mask_val);
9376 double r2_val = get_double_from_d_register(r2);
9377 int64_t r1_val = 0;
9378
9379 SetS390RoundConditionCode(r2_val, INT64_MAX, INT64_MIN);
9380
9381 switch (mask_val) {
9382 case CURRENT_ROUNDING_MODE:
9383 case ROUND_TO_NEAREST_WITH_TIES_AWAY_FROM_0:
9384 case ROUND_TO_PREPARE_FOR_SHORTER_PRECISION: {
9385 UNIMPLEMENTED();
9386 break;
9387 }
9388 case ROUND_TO_NEAREST_WITH_TIES_TO_EVEN: {
9389 double ceil_val = std::ceil(r2_val);
9390 double floor_val = std::floor(r2_val);
9391 if (std::abs(r2_val - floor_val) > std::abs(r2_val - ceil_val)) {
9392 r1_val = static_cast<int64_t>(ceil_val);
9393 } else if (std::abs(r2_val - floor_val) < std::abs(r2_val - ceil_val)) {
9394 r1_val = static_cast<int64_t>(floor_val);
9395 } else { // check which one is even:
9396 int64_t c_v = static_cast<int64_t>(ceil_val);
9397 int64_t f_v = static_cast<int64_t>(floor_val);
9398 if (f_v % 2 == 0)
9399 r1_val = f_v;
9400 else
9401 r1_val = c_v;
9402 }
9403 break;
9404 }
9405 case ROUND_TOWARD_0: {
9406 r1_val = static_cast<int64_t>(r2_val);
9407 break;
9408 }
9409 case ROUND_TOWARD_PLUS_INFINITE: {
9410 r1_val = static_cast<int64_t>(std::ceil(r2_val));
9411 break;
9412 }
9413 case ROUND_TOWARD_MINUS_INFINITE: {
9414 r1_val = static_cast<int64_t>(std::floor(r2_val));
9415 break;
9416 }
9417 default:
9418 UNREACHABLE();
9419 }
9420 set_register(r1, r1_val);
9421 return length;
9422 }
9423
9424 EVALUATE(CGXBRA) {
9425 UNIMPLEMENTED();
9426 USE(instr);
9427 return 0;
9428 }
8312 9429
8313 EVALUATE(CLGEBR) { 9430 EVALUATE(CLGEBR) {
8314 DCHECK_OPCODE(CLGEBR); 9431 DCHECK_OPCODE(CLGEBR);
8315 DECODE_RRE_INSTRUCTION(r1, r2); 9432 DECODE_RRE_INSTRUCTION(r1, r2);
8316 float r2_val = get_float32_from_d_register(r2); 9433 float r2_val = get_float32_from_d_register(r2);
8317 uint64_t r1_val = static_cast<uint64_t>(r2_val); 9434 uint64_t r1_val = static_cast<uint64_t>(r2_val);
8318 set_register(r1, r1_val); 9435 set_register(r1, r1_val);
8319 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT64_MAX); 9436 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT64_MAX);
8320 return length; 9437 return length;
8321 } 9438 }
8322 9439
8323 EVALUATE(CLGDBR) { 9440 EVALUATE(CLGDBR) {
8324 DCHECK_OPCODE(CLGDBR); 9441 DCHECK_OPCODE(CLGDBR);
8325 DECODE_RRE_INSTRUCTION(r1, r2); 9442 DECODE_RRE_INSTRUCTION(r1, r2);
8326 double r2_val = get_double_from_d_register(r2); 9443 double r2_val = get_double_from_d_register(r2);
8327 uint64_t r1_val = static_cast<uint64_t>(r2_val); 9444 uint64_t r1_val = static_cast<uint64_t>(r2_val);
8328 set_register(r1, r1_val); 9445 set_register(r1, r1_val);
8329 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT64_MAX); 9446 SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT64_MAX);
8330 return length; 9447 return length;
8331 } 9448 }
8332 9449
8333 EVALUATE(CFER) { return DecodeInstructionOriginal(instr); } 9450 EVALUATE(CFER) {
9451 UNIMPLEMENTED();
9452 USE(instr);
9453 return 0;
9454 }
8334 9455
8335 EVALUATE(CFDR) { return DecodeInstructionOriginal(instr); } 9456 EVALUATE(CFDR) {
9457 UNIMPLEMENTED();
9458 USE(instr);
9459 return 0;
9460 }
8336 9461
8337 EVALUATE(CFXR) { return DecodeInstructionOriginal(instr); } 9462 EVALUATE(CFXR) {
9463 UNIMPLEMENTED();
9464 USE(instr);
9465 return 0;
9466 }
8338 9467
8339 EVALUATE(LDGR) { 9468 EVALUATE(LDGR) {
8340 DCHECK_OPCODE(LDGR); 9469 DCHECK_OPCODE(LDGR);
8341 // Load FPR from GPR (L <- 64) 9470 // Load FPR from GPR (L <- 64)
8342 DECODE_RRE_INSTRUCTION(r1, r2); 9471 DECODE_RRE_INSTRUCTION(r1, r2);
8343 uint64_t int_val = get_register(r2); 9472 uint64_t int_val = get_register(r2);
8344 // double double_val = bit_cast<double, uint64_t>(int_val); 9473 // double double_val = bit_cast<double, uint64_t>(int_val);
8345 // set_d_register_from_double(rreInst->R1Value(), double_val); 9474 // set_d_register_from_double(rreInst->R1Value(), double_val);
8346 set_d_register(r1, int_val); 9475 set_d_register(r1, int_val);
8347 return length; 9476 return length;
8348 } 9477 }
8349 9478
8350 EVALUATE(CGER) { return DecodeInstructionOriginal(instr); } 9479 EVALUATE(CGER) {
9480 UNIMPLEMENTED();
9481 USE(instr);
9482 return 0;
9483 }
8351 9484
8352 EVALUATE(CGDR) { return DecodeInstructionOriginal(instr); } 9485 EVALUATE(CGDR) {
9486 UNIMPLEMENTED();
9487 USE(instr);
9488 return 0;
9489 }
8353 9490
8354 EVALUATE(CGXR) { return DecodeInstructionOriginal(instr); } 9491 EVALUATE(CGXR) {
9492 UNIMPLEMENTED();
9493 USE(instr);
9494 return 0;
9495 }
8355 9496
8356 EVALUATE(LGDR) { 9497 EVALUATE(LGDR) {
8357 DCHECK_OPCODE(LGDR); 9498 DCHECK_OPCODE(LGDR);
8358 DECODE_RRE_INSTRUCTION(r1, r2); 9499 DECODE_RRE_INSTRUCTION(r1, r2);
8359 // Load GPR from FPR (64 <- L) 9500 // Load GPR from FPR (64 <- L)
8360 int64_t double_val = get_d_register(r2); 9501 int64_t double_val = get_d_register(r2);
8361 set_register(r1, double_val); 9502 set_register(r1, double_val);
8362 return length; 9503 return length;
8363 } 9504 }
8364 9505
8365 EVALUATE(MDTR) { return DecodeInstructionOriginal(instr); } 9506 EVALUATE(MDTR) {
8366 9507 UNIMPLEMENTED();
8367 EVALUATE(MDTRA) { return DecodeInstructionOriginal(instr); } 9508 USE(instr);
8368 9509 return 0;
8369 EVALUATE(DDTRA) { return DecodeInstructionOriginal(instr); } 9510 }
8370 9511
8371 EVALUATE(ADTRA) { return DecodeInstructionOriginal(instr); } 9512 EVALUATE(MDTRA) {
8372 9513 UNIMPLEMENTED();
8373 EVALUATE(SDTRA) { return DecodeInstructionOriginal(instr); } 9514 USE(instr);
8374 9515 return 0;
8375 EVALUATE(LDETR) { return DecodeInstructionOriginal(instr); } 9516 }
8376 9517
8377 EVALUATE(LEDTR) { return DecodeInstructionOriginal(instr); } 9518 EVALUATE(DDTRA) {
8378 9519 UNIMPLEMENTED();
8379 EVALUATE(LTDTR) { return DecodeInstructionOriginal(instr); } 9520 USE(instr);
8380 9521 return 0;
8381 EVALUATE(FIDTR) { return DecodeInstructionOriginal(instr); } 9522 }
8382 9523
8383 EVALUATE(MXTRA) { return DecodeInstructionOriginal(instr); } 9524 EVALUATE(ADTRA) {
8384 9525 UNIMPLEMENTED();
8385 EVALUATE(DXTRA) { return DecodeInstructionOriginal(instr); } 9526 USE(instr);
8386 9527 return 0;
8387 EVALUATE(AXTRA) { return DecodeInstructionOriginal(instr); } 9528 }
8388 9529
8389 EVALUATE(SXTRA) { return DecodeInstructionOriginal(instr); } 9530 EVALUATE(SDTRA) {
8390 9531 UNIMPLEMENTED();
8391 EVALUATE(LXDTR) { return DecodeInstructionOriginal(instr); } 9532 USE(instr);
8392 9533 return 0;
8393 EVALUATE(LDXTR) { return DecodeInstructionOriginal(instr); } 9534 }
8394 9535
8395 EVALUATE(LTXTR) { return DecodeInstructionOriginal(instr); } 9536 EVALUATE(LDETR) {
8396 9537 UNIMPLEMENTED();
8397 EVALUATE(FIXTR) { return DecodeInstructionOriginal(instr); } 9538 USE(instr);
8398 9539 return 0;
8399 EVALUATE(KDTR) { return DecodeInstructionOriginal(instr); } 9540 }
8400 9541
8401 EVALUATE(CGDTRA) { return DecodeInstructionOriginal(instr); } 9542 EVALUATE(LEDTR) {
8402 9543 UNIMPLEMENTED();
8403 EVALUATE(CUDTR) { return DecodeInstructionOriginal(instr); } 9544 USE(instr);
8404 9545 return 0;
8405 EVALUATE(CDTR) { return DecodeInstructionOriginal(instr); } 9546 }
8406 9547
8407 EVALUATE(EEDTR) { return DecodeInstructionOriginal(instr); } 9548 EVALUATE(LTDTR) {
8408 9549 UNIMPLEMENTED();
8409 EVALUATE(ESDTR) { return DecodeInstructionOriginal(instr); } 9550 USE(instr);
8410 9551 return 0;
8411 EVALUATE(KXTR) { return DecodeInstructionOriginal(instr); } 9552 }
8412 9553
8413 EVALUATE(CGXTRA) { return DecodeInstructionOriginal(instr); } 9554 EVALUATE(FIDTR) {
8414 9555 UNIMPLEMENTED();
8415 EVALUATE(CUXTR) { return DecodeInstructionOriginal(instr); } 9556 USE(instr);
8416 9557 return 0;
8417 EVALUATE(CSXTR) { return DecodeInstructionOriginal(instr); } 9558 }
8418 9559
8419 EVALUATE(CXTR) { return DecodeInstructionOriginal(instr); } 9560 EVALUATE(MXTRA) {
8420 9561 UNIMPLEMENTED();
8421 EVALUATE(EEXTR) { return DecodeInstructionOriginal(instr); } 9562 USE(instr);
8422 9563 return 0;
8423 EVALUATE(ESXTR) { return DecodeInstructionOriginal(instr); } 9564 }
8424 9565
8425 EVALUATE(CDGTRA) { return DecodeInstructionOriginal(instr); } 9566 EVALUATE(DXTRA) {
8426 9567 UNIMPLEMENTED();
8427 EVALUATE(CDUTR) { return DecodeInstructionOriginal(instr); } 9568 USE(instr);
8428 9569 return 0;
8429 EVALUATE(CDSTR) { return DecodeInstructionOriginal(instr); } 9570 }
8430 9571
8431 EVALUATE(CEDTR) { return DecodeInstructionOriginal(instr); } 9572 EVALUATE(AXTRA) {
8432 9573 UNIMPLEMENTED();
8433 EVALUATE(QADTR) { return DecodeInstructionOriginal(instr); } 9574 USE(instr);
8434 9575 return 0;
8435 EVALUATE(IEDTR) { return DecodeInstructionOriginal(instr); } 9576 }
8436 9577
8437 EVALUATE(RRDTR) { return DecodeInstructionOriginal(instr); } 9578 EVALUATE(SXTRA) {
8438 9579 UNIMPLEMENTED();
8439 EVALUATE(CXGTRA) { return DecodeInstructionOriginal(instr); } 9580 USE(instr);
8440 9581 return 0;
8441 EVALUATE(CXUTR) { return DecodeInstructionOriginal(instr); } 9582 }
8442 9583
8443 EVALUATE(CXSTR) { return DecodeInstructionOriginal(instr); } 9584 EVALUATE(LXDTR) {
8444 9585 UNIMPLEMENTED();
8445 EVALUATE(CEXTR) { return DecodeInstructionOriginal(instr); } 9586 USE(instr);
8446 9587 return 0;
8447 EVALUATE(QAXTR) { return DecodeInstructionOriginal(instr); } 9588 }
8448 9589
8449 EVALUATE(IEXTR) { return DecodeInstructionOriginal(instr); } 9590 EVALUATE(LDXTR) {
8450 9591 UNIMPLEMENTED();
8451 EVALUATE(RRXTR) { return DecodeInstructionOriginal(instr); } 9592 USE(instr);
8452 9593 return 0;
8453 EVALUATE(LPGR) { return DecodeInstructionOriginal(instr); } 9594 }
9595
9596 EVALUATE(LTXTR) {
9597 UNIMPLEMENTED();
9598 USE(instr);
9599 return 0;
9600 }
9601
9602 EVALUATE(FIXTR) {
9603 UNIMPLEMENTED();
9604 USE(instr);
9605 return 0;
9606 }
9607
9608 EVALUATE(KDTR) {
9609 UNIMPLEMENTED();
9610 USE(instr);
9611 return 0;
9612 }
9613
9614 EVALUATE(CGDTRA) {
9615 UNIMPLEMENTED();
9616 USE(instr);
9617 return 0;
9618 }
9619
9620 EVALUATE(CUDTR) {
9621 UNIMPLEMENTED();
9622 USE(instr);
9623 return 0;
9624 }
9625
9626 EVALUATE(CDTR) {
9627 UNIMPLEMENTED();
9628 USE(instr);
9629 return 0;
9630 }
9631
9632 EVALUATE(EEDTR) {
9633 UNIMPLEMENTED();
9634 USE(instr);
9635 return 0;
9636 }
9637
9638 EVALUATE(ESDTR) {
9639 UNIMPLEMENTED();
9640 USE(instr);
9641 return 0;
9642 }
9643
9644 EVALUATE(KXTR) {
9645 UNIMPLEMENTED();
9646 USE(instr);
9647 return 0;
9648 }
9649
9650 EVALUATE(CGXTRA) {
9651 UNIMPLEMENTED();
9652 USE(instr);
9653 return 0;
9654 }
9655
9656 EVALUATE(CUXTR) {
9657 UNIMPLEMENTED();
9658 USE(instr);
9659 return 0;
9660 }
9661
9662 EVALUATE(CSXTR) {
9663 UNIMPLEMENTED();
9664 USE(instr);
9665 return 0;
9666 }
9667
9668 EVALUATE(CXTR) {
9669 UNIMPLEMENTED();
9670 USE(instr);
9671 return 0;
9672 }
9673
9674 EVALUATE(EEXTR) {
9675 UNIMPLEMENTED();
9676 USE(instr);
9677 return 0;
9678 }
9679
9680 EVALUATE(ESXTR) {
9681 UNIMPLEMENTED();
9682 USE(instr);
9683 return 0;
9684 }
9685
9686 EVALUATE(CDGTRA) {
9687 UNIMPLEMENTED();
9688 USE(instr);
9689 return 0;
9690 }
9691
9692 EVALUATE(CDUTR) {
9693 UNIMPLEMENTED();
9694 USE(instr);
9695 return 0;
9696 }
9697
9698 EVALUATE(CDSTR) {
9699 UNIMPLEMENTED();
9700 USE(instr);
9701 return 0;
9702 }
9703
9704 EVALUATE(CEDTR) {
9705 UNIMPLEMENTED();
9706 USE(instr);
9707 return 0;
9708 }
9709
9710 EVALUATE(QADTR) {
9711 UNIMPLEMENTED();
9712 USE(instr);
9713 return 0;
9714 }
9715
9716 EVALUATE(IEDTR) {
9717 UNIMPLEMENTED();
9718 USE(instr);
9719 return 0;
9720 }
9721
9722 EVALUATE(RRDTR) {
9723 UNIMPLEMENTED();
9724 USE(instr);
9725 return 0;
9726 }
9727
9728 EVALUATE(CXGTRA) {
9729 UNIMPLEMENTED();
9730 USE(instr);
9731 return 0;
9732 }
9733
9734 EVALUATE(CXUTR) {
9735 UNIMPLEMENTED();
9736 USE(instr);
9737 return 0;
9738 }
9739
9740 EVALUATE(CXSTR) {
9741 UNIMPLEMENTED();
9742 USE(instr);
9743 return 0;
9744 }
9745
9746 EVALUATE(CEXTR) {
9747 UNIMPLEMENTED();
9748 USE(instr);
9749 return 0;
9750 }
9751
9752 EVALUATE(QAXTR) {
9753 UNIMPLEMENTED();
9754 USE(instr);
9755 return 0;
9756 }
9757
9758 EVALUATE(IEXTR) {
9759 UNIMPLEMENTED();
9760 USE(instr);
9761 return 0;
9762 }
9763
9764 EVALUATE(RRXTR) {
9765 UNIMPLEMENTED();
9766 USE(instr);
9767 return 0;
9768 }
9769
9770 EVALUATE(LPGR) {
9771 UNIMPLEMENTED();
9772 USE(instr);
9773 return 0;
9774 }
8454 9775
8455 EVALUATE(LNGR) { 9776 EVALUATE(LNGR) {
8456 DCHECK_OPCODE(LNGR); 9777 DCHECK_OPCODE(LNGR);
8457 // Load Negative (64) 9778 // Load Negative (64)
8458 DECODE_RRE_INSTRUCTION(r1, r2); 9779 DECODE_RRE_INSTRUCTION(r1, r2);
8459 int64_t r2_val = get_register(r2); 9780 int64_t r2_val = get_register(r2);
8460 r2_val = (r2_val >= 0) ? -r2_val : r2_val; // If pos, then negate it. 9781 r2_val = (r2_val >= 0) ? -r2_val : r2_val; // If pos, then negate it.
8461 set_register(r1, r2_val); 9782 set_register(r1, r2_val);
8462 condition_reg_ = (r2_val == 0) ? CC_EQ : CC_LT; // CC0 - result is zero 9783 condition_reg_ = (r2_val == 0) ? CC_EQ : CC_LT; // CC0 - result is zero
8463 // CC1 - result is negative 9784 // CC1 - result is negative
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
8496 int64_t r2_val = get_register(r2); 9817 int64_t r2_val = get_register(r2);
8497 bool isOF = false; 9818 bool isOF = false;
8498 isOF = CheckOverflowForIntSub(r1_val, r2_val, int64_t); 9819 isOF = CheckOverflowForIntSub(r1_val, r2_val, int64_t);
8499 r1_val -= r2_val; 9820 r1_val -= r2_val;
8500 SetS390ConditionCode<int64_t>(r1_val, 0); 9821 SetS390ConditionCode<int64_t>(r1_val, 0);
8501 SetS390OverflowCode(isOF); 9822 SetS390OverflowCode(isOF);
8502 set_register(r1, r1_val); 9823 set_register(r1, r1_val);
8503 return length; 9824 return length;
8504 } 9825 }
8505 9826
8506 EVALUATE(ALGR) { return DecodeInstructionOriginal(instr); } 9827 EVALUATE(ALGR) {
9828 UNIMPLEMENTED();
9829 USE(instr);
9830 return 0;
9831 }
8507 9832
8508 EVALUATE(SLGR) { return DecodeInstructionOriginal(instr); } 9833 EVALUATE(SLGR) {
9834 UNIMPLEMENTED();
9835 USE(instr);
9836 return 0;
9837 }
8509 9838
8510 EVALUATE(MSGR) { 9839 EVALUATE(MSGR) {
8511 DCHECK_OPCODE(MSGR); 9840 DCHECK_OPCODE(MSGR);
8512 DECODE_RRE_INSTRUCTION(r1, r2); 9841 DECODE_RRE_INSTRUCTION(r1, r2);
8513 int64_t r1_val = get_register(r1); 9842 int64_t r1_val = get_register(r1);
8514 int64_t r2_val = get_register(r2); 9843 int64_t r2_val = get_register(r2);
8515 set_register(r1, r1_val * r2_val); 9844 set_register(r1, r1_val * r2_val);
8516 return length; 9845 return length;
8517 } 9846 }
8518 9847
8519 EVALUATE(DSGR) { 9848 EVALUATE(DSGR) {
8520 DCHECK_OPCODE(DSGR); 9849 DCHECK_OPCODE(DSGR);
8521 DECODE_RRE_INSTRUCTION(r1, r2); 9850 DECODE_RRE_INSTRUCTION(r1, r2);
8522 9851
8523 DCHECK(r1 % 2 == 0); 9852 DCHECK(r1 % 2 == 0);
8524 9853
8525 int64_t dividend = get_register(r1 + 1); 9854 int64_t dividend = get_register(r1 + 1);
8526 int64_t divisor = get_register(r2); 9855 int64_t divisor = get_register(r2);
8527 set_register(r1, dividend % divisor); 9856 set_register(r1, dividend % divisor);
8528 set_register(r1 + 1, dividend / divisor); 9857 set_register(r1 + 1, dividend / divisor);
8529 return length; 9858 return length;
8530 } 9859 }
8531 9860
8532 EVALUATE(LRVGR) { return DecodeInstructionOriginal(instr); } 9861 EVALUATE(LRVGR) {
9862 UNIMPLEMENTED();
9863 USE(instr);
9864 return 0;
9865 }
8533 9866
8534 EVALUATE(LPGFR) { return DecodeInstructionOriginal(instr); } 9867 EVALUATE(LPGFR) {
9868 UNIMPLEMENTED();
9869 USE(instr);
9870 return 0;
9871 }
8535 9872
8536 EVALUATE(LNGFR) { return DecodeInstructionOriginal(instr); } 9873 EVALUATE(LNGFR) {
9874 UNIMPLEMENTED();
9875 USE(instr);
9876 return 0;
9877 }
8537 9878
8538 EVALUATE(LTGFR) { 9879 EVALUATE(LTGFR) {
8539 DCHECK_OPCODE(LTGFR); 9880 DCHECK_OPCODE(LTGFR);
8540 DECODE_RRE_INSTRUCTION(r1, r2); 9881 DECODE_RRE_INSTRUCTION(r1, r2);
8541 // Load and Test Register (64 <- 32) (Sign Extends 32-bit val) 9882 // Load and Test Register (64 <- 32) (Sign Extends 32-bit val)
8542 // Load Register (64 <- 32) (Sign Extends 32-bit val) 9883 // Load Register (64 <- 32) (Sign Extends 32-bit val)
8543 int32_t r2_val = get_low_register<int32_t>(r2); 9884 int32_t r2_val = get_low_register<int32_t>(r2);
8544 int64_t result = static_cast<int64_t>(r2_val); 9885 int64_t result = static_cast<int64_t>(r2_val);
8545 set_register(r1, result); 9886 set_register(r1, result);
8546 SetS390ConditionCode<int64_t>(result, 0); 9887 SetS390ConditionCode<int64_t>(result, 0);
8547 return length; 9888 return length;
8548 } 9889 }
8549 9890
8550 EVALUATE(LCGFR) { 9891 EVALUATE(LCGFR) {
8551 DCHECK_OPCODE(LCGFR); 9892 DCHECK_OPCODE(LCGFR);
8552 DECODE_RRE_INSTRUCTION(r1, r2); 9893 DECODE_RRE_INSTRUCTION(r1, r2);
8553 // Load and Test Register (64 <- 32) (Sign Extends 32-bit val) 9894 // Load and Test Register (64 <- 32) (Sign Extends 32-bit val)
8554 // Load Register (64 <- 32) (Sign Extends 32-bit val) 9895 // Load Register (64 <- 32) (Sign Extends 32-bit val)
8555 int32_t r2_val = get_low_register<int32_t>(r2); 9896 int32_t r2_val = get_low_register<int32_t>(r2);
8556 int64_t result = static_cast<int64_t>(r2_val); 9897 int64_t result = static_cast<int64_t>(r2_val);
8557 set_register(r1, result); 9898 set_register(r1, result);
8558 return length; 9899 return length;
8559 } 9900 }
8560 9901
8561 EVALUATE(LLGFR) { return DecodeInstructionOriginal(instr); } 9902 EVALUATE(LLGFR) {
9903 DCHECK_OPCODE(LLGFR);
9904 DECODE_RRE_INSTRUCTION(r1, r2);
9905 int32_t r2_val = get_low_register<int32_t>(r2);
9906 uint64_t r2_finalval = (static_cast<uint64_t>(r2_val) & 0x00000000ffffffff);
9907 set_register(r1, r2_finalval);
9908 return length;
9909 }
8562 9910
8563 EVALUATE(LLGTR) { return DecodeInstructionOriginal(instr); } 9911 EVALUATE(LLGTR) {
9912 UNIMPLEMENTED();
9913 USE(instr);
9914 return 0;
9915 }
8564 9916
8565 EVALUATE(AGFR) { 9917 EVALUATE(AGFR) {
8566 DCHECK_OPCODE(AGFR); 9918 DCHECK_OPCODE(AGFR);
8567 DECODE_RRE_INSTRUCTION(r1, r2); 9919 DECODE_RRE_INSTRUCTION(r1, r2);
8568 // Add Register (64 <- 32) (Sign Extends 32-bit val) 9920 // Add Register (64 <- 32) (Sign Extends 32-bit val)
8569 int64_t r1_val = get_register(r1); 9921 int64_t r1_val = get_register(r1);
8570 int64_t r2_val = static_cast<int64_t>(get_low_register<int32_t>(r2)); 9922 int64_t r2_val = static_cast<int64_t>(get_low_register<int32_t>(r2));
8571 bool isOF = CheckOverflowForIntAdd(r1_val, r2_val, int64_t); 9923 bool isOF = CheckOverflowForIntAdd(r1_val, r2_val, int64_t);
8572 r1_val += r2_val; 9924 r1_val += r2_val;
8573 SetS390ConditionCode<int64_t>(r1_val, 0); 9925 SetS390ConditionCode<int64_t>(r1_val, 0);
(...skipping 10 matching lines...) Expand all
8584 int64_t r2_val = static_cast<int64_t>(get_low_register<int32_t>(r2)); 9936 int64_t r2_val = static_cast<int64_t>(get_low_register<int32_t>(r2));
8585 bool isOF = false; 9937 bool isOF = false;
8586 isOF = CheckOverflowForIntSub(r1_val, r2_val, int64_t); 9938 isOF = CheckOverflowForIntSub(r1_val, r2_val, int64_t);
8587 r1_val -= r2_val; 9939 r1_val -= r2_val;
8588 SetS390ConditionCode<int64_t>(r1_val, 0); 9940 SetS390ConditionCode<int64_t>(r1_val, 0);
8589 SetS390OverflowCode(isOF); 9941 SetS390OverflowCode(isOF);
8590 set_register(r1, r1_val); 9942 set_register(r1, r1_val);
8591 return length; 9943 return length;
8592 } 9944 }
8593 9945
8594 EVALUATE(ALGFR) { return DecodeInstructionOriginal(instr); } 9946 EVALUATE(ALGFR) {
9947 UNIMPLEMENTED();
9948 USE(instr);
9949 return 0;
9950 }
8595 9951
8596 EVALUATE(SLGFR) { return DecodeInstructionOriginal(instr); } 9952 EVALUATE(SLGFR) {
9953 UNIMPLEMENTED();
9954 USE(instr);
9955 return 0;
9956 }
8597 9957
8598 EVALUATE(MSGFR) { return DecodeInstructionOriginal(instr); } 9958 EVALUATE(MSGFR) {
9959 UNIMPLEMENTED();
9960 USE(instr);
9961 return 0;
9962 }
8599 9963
8600 EVALUATE(DSGFR) { return DecodeInstructionOriginal(instr); } 9964 EVALUATE(DSGFR) {
9965 UNIMPLEMENTED();
9966 USE(instr);
9967 return 0;
9968 }
8601 9969
8602 EVALUATE(KMAC) { return DecodeInstructionOriginal(instr); } 9970 EVALUATE(KMAC) {
9971 UNIMPLEMENTED();
9972 USE(instr);
9973 return 0;
9974 }
8603 9975
8604 EVALUATE(LRVR) { return DecodeInstructionOriginal(instr); } 9976 EVALUATE(LRVR) {
9977 UNIMPLEMENTED();
9978 USE(instr);
9979 return 0;
9980 }
8605 9981
8606 EVALUATE(CGR) { 9982 EVALUATE(CGR) {
8607 DCHECK_OPCODE(CGR); 9983 DCHECK_OPCODE(CGR);
8608 DECODE_RRE_INSTRUCTION(r1, r2); 9984 DECODE_RRE_INSTRUCTION(r1, r2);
8609 // Compare (64) 9985 // Compare (64)
8610 int64_t r1_val = get_register(r1); 9986 int64_t r1_val = get_register(r1);
8611 int64_t r2_val = get_register(r2); 9987 int64_t r2_val = get_register(r2);
8612 SetS390ConditionCode<int64_t>(r1_val, r2_val); 9988 SetS390ConditionCode<int64_t>(r1_val, r2_val);
8613 return length; 9989 return length;
8614 } 9990 }
8615 9991
8616 EVALUATE(CLGR) { 9992 EVALUATE(CLGR) {
8617 DCHECK_OPCODE(CLGR); 9993 DCHECK_OPCODE(CLGR);
8618 DECODE_RRE_INSTRUCTION(r1, r2); 9994 DECODE_RRE_INSTRUCTION(r1, r2);
8619 // Compare Logical (64) 9995 // Compare Logical (64)
8620 uint64_t r1_val = static_cast<uint64_t>(get_register(r1)); 9996 uint64_t r1_val = static_cast<uint64_t>(get_register(r1));
8621 uint64_t r2_val = static_cast<uint64_t>(get_register(r2)); 9997 uint64_t r2_val = static_cast<uint64_t>(get_register(r2));
8622 SetS390ConditionCode<uint64_t>(r1_val, r2_val); 9998 SetS390ConditionCode<uint64_t>(r1_val, r2_val);
8623 return length; 9999 return length;
8624 } 10000 }
8625 10001
8626 EVALUATE(KMF) { return DecodeInstructionOriginal(instr); } 10002 EVALUATE(KMF) {
10003 UNIMPLEMENTED();
10004 USE(instr);
10005 return 0;
10006 }
8627 10007
8628 EVALUATE(KMO) { return DecodeInstructionOriginal(instr); } 10008 EVALUATE(KMO) {
10009 UNIMPLEMENTED();
10010 USE(instr);
10011 return 0;
10012 }
8629 10013
8630 EVALUATE(PCC) { return DecodeInstructionOriginal(instr); } 10014 EVALUATE(PCC) {
10015 UNIMPLEMENTED();
10016 USE(instr);
10017 return 0;
10018 }
8631 10019
8632 EVALUATE(KMCTR) { return DecodeInstructionOriginal(instr); } 10020 EVALUATE(KMCTR) {
10021 UNIMPLEMENTED();
10022 USE(instr);
10023 return 0;
10024 }
8633 10025
8634 EVALUATE(KM) { return DecodeInstructionOriginal(instr); } 10026 EVALUATE(KM) {
10027 UNIMPLEMENTED();
10028 USE(instr);
10029 return 0;
10030 }
8635 10031
8636 EVALUATE(KMC) { return DecodeInstructionOriginal(instr); } 10032 EVALUATE(KMC) {
10033 UNIMPLEMENTED();
10034 USE(instr);
10035 return 0;
10036 }
8637 10037
8638 EVALUATE(CGFR) { return DecodeInstructionOriginal(instr); } 10038 EVALUATE(CGFR) {
10039 UNIMPLEMENTED();
10040 USE(instr);
10041 return 0;
10042 }
8639 10043
8640 EVALUATE(KIMD) { return DecodeInstructionOriginal(instr); } 10044 EVALUATE(KIMD) {
10045 UNIMPLEMENTED();
10046 USE(instr);
10047 return 0;
10048 }
8641 10049
8642 EVALUATE(KLMD) { return DecodeInstructionOriginal(instr); } 10050 EVALUATE(KLMD) {
10051 UNIMPLEMENTED();
10052 USE(instr);
10053 return 0;
10054 }
8643 10055
8644 EVALUATE(CFDTR) { return DecodeInstructionOriginal(instr); } 10056 EVALUATE(CFDTR) {
10057 UNIMPLEMENTED();
10058 USE(instr);
10059 return 0;
10060 }
8645 10061
8646 EVALUATE(CLGDTR) { return DecodeInstructionOriginal(instr); } 10062 EVALUATE(CLGDTR) {
10063 UNIMPLEMENTED();
10064 USE(instr);
10065 return 0;
10066 }
8647 10067
8648 EVALUATE(CLFDTR) { return DecodeInstructionOriginal(instr); } 10068 EVALUATE(CLFDTR) {
10069 UNIMPLEMENTED();
10070 USE(instr);
10071 return 0;
10072 }
8649 10073
8650 EVALUATE(BCTGR) { return DecodeInstructionOriginal(instr); } 10074 EVALUATE(BCTGR) {
10075 UNIMPLEMENTED();
10076 USE(instr);
10077 return 0;
10078 }
8651 10079
8652 EVALUATE(CFXTR) { return DecodeInstructionOriginal(instr); } 10080 EVALUATE(CFXTR) {
10081 UNIMPLEMENTED();
10082 USE(instr);
10083 return 0;
10084 }
8653 10085
8654 EVALUATE(CLFXTR) { return DecodeInstructionOriginal(instr); } 10086 EVALUATE(CLFXTR) {
10087 UNIMPLEMENTED();
10088 USE(instr);
10089 return 0;
10090 }
8655 10091
8656 EVALUATE(CDFTR) { return DecodeInstructionOriginal(instr); } 10092 EVALUATE(CDFTR) {
10093 UNIMPLEMENTED();
10094 USE(instr);
10095 return 0;
10096 }
8657 10097
8658 EVALUATE(CDLGTR) { return DecodeInstructionOriginal(instr); } 10098 EVALUATE(CDLGTR) {
10099 UNIMPLEMENTED();
10100 USE(instr);
10101 return 0;
10102 }
8659 10103
8660 EVALUATE(CDLFTR) { return DecodeInstructionOriginal(instr); } 10104 EVALUATE(CDLFTR) {
10105 UNIMPLEMENTED();
10106 USE(instr);
10107 return 0;
10108 }
8661 10109
8662 EVALUATE(CXFTR) { return DecodeInstructionOriginal(instr); } 10110 EVALUATE(CXFTR) {
10111 UNIMPLEMENTED();
10112 USE(instr);
10113 return 0;
10114 }
8663 10115
8664 EVALUATE(CXLGTR) { return DecodeInstructionOriginal(instr); } 10116 EVALUATE(CXLGTR) {
10117 UNIMPLEMENTED();
10118 USE(instr);
10119 return 0;
10120 }
8665 10121
8666 EVALUATE(CXLFTR) { return DecodeInstructionOriginal(instr); } 10122 EVALUATE(CXLFTR) {
10123 UNIMPLEMENTED();
10124 USE(instr);
10125 return 0;
10126 }
8667 10127
8668 EVALUATE(CGRT) { return DecodeInstructionOriginal(instr); } 10128 EVALUATE(CGRT) {
10129 UNIMPLEMENTED();
10130 USE(instr);
10131 return 0;
10132 }
8669 10133
8670 EVALUATE(NGR) { 10134 EVALUATE(NGR) {
8671 DCHECK_OPCODE(NGR); 10135 DCHECK_OPCODE(NGR);
8672 DECODE_RRE_INSTRUCTION(r1, r2); 10136 DECODE_RRE_INSTRUCTION(r1, r2);
8673 int64_t r1_val = get_register(r1); 10137 int64_t r1_val = get_register(r1);
8674 int64_t r2_val = get_register(r2); 10138 int64_t r2_val = get_register(r2);
8675 r1_val &= r2_val; 10139 r1_val &= r2_val;
8676 SetS390BitWiseConditionCode<uint64_t>(r1_val); 10140 SetS390BitWiseConditionCode<uint64_t>(r1_val);
8677 set_register(r1, r1_val); 10141 set_register(r1, r1_val);
8678 return length; 10142 return length;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
8715 } 10179 }
8716 10180
8717 r2_val = get_register(r2); 10181 r2_val = get_register(r2);
8718 10182
8719 int64_t mask = ~(1 << (63 - i)); 10183 int64_t mask = ~(1 << (63 - i));
8720 set_register(r1, i); 10184 set_register(r1, i);
8721 set_register(r1 + 1, r2_val & mask); 10185 set_register(r1 + 1, r2_val & mask);
8722 return length; 10186 return length;
8723 } 10187 }
8724 10188
8725 EVALUATE(LLGCR) { return DecodeInstructionOriginal(instr); } 10189 EVALUATE(LLGCR) {
10190 UNIMPLEMENTED();
10191 USE(instr);
10192 return 0;
10193 }
8726 10194
8727 EVALUATE(LLGHR) { return DecodeInstructionOriginal(instr); } 10195 EVALUATE(LLGHR) {
10196 UNIMPLEMENTED();
10197 USE(instr);
10198 return 0;
10199 }
8728 10200
8729 EVALUATE(MLGR) { return DecodeInstructionOriginal(instr); } 10201 EVALUATE(MLGR) {
10202 UNIMPLEMENTED();
10203 USE(instr);
10204 return 0;
10205 }
8730 10206
8731 EVALUATE(DLGR) { 10207 EVALUATE(DLGR) {
8732 DCHECK_OPCODE(DLGR); 10208 DCHECK_OPCODE(DLGR);
8733 #ifdef V8_TARGET_ARCH_S390X 10209 #ifdef V8_TARGET_ARCH_S390X
8734 DECODE_RRE_INSTRUCTION(r1, r2); 10210 DECODE_RRE_INSTRUCTION(r1, r2);
8735 uint64_t r1_val = get_register(r1); 10211 uint64_t r1_val = get_register(r1);
8736 uint64_t r2_val = get_register(r2); 10212 uint64_t r2_val = get_register(r2);
8737 DCHECK(r1 % 2 == 0); 10213 DCHECK(r1 % 2 == 0);
8738 unsigned __int128 dividend = static_cast<unsigned __int128>(r1_val) << 64; 10214 unsigned __int128 dividend = static_cast<unsigned __int128>(r1_val) << 64;
8739 dividend += get_register(r1 + 1); 10215 dividend += get_register(r1 + 1);
8740 uint64_t remainder = dividend % r2_val; 10216 uint64_t remainder = dividend % r2_val;
8741 uint64_t quotient = dividend / r2_val; 10217 uint64_t quotient = dividend / r2_val;
8742 r1_val = remainder; 10218 r1_val = remainder;
8743 set_register(r1, remainder); 10219 set_register(r1, remainder);
8744 set_register(r1 + 1, quotient); 10220 set_register(r1 + 1, quotient);
8745 return length; 10221 return length;
8746 #else 10222 #else
8747 UNREACHABLE(); 10223 UNREACHABLE();
8748 #endif 10224 #endif
8749 } 10225 }
8750 10226
8751 EVALUATE(ALCGR) { return DecodeInstructionOriginal(instr); } 10227 EVALUATE(ALCGR) {
10228 UNIMPLEMENTED();
10229 USE(instr);
10230 return 0;
10231 }
8752 10232
8753 EVALUATE(SLBGR) { return DecodeInstructionOriginal(instr); } 10233 EVALUATE(SLBGR) {
10234 UNIMPLEMENTED();
10235 USE(instr);
10236 return 0;
10237 }
8754 10238
8755 EVALUATE(EPSW) { return DecodeInstructionOriginal(instr); } 10239 EVALUATE(EPSW) {
10240 UNIMPLEMENTED();
10241 USE(instr);
10242 return 0;
10243 }
8756 10244
8757 EVALUATE(TRTT) { return DecodeInstructionOriginal(instr); } 10245 EVALUATE(TRTT) {
10246 UNIMPLEMENTED();
10247 USE(instr);
10248 return 0;
10249 }
8758 10250
8759 EVALUATE(TRTO) { return DecodeInstructionOriginal(instr); } 10251 EVALUATE(TRTO) {
10252 UNIMPLEMENTED();
10253 USE(instr);
10254 return 0;
10255 }
8760 10256
8761 EVALUATE(TROT) { return DecodeInstructionOriginal(instr); } 10257 EVALUATE(TROT) {
10258 UNIMPLEMENTED();
10259 USE(instr);
10260 return 0;
10261 }
8762 10262
8763 EVALUATE(TROO) { return DecodeInstructionOriginal(instr); } 10263 EVALUATE(TROO) {
10264 UNIMPLEMENTED();
10265 USE(instr);
10266 return 0;
10267 }
8764 10268
8765 EVALUATE(LLCR) { return DecodeInstructionOriginal(instr); } 10269 EVALUATE(LLCR) {
10270 UNIMPLEMENTED();
10271 USE(instr);
10272 return 0;
10273 }
8766 10274
8767 EVALUATE(LLHR) { return DecodeInstructionOriginal(instr); } 10275 EVALUATE(LLHR) {
10276 UNIMPLEMENTED();
10277 USE(instr);
10278 return 0;
10279 }
8768 10280
8769 EVALUATE(MLR) { 10281 EVALUATE(MLR) {
8770 DCHECK_OPCODE(MLR); 10282 DCHECK_OPCODE(MLR);
8771 DECODE_RRE_INSTRUCTION(r1, r2); 10283 DECODE_RRE_INSTRUCTION(r1, r2);
8772 DCHECK(r1 % 2 == 0); 10284 DCHECK(r1 % 2 == 0);
8773 10285
8774 uint32_t r1_val = get_low_register<uint32_t>(r1 + 1); 10286 uint32_t r1_val = get_low_register<uint32_t>(r1 + 1);
8775 uint32_t r2_val = get_low_register<uint32_t>(r2); 10287 uint32_t r2_val = get_low_register<uint32_t>(r2);
8776 uint64_t product = 10288 uint64_t product =
8777 static_cast<uint64_t>(r1_val) * static_cast<uint64_t>(r2_val); 10289 static_cast<uint64_t>(r1_val) * static_cast<uint64_t>(r2_val);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
8833 alu_out = alu_out - 1; 10345 alu_out = alu_out - 1;
8834 isOF = isOF_original || CheckOverflowForUIntSub(alu_out, 1); 10346 isOF = isOF_original || CheckOverflowForUIntSub(alu_out, 1);
8835 } else { 10347 } else {
8836 isOF = isOF_original; 10348 isOF = isOF_original;
8837 } 10349 }
8838 set_low_register(r1, alu_out); 10350 set_low_register(r1, alu_out);
8839 SetS390ConditionCodeCarry<uint32_t>(alu_out, isOF); 10351 SetS390ConditionCodeCarry<uint32_t>(alu_out, isOF);
8840 return length; 10352 return length;
8841 } 10353 }
8842 10354
8843 EVALUATE(CU14) { return DecodeInstructionOriginal(instr); } 10355 EVALUATE(CU14) {
10356 UNIMPLEMENTED();
10357 USE(instr);
10358 return 0;
10359 }
8844 10360
8845 EVALUATE(CU24) { return DecodeInstructionOriginal(instr); } 10361 EVALUATE(CU24) {
10362 UNIMPLEMENTED();
10363 USE(instr);
10364 return 0;
10365 }
8846 10366
8847 EVALUATE(CU41) { return DecodeInstructionOriginal(instr); } 10367 EVALUATE(CU41) {
10368 UNIMPLEMENTED();
10369 USE(instr);
10370 return 0;
10371 }
8848 10372
8849 EVALUATE(CU42) { return DecodeInstructionOriginal(instr); } 10373 EVALUATE(CU42) {
10374 UNIMPLEMENTED();
10375 USE(instr);
10376 return 0;
10377 }
8850 10378
8851 EVALUATE(TRTRE) { return DecodeInstructionOriginal(instr); } 10379 EVALUATE(TRTRE) {
10380 UNIMPLEMENTED();
10381 USE(instr);
10382 return 0;
10383 }
8852 10384
8853 EVALUATE(SRSTU) { return DecodeInstructionOriginal(instr); } 10385 EVALUATE(SRSTU) {
10386 UNIMPLEMENTED();
10387 USE(instr);
10388 return 0;
10389 }
8854 10390
8855 EVALUATE(TRTE) { return DecodeInstructionOriginal(instr); } 10391 EVALUATE(TRTE) {
10392 UNIMPLEMENTED();
10393 USE(instr);
10394 return 0;
10395 }
8856 10396
8857 EVALUATE(AHHHR) { return DecodeInstructionOriginal(instr); } 10397 EVALUATE(AHHHR) {
10398 UNIMPLEMENTED();
10399 USE(instr);
10400 return 0;
10401 }
8858 10402
8859 EVALUATE(SHHHR) { return DecodeInstructionOriginal(instr); } 10403 EVALUATE(SHHHR) {
10404 UNIMPLEMENTED();
10405 USE(instr);
10406 return 0;
10407 }
8860 10408
8861 EVALUATE(ALHHHR) { return DecodeInstructionOriginal(instr); } 10409 EVALUATE(ALHHHR) {
10410 UNIMPLEMENTED();
10411 USE(instr);
10412 return 0;
10413 }
8862 10414
8863 EVALUATE(SLHHHR) { return DecodeInstructionOriginal(instr); } 10415 EVALUATE(SLHHHR) {
10416 UNIMPLEMENTED();
10417 USE(instr);
10418 return 0;
10419 }
8864 10420
8865 EVALUATE(CHHR) { return DecodeInstructionOriginal(instr); } 10421 EVALUATE(CHHR) {
10422 UNIMPLEMENTED();
10423 USE(instr);
10424 return 0;
10425 }
8866 10426
8867 EVALUATE(AHHLR) { return DecodeInstructionOriginal(instr); } 10427 EVALUATE(AHHLR) {
10428 UNIMPLEMENTED();
10429 USE(instr);
10430 return 0;
10431 }
8868 10432
8869 EVALUATE(SHHLR) { return DecodeInstructionOriginal(instr); } 10433 EVALUATE(SHHLR) {
10434 UNIMPLEMENTED();
10435 USE(instr);
10436 return 0;
10437 }
8870 10438
8871 EVALUATE(ALHHLR) { return DecodeInstructionOriginal(instr); } 10439 EVALUATE(ALHHLR) {
10440 UNIMPLEMENTED();
10441 USE(instr);
10442 return 0;
10443 }
8872 10444
8873 EVALUATE(SLHHLR) { return DecodeInstructionOriginal(instr); } 10445 EVALUATE(SLHHLR) {
10446 UNIMPLEMENTED();
10447 USE(instr);
10448 return 0;
10449 }
8874 10450
8875 EVALUATE(CHLR) { return DecodeInstructionOriginal(instr); } 10451 EVALUATE(CHLR) {
10452 UNIMPLEMENTED();
10453 USE(instr);
10454 return 0;
10455 }
8876 10456
8877 EVALUATE(POPCNT_Z) { return DecodeInstructionOriginal(instr); } 10457 EVALUATE(POPCNT_Z) {
10458 DCHECK_OPCODE(POPCNT_Z);
10459 DECODE_RRE_INSTRUCTION(r1, r2);
10460 int64_t r2_val = get_register(r2);
10461 int64_t r1_val = 0;
8878 10462
8879 EVALUATE(LOCGR) { return DecodeInstructionOriginal(instr); } 10463 uint8_t* r2_val_ptr = reinterpret_cast<uint8_t*>(&r2_val);
10464 uint8_t* r1_val_ptr = reinterpret_cast<uint8_t*>(&r1_val);
10465 for (int i = 0; i < 8; i++) {
10466 uint32_t x = static_cast<uint32_t>(r2_val_ptr[i]);
10467 #if defined(__GNUC__)
10468 r1_val_ptr[i] = __builtin_popcount(x);
10469 #else
10470 #error unsupport __builtin_popcount
10471 #endif
10472 }
10473 set_register(r1, static_cast<uint64_t>(r1_val));
10474 return length;
10475 }
10476
10477 EVALUATE(LOCGR) {
10478 UNIMPLEMENTED();
10479 USE(instr);
10480 return 0;
10481 }
8880 10482
8881 EVALUATE(NGRK) { 10483 EVALUATE(NGRK) {
8882 DCHECK_OPCODE(NGRK); 10484 DCHECK_OPCODE(NGRK);
8883 DECODE_RRF_A_INSTRUCTION(r1, r2, r3); 10485 DECODE_RRF_A_INSTRUCTION(r1, r2, r3);
8884 // 64-bit Non-clobbering arithmetics / bitwise ops. 10486 // 64-bit Non-clobbering arithmetics / bitwise ops.
8885 int64_t r2_val = get_register(r2); 10487 int64_t r2_val = get_register(r2);
8886 int64_t r3_val = get_register(r3); 10488 int64_t r3_val = get_register(r3);
8887 uint64_t bitwise_result = 0; 10489 uint64_t bitwise_result = 0;
8888 bitwise_result = r2_val & r3_val; 10490 bitwise_result = r2_val & r3_val;
8889 SetS390BitWiseConditionCode<uint64_t>(bitwise_result); 10491 SetS390BitWiseConditionCode<uint64_t>(bitwise_result);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
8962 // 64-bit Non-clobbering unsigned arithmetics 10564 // 64-bit Non-clobbering unsigned arithmetics
8963 uint64_t r2_val = get_register(r2); 10565 uint64_t r2_val = get_register(r2);
8964 uint64_t r3_val = get_register(r3); 10566 uint64_t r3_val = get_register(r3);
8965 bool isOF = CheckOverflowForUIntSub(r2_val, r3_val); 10567 bool isOF = CheckOverflowForUIntSub(r2_val, r3_val);
8966 SetS390ConditionCode<uint64_t>(r2_val - r3_val, 0); 10568 SetS390ConditionCode<uint64_t>(r2_val - r3_val, 0);
8967 SetS390OverflowCode(isOF); 10569 SetS390OverflowCode(isOF);
8968 set_register(r1, r2_val - r3_val); 10570 set_register(r1, r2_val - r3_val);
8969 return length; 10571 return length;
8970 } 10572 }
8971 10573
8972 EVALUATE(LOCR) { return DecodeInstructionOriginal(instr); } 10574 EVALUATE(LOCR) {
10575 UNIMPLEMENTED();
10576 USE(instr);
10577 return 0;
10578 }
8973 10579
8974 EVALUATE(NRK) { 10580 EVALUATE(NRK) {
8975 DCHECK_OPCODE(NRK); 10581 DCHECK_OPCODE(NRK);
8976 DECODE_RRF_A_INSTRUCTION(r1, r2, r3); 10582 DECODE_RRF_A_INSTRUCTION(r1, r2, r3);
8977 // 32-bit Non-clobbering arithmetics / bitwise ops 10583 // 32-bit Non-clobbering arithmetics / bitwise ops
8978 int32_t r2_val = get_low_register<int32_t>(r2); 10584 int32_t r2_val = get_low_register<int32_t>(r2);
8979 int32_t r3_val = get_low_register<int32_t>(r3); 10585 int32_t r3_val = get_low_register<int32_t>(r3);
8980 // Assume bitwise operation here 10586 // Assume bitwise operation here
8981 uint32_t bitwise_result = 0; 10587 uint32_t bitwise_result = 0;
8982 bitwise_result = r2_val & r3_val; 10588 bitwise_result = r2_val & r3_val;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
9070 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10676 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9071 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10677 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9072 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10678 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9073 intptr_t addr = x2_val + b2_val + d2; 10679 intptr_t addr = x2_val + b2_val + d2;
9074 int64_t value = ReadDW(addr); 10680 int64_t value = ReadDW(addr);
9075 set_register(r1, value); 10681 set_register(r1, value);
9076 SetS390ConditionCode<int64_t>(value, 0); 10682 SetS390ConditionCode<int64_t>(value, 0);
9077 return length; 10683 return length;
9078 } 10684 }
9079 10685
9080 EVALUATE(CVBY) { return DecodeInstructionOriginal(instr); } 10686 EVALUATE(CVBY) {
10687 UNIMPLEMENTED();
10688 USE(instr);
10689 return 0;
10690 }
9081 10691
9082 EVALUATE(AG) { 10692 EVALUATE(AG) {
9083 DCHECK_OPCODE(AG); 10693 DCHECK_OPCODE(AG);
9084 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10694 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9085 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10695 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9086 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10696 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9087 int64_t alu_out = get_register(r1); 10697 int64_t alu_out = get_register(r1);
9088 int64_t mem_val = ReadDW(b2_val + x2_val + d2); 10698 int64_t mem_val = ReadDW(b2_val + x2_val + d2);
9089 alu_out += mem_val; 10699 alu_out += mem_val;
9090 SetS390ConditionCode<int32_t>(alu_out, 0); 10700 SetS390ConditionCode<int32_t>(alu_out, 0);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
9146 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10756 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9147 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10757 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9148 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10758 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9149 intptr_t d2_val = d2; 10759 intptr_t d2_val = d2;
9150 int64_t mem_val = ReadDW(b2_val + d2_val + x2_val); 10760 int64_t mem_val = ReadDW(b2_val + d2_val + x2_val);
9151 int64_t r1_val = get_register(r1); 10761 int64_t r1_val = get_register(r1);
9152 set_register(r1, mem_val * r1_val); 10762 set_register(r1, mem_val * r1_val);
9153 return length; 10763 return length;
9154 } 10764 }
9155 10765
9156 EVALUATE(DSG) { return DecodeInstructionOriginal(instr); } 10766 EVALUATE(DSG) {
10767 UNIMPLEMENTED();
10768 USE(instr);
10769 return 0;
10770 }
9157 10771
9158 EVALUATE(CVBG) { return DecodeInstructionOriginal(instr); } 10772 EVALUATE(CVBG) {
10773 UNIMPLEMENTED();
10774 USE(instr);
10775 return 0;
10776 }
9159 10777
9160 EVALUATE(LRVG) { return DecodeInstructionOriginal(instr); } 10778 EVALUATE(LRVG) {
10779 UNIMPLEMENTED();
10780 USE(instr);
10781 return 0;
10782 }
9161 10783
9162 EVALUATE(LT) { 10784 EVALUATE(LT) {
9163 DCHECK_OPCODE(LT); 10785 DCHECK_OPCODE(LT);
9164 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10786 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9165 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10787 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9166 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10788 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9167 intptr_t addr = x2_val + b2_val + d2; 10789 intptr_t addr = x2_val + b2_val + d2;
9168 int32_t value = ReadW(addr, instr); 10790 int32_t value = ReadW(addr, instr);
9169 set_low_register(r1, value); 10791 set_low_register(r1, value);
9170 SetS390ConditionCode<int32_t>(value, 0); 10792 SetS390ConditionCode<int32_t>(value, 0);
(...skipping 17 matching lines...) Expand all
9188 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10810 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9189 // Miscellaneous Loads and Stores 10811 // Miscellaneous Loads and Stores
9190 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10812 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9191 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10813 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9192 intptr_t addr = x2_val + b2_val + d2; 10814 intptr_t addr = x2_val + b2_val + d2;
9193 uint64_t mem_val = static_cast<uint64_t>(ReadWU(addr, instr)); 10815 uint64_t mem_val = static_cast<uint64_t>(ReadWU(addr, instr));
9194 set_register(r1, mem_val); 10816 set_register(r1, mem_val);
9195 return length; 10817 return length;
9196 } 10818 }
9197 10819
9198 EVALUATE(LLGT) { return DecodeInstructionOriginal(instr); } 10820 EVALUATE(LLGT) {
10821 UNIMPLEMENTED();
10822 USE(instr);
10823 return 0;
10824 }
9199 10825
9200 EVALUATE(AGF) { 10826 EVALUATE(AGF) {
9201 DCHECK_OPCODE(AGF); 10827 DCHECK_OPCODE(AGF);
9202 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10828 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9203 uint64_t r1_val = get_register(r1); 10829 uint64_t r1_val = get_register(r1);
9204 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10830 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9205 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10831 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9206 intptr_t d2_val = d2; 10832 intptr_t d2_val = d2;
9207 uint64_t alu_out = r1_val; 10833 uint64_t alu_out = r1_val;
9208 uint32_t mem_val = ReadW(b2_val + d2_val + x2_val, instr); 10834 uint32_t mem_val = ReadW(b2_val + d2_val + x2_val, instr);
(...skipping 11 matching lines...) Expand all
9220 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10846 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9221 intptr_t d2_val = d2; 10847 intptr_t d2_val = d2;
9222 uint64_t alu_out = r1_val; 10848 uint64_t alu_out = r1_val;
9223 uint32_t mem_val = ReadW(b2_val + d2_val + x2_val, instr); 10849 uint32_t mem_val = ReadW(b2_val + d2_val + x2_val, instr);
9224 alu_out -= mem_val; 10850 alu_out -= mem_val;
9225 SetS390ConditionCode<int64_t>(alu_out, 0); 10851 SetS390ConditionCode<int64_t>(alu_out, 0);
9226 set_register(r1, alu_out); 10852 set_register(r1, alu_out);
9227 return length; 10853 return length;
9228 } 10854 }
9229 10855
9230 EVALUATE(ALGF) { return DecodeInstructionOriginal(instr); } 10856 EVALUATE(ALGF) {
10857 UNIMPLEMENTED();
10858 USE(instr);
10859 return 0;
10860 }
9231 10861
9232 EVALUATE(SLGF) { return DecodeInstructionOriginal(instr); } 10862 EVALUATE(SLGF) {
10863 UNIMPLEMENTED();
10864 USE(instr);
10865 return 0;
10866 }
9233 10867
9234 EVALUATE(MSGF) { return DecodeInstructionOriginal(instr); } 10868 EVALUATE(MSGF) {
10869 UNIMPLEMENTED();
10870 USE(instr);
10871 return 0;
10872 }
9235 10873
9236 EVALUATE(DSGF) { return DecodeInstructionOriginal(instr); } 10874 EVALUATE(DSGF) {
10875 UNIMPLEMENTED();
10876 USE(instr);
10877 return 0;
10878 }
9237 10879
9238 EVALUATE(LRV) { 10880 EVALUATE(LRV) {
9239 DCHECK_OPCODE(LRV); 10881 DCHECK_OPCODE(LRV);
9240 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10882 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9241 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10883 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9242 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10884 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9243 intptr_t mem_addr = b2_val + x2_val + d2; 10885 intptr_t mem_addr = b2_val + x2_val + d2;
9244 int32_t mem_val = ReadW(mem_addr, instr); 10886 int32_t mem_val = ReadW(mem_addr, instr);
9245 set_low_register(r1, ByteReverse(mem_val)); 10887 set_low_register(r1, ByteReverse(mem_val));
9246 return length; 10888 return length;
(...skipping 30 matching lines...) Expand all
9277 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10919 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9278 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10920 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9279 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10921 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9280 int64_t alu_out = get_register(r1); 10922 int64_t alu_out = get_register(r1);
9281 int64_t mem_val = ReadDW(b2_val + x2_val + d2); 10923 int64_t mem_val = ReadDW(b2_val + x2_val + d2);
9282 SetS390ConditionCode<uint64_t>(alu_out, mem_val); 10924 SetS390ConditionCode<uint64_t>(alu_out, mem_val);
9283 set_register(r1, alu_out); 10925 set_register(r1, alu_out);
9284 return length; 10926 return length;
9285 } 10927 }
9286 10928
9287 EVALUATE(NTSTG) { return DecodeInstructionOriginal(instr); } 10929 EVALUATE(NTSTG) {
10930 UNIMPLEMENTED();
10931 USE(instr);
10932 return 0;
10933 }
9288 10934
9289 EVALUATE(CVDY) { return DecodeInstructionOriginal(instr); } 10935 EVALUATE(CVDY) {
10936 UNIMPLEMENTED();
10937 USE(instr);
10938 return 0;
10939 }
9290 10940
9291 EVALUATE(CVDG) { return DecodeInstructionOriginal(instr); } 10941 EVALUATE(CVDG) {
10942 UNIMPLEMENTED();
10943 USE(instr);
10944 return 0;
10945 }
9292 10946
9293 EVALUATE(STRVG) { return DecodeInstructionOriginal(instr); } 10947 EVALUATE(STRVG) {
10948 UNIMPLEMENTED();
10949 USE(instr);
10950 return 0;
10951 }
9294 10952
9295 EVALUATE(CGF) { return DecodeInstructionOriginal(instr); } 10953 EVALUATE(CGF) {
10954 UNIMPLEMENTED();
10955 USE(instr);
10956 return 0;
10957 }
9296 10958
9297 EVALUATE(CLGF) { return DecodeInstructionOriginal(instr); } 10959 EVALUATE(CLGF) {
10960 UNIMPLEMENTED();
10961 USE(instr);
10962 return 0;
10963 }
9298 10964
9299 EVALUATE(LTGF) { return DecodeInstructionOriginal(instr); } 10965 EVALUATE(LTGF) {
10966 UNIMPLEMENTED();
10967 USE(instr);
10968 return 0;
10969 }
9300 10970
9301 EVALUATE(CGH) { return DecodeInstructionOriginal(instr); } 10971 EVALUATE(CGH) {
10972 UNIMPLEMENTED();
10973 USE(instr);
10974 return 0;
10975 }
9302 10976
9303 EVALUATE(PFD) { return DecodeInstructionOriginal(instr); } 10977 EVALUATE(PFD) {
10978 UNIMPLEMENTED();
10979 USE(instr);
10980 return 0;
10981 }
9304 10982
9305 EVALUATE(STRV) { 10983 EVALUATE(STRV) {
9306 DCHECK_OPCODE(STRV); 10984 DCHECK_OPCODE(STRV);
9307 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10985 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9308 int32_t r1_val = get_low_register<int32_t>(r1); 10986 int32_t r1_val = get_low_register<int32_t>(r1);
9309 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10987 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9310 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10988 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9311 intptr_t mem_addr = b2_val + x2_val + d2; 10989 intptr_t mem_addr = b2_val + x2_val + d2;
9312 WriteW(mem_addr, ByteReverse(r1_val), instr); 10990 WriteW(mem_addr, ByteReverse(r1_val), instr);
9313 return length; 10991 return length;
9314 } 10992 }
9315 10993
9316 EVALUATE(STRVH) { 10994 EVALUATE(STRVH) {
9317 DCHECK_OPCODE(STRVH); 10995 DCHECK_OPCODE(STRVH);
9318 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 10996 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9319 int32_t r1_val = get_low_register<int32_t>(r1); 10997 int32_t r1_val = get_low_register<int32_t>(r1);
9320 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 10998 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9321 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 10999 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9322 intptr_t mem_addr = b2_val + x2_val + d2; 11000 intptr_t mem_addr = b2_val + x2_val + d2;
9323 int16_t result = static_cast<int16_t>(r1_val >> 16); 11001 int16_t result = static_cast<int16_t>(r1_val >> 16);
9324 WriteH(mem_addr, ByteReverse(result), instr); 11002 WriteH(mem_addr, ByteReverse(result), instr);
9325 return length; 11003 return length;
9326 } 11004 }
9327 11005
9328 EVALUATE(BCTG) { return DecodeInstructionOriginal(instr); } 11006 EVALUATE(BCTG) {
11007 UNIMPLEMENTED();
11008 USE(instr);
11009 return 0;
11010 }
9329 11011
9330 EVALUATE(MSY) { 11012 EVALUATE(MSY) {
9331 DCHECK_OPCODE(MSY); 11013 DCHECK_OPCODE(MSY);
9332 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11014 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9333 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11015 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9334 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11016 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9335 intptr_t d2_val = d2; 11017 intptr_t d2_val = d2;
9336 int32_t mem_val = ReadW(b2_val + d2_val + x2_val, instr); 11018 int32_t mem_val = ReadW(b2_val + d2_val + x2_val, instr);
9337 int32_t r1_val = get_low_register<int32_t>(r1); 11019 int32_t r1_val = get_low_register<int32_t>(r1);
9338 set_low_register(r1, mem_val * r1_val); 11020 set_low_register(r1, mem_val * r1_val);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
9425 int32_t mem_val = ReadW(b2_val + x2_val + d2, instr); 11107 int32_t mem_val = ReadW(b2_val + x2_val + d2, instr);
9426 bool isOF = false; 11108 bool isOF = false;
9427 isOF = CheckOverflowForIntSub(alu_out, mem_val, int32_t); 11109 isOF = CheckOverflowForIntSub(alu_out, mem_val, int32_t);
9428 alu_out -= mem_val; 11110 alu_out -= mem_val;
9429 SetS390ConditionCode<int32_t>(alu_out, 0); 11111 SetS390ConditionCode<int32_t>(alu_out, 0);
9430 SetS390OverflowCode(isOF); 11112 SetS390OverflowCode(isOF);
9431 set_low_register(r1, alu_out); 11113 set_low_register(r1, alu_out);
9432 return length; 11114 return length;
9433 } 11115 }
9434 11116
9435 EVALUATE(MFY) { return DecodeInstructionOriginal(instr); } 11117 EVALUATE(MFY) {
11118 UNIMPLEMENTED();
11119 USE(instr);
11120 return 0;
11121 }
9436 11122
9437 EVALUATE(ALY) { 11123 EVALUATE(ALY) {
9438 DCHECK_OPCODE(ALY); 11124 DCHECK_OPCODE(ALY);
9439 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11125 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9440 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11126 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9441 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11127 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9442 uint32_t alu_out = get_low_register<uint32_t>(r1); 11128 uint32_t alu_out = get_low_register<uint32_t>(r1);
9443 uint32_t mem_val = ReadWU(b2_val + x2_val + d2, instr); 11129 uint32_t mem_val = ReadWU(b2_val + x2_val + d2, instr);
9444 alu_out += mem_val; 11130 alu_out += mem_val;
9445 set_low_register(r1, alu_out); 11131 set_low_register(r1, alu_out);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
9490 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11176 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9491 // Miscellaneous Loads and Stores 11177 // Miscellaneous Loads and Stores
9492 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11178 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9493 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11179 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9494 intptr_t addr = x2_val + b2_val + d2; 11180 intptr_t addr = x2_val + b2_val + d2;
9495 uint8_t value = get_low_register<uint32_t>(r1); 11181 uint8_t value = get_low_register<uint32_t>(r1);
9496 WriteB(addr, value); 11182 WriteB(addr, value);
9497 return length; 11183 return length;
9498 } 11184 }
9499 11185
9500 EVALUATE(ICY) { return DecodeInstructionOriginal(instr); } 11186 EVALUATE(ICY) {
11187 UNIMPLEMENTED();
11188 USE(instr);
11189 return 0;
11190 }
9501 11191
9502 EVALUATE(LAEY) { return DecodeInstructionOriginal(instr); } 11192 EVALUATE(LAEY) {
11193 UNIMPLEMENTED();
11194 USE(instr);
11195 return 0;
11196 }
9503 11197
9504 EVALUATE(LB) { 11198 EVALUATE(LB) {
9505 DCHECK_OPCODE(LB); 11199 DCHECK_OPCODE(LB);
9506 // Miscellaneous Loads and Stores 11200 // Miscellaneous Loads and Stores
9507 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11201 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9508 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11202 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9509 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11203 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9510 intptr_t addr = x2_val + b2_val + d2; 11204 intptr_t addr = x2_val + b2_val + d2;
9511 int32_t mem_val = ReadB(addr); 11205 int32_t mem_val = ReadB(addr);
9512 set_low_register(r1, mem_val); 11206 set_low_register(r1, mem_val);
(...skipping 17 matching lines...) Expand all
9530 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11224 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9531 // Miscellaneous Loads and Stores 11225 // Miscellaneous Loads and Stores
9532 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11226 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9533 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11227 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9534 intptr_t addr = x2_val + b2_val + d2; 11228 intptr_t addr = x2_val + b2_val + d2;
9535 int32_t result = static_cast<int32_t>(ReadH(addr, instr)); 11229 int32_t result = static_cast<int32_t>(ReadH(addr, instr));
9536 set_low_register(r1, result); 11230 set_low_register(r1, result);
9537 return length; 11231 return length;
9538 } 11232 }
9539 11233
9540 EVALUATE(CHY) { return DecodeInstructionOriginal(instr); } 11234 EVALUATE(CHY) {
11235 UNIMPLEMENTED();
11236 USE(instr);
11237 return 0;
11238 }
9541 11239
9542 EVALUATE(AHY) { 11240 EVALUATE(AHY) {
9543 DCHECK_OPCODE(AHY); 11241 DCHECK_OPCODE(AHY);
9544 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11242 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9545 int32_t r1_val = get_low_register<int32_t>(r1); 11243 int32_t r1_val = get_low_register<int32_t>(r1);
9546 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11244 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9547 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11245 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9548 intptr_t d2_val = d2; 11246 intptr_t d2_val = d2;
9549 int32_t mem_val = 11247 int32_t mem_val =
9550 static_cast<int32_t>(ReadH(b2_val + d2_val + x2_val, instr)); 11248 static_cast<int32_t>(ReadH(b2_val + d2_val + x2_val, instr));
(...skipping 19 matching lines...) Expand all
9570 int32_t alu_out = 0; 11268 int32_t alu_out = 0;
9571 bool isOF = false; 11269 bool isOF = false;
9572 alu_out = r1_val - mem_val; 11270 alu_out = r1_val - mem_val;
9573 isOF = CheckOverflowForIntSub(r1_val, mem_val, int64_t); 11271 isOF = CheckOverflowForIntSub(r1_val, mem_val, int64_t);
9574 set_low_register(r1, alu_out); 11272 set_low_register(r1, alu_out);
9575 SetS390ConditionCode<int32_t>(alu_out, 0); 11273 SetS390ConditionCode<int32_t>(alu_out, 0);
9576 SetS390OverflowCode(isOF); 11274 SetS390OverflowCode(isOF);
9577 return length; 11275 return length;
9578 } 11276 }
9579 11277
9580 EVALUATE(MHY) { return DecodeInstructionOriginal(instr); } 11278 EVALUATE(MHY) {
11279 UNIMPLEMENTED();
11280 USE(instr);
11281 return 0;
11282 }
9581 11283
9582 EVALUATE(NG) { 11284 EVALUATE(NG) {
9583 DCHECK_OPCODE(NG); 11285 DCHECK_OPCODE(NG);
9584 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11286 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9585 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11287 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9586 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11288 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9587 int64_t alu_out = get_register(r1); 11289 int64_t alu_out = get_register(r1);
9588 int64_t mem_val = ReadDW(b2_val + x2_val + d2); 11290 int64_t mem_val = ReadDW(b2_val + x2_val + d2);
9589 alu_out &= mem_val; 11291 alu_out &= mem_val;
9590 SetS390BitWiseConditionCode<uint32_t>(alu_out); 11292 SetS390BitWiseConditionCode<uint32_t>(alu_out);
(...skipping 20 matching lines...) Expand all
9611 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11313 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9612 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11314 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9613 int64_t alu_out = get_register(r1); 11315 int64_t alu_out = get_register(r1);
9614 int64_t mem_val = ReadDW(b2_val + x2_val + d2); 11316 int64_t mem_val = ReadDW(b2_val + x2_val + d2);
9615 alu_out ^= mem_val; 11317 alu_out ^= mem_val;
9616 SetS390BitWiseConditionCode<uint32_t>(alu_out); 11318 SetS390BitWiseConditionCode<uint32_t>(alu_out);
9617 set_register(r1, alu_out); 11319 set_register(r1, alu_out);
9618 return length; 11320 return length;
9619 } 11321 }
9620 11322
9621 EVALUATE(LGAT) { return DecodeInstructionOriginal(instr); } 11323 EVALUATE(LGAT) {
11324 UNIMPLEMENTED();
11325 USE(instr);
11326 return 0;
11327 }
9622 11328
9623 EVALUATE(MLG) { return DecodeInstructionOriginal(instr); } 11329 EVALUATE(MLG) {
11330 UNIMPLEMENTED();
11331 USE(instr);
11332 return 0;
11333 }
9624 11334
9625 EVALUATE(DLG) { return DecodeInstructionOriginal(instr); } 11335 EVALUATE(DLG) {
11336 UNIMPLEMENTED();
11337 USE(instr);
11338 return 0;
11339 }
9626 11340
9627 EVALUATE(ALCG) { return DecodeInstructionOriginal(instr); } 11341 EVALUATE(ALCG) {
11342 UNIMPLEMENTED();
11343 USE(instr);
11344 return 0;
11345 }
9628 11346
9629 EVALUATE(SLBG) { return DecodeInstructionOriginal(instr); } 11347 EVALUATE(SLBG) {
11348 UNIMPLEMENTED();
11349 USE(instr);
11350 return 0;
11351 }
9630 11352
9631 EVALUATE(STPQ) { return DecodeInstructionOriginal(instr); } 11353 EVALUATE(STPQ) {
11354 UNIMPLEMENTED();
11355 USE(instr);
11356 return 0;
11357 }
9632 11358
9633 EVALUATE(LPQ) { return DecodeInstructionOriginal(instr); } 11359 EVALUATE(LPQ) {
11360 UNIMPLEMENTED();
11361 USE(instr);
11362 return 0;
11363 }
9634 11364
9635 EVALUATE(LLGH) { 11365 EVALUATE(LLGH) {
9636 DCHECK_OPCODE(LLGH); 11366 DCHECK_OPCODE(LLGH);
9637 // Load Logical Halfword 11367 // Load Logical Halfword
9638 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11368 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9639 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11369 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9640 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11370 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9641 intptr_t d2_val = d2; 11371 intptr_t d2_val = d2;
9642 uint16_t mem_val = ReadHU(b2_val + d2_val + x2_val, instr); 11372 uint16_t mem_val = ReadHU(b2_val + d2_val + x2_val, instr);
9643 set_register(r1, mem_val); 11373 set_register(r1, mem_val);
9644 return length; 11374 return length;
9645 } 11375 }
9646 11376
9647 EVALUATE(LLH) { 11377 EVALUATE(LLH) {
9648 DCHECK_OPCODE(LLH); 11378 DCHECK_OPCODE(LLH);
9649 // Load Logical Halfword 11379 // Load Logical Halfword
9650 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 11380 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
9651 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11381 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9652 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 11382 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
9653 intptr_t d2_val = d2; 11383 intptr_t d2_val = d2;
9654 uint16_t mem_val = ReadHU(b2_val + d2_val + x2_val, instr); 11384 uint16_t mem_val = ReadHU(b2_val + d2_val + x2_val, instr);
9655 set_low_register(r1, mem_val); 11385 set_low_register(r1, mem_val);
9656 return length; 11386 return length;
9657 } 11387 }
9658 11388
9659 EVALUATE(ML) { return DecodeInstructionOriginal(instr); } 11389 EVALUATE(ML) {
11390 UNIMPLEMENTED();
11391 USE(instr);
11392 return 0;
11393 }
9660 11394
9661 EVALUATE(DL) { return DecodeInstructionOriginal(instr); } 11395 EVALUATE(DL) {
11396 UNIMPLEMENTED();
11397 USE(instr);
11398 return 0;
11399 }
9662 11400
9663 EVALUATE(ALC) { return DecodeInstructionOriginal(instr); } 11401 EVALUATE(ALC) {
11402 UNIMPLEMENTED();
11403 USE(instr);
11404 return 0;
11405 }
9664 11406
9665 EVALUATE(SLB) { return DecodeInstructionOriginal(instr); } 11407 EVALUATE(SLB) {
11408 UNIMPLEMENTED();
11409 USE(instr);
11410 return 0;
11411 }
9666 11412
9667 EVALUATE(LLGTAT) { return DecodeInstructionOriginal(instr); } 11413 EVALUATE(LLGTAT) {
11414 UNIMPLEMENTED();
11415 USE(instr);
11416 return 0;
11417 }
9668 11418
9669 EVALUATE(LLGFAT) { return DecodeInstructionOriginal(instr); } 11419 EVALUATE(LLGFAT) {
11420 UNIMPLEMENTED();
11421 USE(instr);
11422 return 0;
11423 }
9670 11424
9671 EVALUATE(LAT) { return DecodeInstructionOriginal(instr); } 11425 EVALUATE(LAT) {
11426 UNIMPLEMENTED();
11427 USE(instr);
11428 return 0;
11429 }
9672 11430
9673 EVALUATE(LBH) { return DecodeInstructionOriginal(instr); } 11431 EVALUATE(LBH) {
11432 UNIMPLEMENTED();
11433 USE(instr);
11434 return 0;
11435 }
9674 11436
9675 EVALUATE(LLCH) { return DecodeInstructionOriginal(instr); } 11437 EVALUATE(LLCH) {
11438 UNIMPLEMENTED();
11439 USE(instr);
11440 return 0;
11441 }
9676 11442
9677 EVALUATE(STCH) { return DecodeInstructionOriginal(instr); } 11443 EVALUATE(STCH) {
11444 UNIMPLEMENTED();
11445 USE(instr);
11446 return 0;
11447 }
9678 11448
9679 EVALUATE(LHH) { return DecodeInstructionOriginal(instr); } 11449 EVALUATE(LHH) {
11450 UNIMPLEMENTED();
11451 USE(instr);
11452 return 0;
11453 }
9680 11454
9681 EVALUATE(LLHH) { return DecodeInstructionOriginal(instr); } 11455 EVALUATE(LLHH) {
11456 UNIMPLEMENTED();
11457 USE(instr);
11458 return 0;
11459 }
9682 11460
9683 EVALUATE(STHH) { return DecodeInstructionOriginal(instr); } 11461 EVALUATE(STHH) {
11462 UNIMPLEMENTED();
11463 USE(instr);
11464 return 0;
11465 }
9684 11466
9685 EVALUATE(LFHAT) { return DecodeInstructionOriginal(instr); } 11467 EVALUATE(LFHAT) {
11468 UNIMPLEMENTED();
11469 USE(instr);
11470 return 0;
11471 }
9686 11472
9687 EVALUATE(LFH) { return DecodeInstructionOriginal(instr); } 11473 EVALUATE(LFH) {
11474 UNIMPLEMENTED();
11475 USE(instr);
11476 return 0;
11477 }
9688 11478
9689 EVALUATE(STFH) { return DecodeInstructionOriginal(instr); } 11479 EVALUATE(STFH) {
11480 UNIMPLEMENTED();
11481 USE(instr);
11482 return 0;
11483 }
9690 11484
9691 EVALUATE(CHF) { return DecodeInstructionOriginal(instr); } 11485 EVALUATE(CHF) {
11486 UNIMPLEMENTED();
11487 USE(instr);
11488 return 0;
11489 }
9692 11490
9693 EVALUATE(MVCDK) { return DecodeInstructionOriginal(instr); } 11491 EVALUATE(MVCDK) {
11492 UNIMPLEMENTED();
11493 USE(instr);
11494 return 0;
11495 }
9694 11496
9695 EVALUATE(MVHHI) { return DecodeInstructionOriginal(instr); } 11497 EVALUATE(MVHHI) {
11498 UNIMPLEMENTED();
11499 USE(instr);
11500 return 0;
11501 }
9696 11502
9697 EVALUATE(MVGHI) { 11503 EVALUATE(MVGHI) {
9698 DCHECK_OPCODE(MVGHI); 11504 DCHECK_OPCODE(MVGHI);
9699 // Move Integer (64) 11505 // Move Integer (64)
9700 DECODE_SIL_INSTRUCTION(b1, d1, i2); 11506 DECODE_SIL_INSTRUCTION(b1, d1, i2);
9701 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1); 11507 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1);
9702 intptr_t src_addr = b1_val + d1; 11508 intptr_t src_addr = b1_val + d1;
9703 WriteDW(src_addr, i2); 11509 WriteDW(src_addr, i2);
9704 return length; 11510 return length;
9705 } 11511 }
9706 11512
9707 EVALUATE(MVHI) { 11513 EVALUATE(MVHI) {
9708 DCHECK_OPCODE(MVHI); 11514 DCHECK_OPCODE(MVHI);
9709 // Move Integer (32) 11515 // Move Integer (32)
9710 DECODE_SIL_INSTRUCTION(b1, d1, i2); 11516 DECODE_SIL_INSTRUCTION(b1, d1, i2);
9711 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1); 11517 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1);
9712 intptr_t src_addr = b1_val + d1; 11518 intptr_t src_addr = b1_val + d1;
9713 WriteW(src_addr, i2, instr); 11519 WriteW(src_addr, i2, instr);
9714 return length; 11520 return length;
9715 } 11521 }
9716 11522
9717 EVALUATE(CHHSI) { return DecodeInstructionOriginal(instr); } 11523 EVALUATE(CHHSI) {
11524 UNIMPLEMENTED();
11525 USE(instr);
11526 return 0;
11527 }
9718 11528
9719 EVALUATE(CGHSI) { return DecodeInstructionOriginal(instr); } 11529 EVALUATE(CGHSI) {
11530 UNIMPLEMENTED();
11531 USE(instr);
11532 return 0;
11533 }
9720 11534
9721 EVALUATE(CHSI) { return DecodeInstructionOriginal(instr); } 11535 EVALUATE(CHSI) {
11536 UNIMPLEMENTED();
11537 USE(instr);
11538 return 0;
11539 }
9722 11540
9723 EVALUATE(CLFHSI) { return DecodeInstructionOriginal(instr); } 11541 EVALUATE(CLFHSI) {
11542 UNIMPLEMENTED();
11543 USE(instr);
11544 return 0;
11545 }
9724 11546
9725 EVALUATE(TBEGIN) { return DecodeInstructionOriginal(instr); } 11547 EVALUATE(TBEGIN) {
11548 UNIMPLEMENTED();
11549 USE(instr);
11550 return 0;
11551 }
9726 11552
9727 EVALUATE(TBEGINC) { return DecodeInstructionOriginal(instr); } 11553 EVALUATE(TBEGINC) {
11554 UNIMPLEMENTED();
11555 USE(instr);
11556 return 0;
11557 }
9728 11558
9729 EVALUATE(LMG) { 11559 EVALUATE(LMG) {
9730 DCHECK_OPCODE(LMG); 11560 DCHECK_OPCODE(LMG);
9731 // Store Multiple 64-bits. 11561 // Store Multiple 64-bits.
9732 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2); 11562 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2);
9733 int rb = b2; 11563 int rb = b2;
9734 int offset = d2; 11564 int offset = d2;
9735 11565
9736 // Regs roll around if r3 is less than r1. 11566 // Regs roll around if r3 is less than r1.
9737 // Artifically increase r3 by 16 so we can calculate 11567 // Artifically increase r3 by 16 so we can calculate
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
9814 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11644 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
9815 int shiftBits = (b2_val + d2) & 0x3F; 11645 int shiftBits = (b2_val + d2) & 0x3F;
9816 // unsigned 11646 // unsigned
9817 uint64_t r3_val = get_register(r3); 11647 uint64_t r3_val = get_register(r3);
9818 uint64_t alu_out = 0; 11648 uint64_t alu_out = 0;
9819 alu_out = r3_val << shiftBits; 11649 alu_out = r3_val << shiftBits;
9820 set_register(r1, alu_out); 11650 set_register(r1, alu_out);
9821 return length; 11651 return length;
9822 } 11652 }
9823 11653
9824 EVALUATE(CSY) { return DecodeInstructionOriginal(instr); } 11654 EVALUATE(CSY) {
11655 UNIMPLEMENTED();
11656 USE(instr);
11657 return 0;
11658 }
9825 11659
9826 EVALUATE(RLLG) { 11660 EVALUATE(RLLG) {
9827 DCHECK_OPCODE(RLLG); 11661 DCHECK_OPCODE(RLLG);
9828 // For SLLG/SRLG, the 64-bit third operand is shifted the number 11662 // For SLLG/SRLG, the 64-bit third operand is shifted the number
9829 // of bits specified by the second-operand address, and the result is 11663 // of bits specified by the second-operand address, and the result is
9830 // placed at the first-operand location. Except for when the R1 and R3 11664 // placed at the first-operand location. Except for when the R1 and R3
9831 // fields designate the same register, the third operand remains 11665 // fields designate the same register, the third operand remains
9832 // unchanged in general register R3. 11666 // unchanged in general register R3.
9833 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2); 11667 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2);
9834 // only takes rightmost 6 bits 11668 // only takes rightmost 6 bits
(...skipping 22 matching lines...) Expand all
9857 int64_t rb_val = (rb == 0) ? 0 : get_register(rb); 11691 int64_t rb_val = (rb == 0) ? 0 : get_register(rb);
9858 11692
9859 // Store each register in ascending order. 11693 // Store each register in ascending order.
9860 for (int i = 0; i <= r3 - r1; i++) { 11694 for (int i = 0; i <= r3 - r1; i++) {
9861 int64_t value = get_register((r1 + i) % 16); 11695 int64_t value = get_register((r1 + i) % 16);
9862 WriteDW(rb_val + offset + 8 * i, value); 11696 WriteDW(rb_val + offset + 8 * i, value);
9863 } 11697 }
9864 return length; 11698 return length;
9865 } 11699 }
9866 11700
9867 EVALUATE(STMH) { return DecodeInstructionOriginal(instr); } 11701 EVALUATE(STMH) {
11702 UNIMPLEMENTED();
11703 USE(instr);
11704 return 0;
11705 }
9868 11706
9869 EVALUATE(STCMH) { return DecodeInstructionOriginal(instr); } 11707 EVALUATE(STCMH) {
11708 UNIMPLEMENTED();
11709 USE(instr);
11710 return 0;
11711 }
9870 11712
9871 EVALUATE(STCMY) { return DecodeInstructionOriginal(instr); } 11713 EVALUATE(STCMY) {
11714 UNIMPLEMENTED();
11715 USE(instr);
11716 return 0;
11717 }
9872 11718
9873 EVALUATE(CDSY) { return DecodeInstructionOriginal(instr); } 11719 EVALUATE(CDSY) {
11720 UNIMPLEMENTED();
11721 USE(instr);
11722 return 0;
11723 }
9874 11724
9875 EVALUATE(CDSG) { return DecodeInstructionOriginal(instr); } 11725 EVALUATE(CDSG) {
11726 UNIMPLEMENTED();
11727 USE(instr);
11728 return 0;
11729 }
9876 11730
9877 EVALUATE(BXHG) { return DecodeInstructionOriginal(instr); } 11731 EVALUATE(BXHG) {
11732 UNIMPLEMENTED();
11733 USE(instr);
11734 return 0;
11735 }
9878 11736
9879 EVALUATE(BXLEG) { return DecodeInstructionOriginal(instr); } 11737 EVALUATE(BXLEG) {
11738 UNIMPLEMENTED();
11739 USE(instr);
11740 return 0;
11741 }
9880 11742
9881 EVALUATE(ECAG) { return DecodeInstructionOriginal(instr); } 11743 EVALUATE(ECAG) {
11744 UNIMPLEMENTED();
11745 USE(instr);
11746 return 0;
11747 }
9882 11748
9883 EVALUATE(TMY) { 11749 EVALUATE(TMY) {
9884 DCHECK_OPCODE(TMY); 11750 DCHECK_OPCODE(TMY);
9885 // Test Under Mask (Mem - Imm) (8) 11751 // Test Under Mask (Mem - Imm) (8)
9886 DECODE_SIY_INSTRUCTION(b1, d1, i2); 11752 DECODE_SIY_INSTRUCTION(b1, d1, i2);
9887 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1); 11753 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1);
9888 intptr_t d1_val = d1; 11754 intptr_t d1_val = d1;
9889 intptr_t addr = b1_val + d1_val; 11755 intptr_t addr = b1_val + d1_val;
9890 uint8_t mem_val = ReadB(addr); 11756 uint8_t mem_val = ReadB(addr);
9891 uint8_t imm_val = i2; 11757 uint8_t imm_val = i2;
9892 uint8_t selected_bits = mem_val & imm_val; 11758 uint8_t selected_bits = mem_val & imm_val;
9893 // CC0: Selected bits are zero 11759 // CC0: Selected bits are zero
9894 // CC1: Selected bits mixed zeros and ones 11760 // CC1: Selected bits mixed zeros and ones
9895 // CC3: Selected bits all ones 11761 // CC3: Selected bits all ones
9896 if (0 == selected_bits) { 11762 if (0 == selected_bits) {
9897 condition_reg_ = CC_EQ; // CC0 11763 condition_reg_ = CC_EQ; // CC0
9898 } else if (selected_bits == imm_val) { 11764 } else if (selected_bits == imm_val) {
9899 condition_reg_ = 0x1; // CC3 11765 condition_reg_ = 0x1; // CC3
9900 } else { 11766 } else {
9901 condition_reg_ = 0x4; // CC1 11767 condition_reg_ = 0x4; // CC1
9902 } 11768 }
9903 return length; 11769 return length;
9904 } 11770 }
9905 11771
9906 EVALUATE(MVIY) { return DecodeInstructionOriginal(instr); } 11772 EVALUATE(MVIY) {
11773 UNIMPLEMENTED();
11774 USE(instr);
11775 return 0;
11776 }
9907 11777
9908 EVALUATE(NIY) { return DecodeInstructionOriginal(instr); } 11778 EVALUATE(NIY) {
11779 UNIMPLEMENTED();
11780 USE(instr);
11781 return 0;
11782 }
9909 11783
9910 EVALUATE(CLIY) { 11784 EVALUATE(CLIY) {
9911 DCHECK_OPCODE(CLIY); 11785 DCHECK_OPCODE(CLIY);
9912 DECODE_SIY_INSTRUCTION(b1, d1, i2); 11786 DECODE_SIY_INSTRUCTION(b1, d1, i2);
9913 // Compare Immediate (Mem - Imm) (8) 11787 // Compare Immediate (Mem - Imm) (8)
9914 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1); 11788 int64_t b1_val = (b1 == 0) ? 0 : get_register(b1);
9915 intptr_t d1_val = d1; 11789 intptr_t d1_val = d1;
9916 intptr_t addr = b1_val + d1_val; 11790 intptr_t addr = b1_val + d1_val;
9917 uint8_t mem_val = ReadB(addr); 11791 uint8_t mem_val = ReadB(addr);
9918 uint8_t imm_val = i2; 11792 uint8_t imm_val = i2;
9919 SetS390ConditionCode<uint8_t>(mem_val, imm_val); 11793 SetS390ConditionCode<uint8_t>(mem_val, imm_val);
9920 return length; 11794 return length;
9921 } 11795 }
9922 11796
9923 EVALUATE(OIY) { return DecodeInstructionOriginal(instr); } 11797 EVALUATE(OIY) {
11798 UNIMPLEMENTED();
11799 USE(instr);
11800 return 0;
11801 }
9924 11802
9925 EVALUATE(XIY) { return DecodeInstructionOriginal(instr); } 11803 EVALUATE(XIY) {
11804 UNIMPLEMENTED();
11805 USE(instr);
11806 return 0;
11807 }
9926 11808
9927 EVALUATE(ASI) { 11809 EVALUATE(ASI) {
9928 DCHECK_OPCODE(ASI); 11810 DCHECK_OPCODE(ASI);
9929 // TODO(bcleung): Change all fooInstr->I2Value() to template functions. 11811 // TODO(bcleung): Change all fooInstr->I2Value() to template functions.
9930 // The below static cast to 8 bit and then to 32 bit is necessary 11812 // The below static cast to 8 bit and then to 32 bit is necessary
9931 // because siyInstr->I2Value() returns a uint8_t, which a direct 11813 // because siyInstr->I2Value() returns a uint8_t, which a direct
9932 // cast to int32_t could incorrectly interpret. 11814 // cast to int32_t could incorrectly interpret.
9933 DECODE_SIY_INSTRUCTION(b1, d1, i2_unsigned); 11815 DECODE_SIY_INSTRUCTION(b1, d1, i2_unsigned);
9934 int8_t i2_8bit = static_cast<int8_t>(i2_unsigned); 11816 int8_t i2_8bit = static_cast<int8_t>(i2_unsigned);
9935 int32_t i2 = static_cast<int32_t>(i2_8bit); 11817 int32_t i2 = static_cast<int32_t>(i2_8bit);
9936 intptr_t b1_val = (b1 == 0) ? 0 : get_register(b1); 11818 intptr_t b1_val = (b1 == 0) ? 0 : get_register(b1);
9937 11819
9938 int d1_val = d1; 11820 int d1_val = d1;
9939 intptr_t addr = b1_val + d1_val; 11821 intptr_t addr = b1_val + d1_val;
9940 11822
9941 int32_t mem_val = ReadW(addr, instr); 11823 int32_t mem_val = ReadW(addr, instr);
9942 bool isOF = CheckOverflowForIntAdd(mem_val, i2, int32_t); 11824 bool isOF = CheckOverflowForIntAdd(mem_val, i2, int32_t);
9943 int32_t alu_out = mem_val + i2; 11825 int32_t alu_out = mem_val + i2;
9944 SetS390ConditionCode<int32_t>(alu_out, 0); 11826 SetS390ConditionCode<int32_t>(alu_out, 0);
9945 SetS390OverflowCode(isOF); 11827 SetS390OverflowCode(isOF);
9946 WriteW(addr, alu_out, instr); 11828 WriteW(addr, alu_out, instr);
9947 return length; 11829 return length;
9948 } 11830 }
9949 11831
9950 EVALUATE(ALSI) { return DecodeInstructionOriginal(instr); } 11832 EVALUATE(ALSI) {
11833 UNIMPLEMENTED();
11834 USE(instr);
11835 return 0;
11836 }
9951 11837
9952 EVALUATE(AGSI) { 11838 EVALUATE(AGSI) {
9953 DCHECK_OPCODE(AGSI); 11839 DCHECK_OPCODE(AGSI);
9954 // TODO(bcleung): Change all fooInstr->I2Value() to template functions. 11840 // TODO(bcleung): Change all fooInstr->I2Value() to template functions.
9955 // The below static cast to 8 bit and then to 32 bit is necessary 11841 // The below static cast to 8 bit and then to 32 bit is necessary
9956 // because siyInstr->I2Value() returns a uint8_t, which a direct 11842 // because siyInstr->I2Value() returns a uint8_t, which a direct
9957 // cast to int32_t could incorrectly interpret. 11843 // cast to int32_t could incorrectly interpret.
9958 DECODE_SIY_INSTRUCTION(b1, d1, i2_unsigned); 11844 DECODE_SIY_INSTRUCTION(b1, d1, i2_unsigned);
9959 int8_t i2_8bit = static_cast<int8_t>(i2_unsigned); 11845 int8_t i2_8bit = static_cast<int8_t>(i2_unsigned);
9960 int64_t i2 = static_cast<int64_t>(i2_8bit); 11846 int64_t i2 = static_cast<int64_t>(i2_8bit);
9961 intptr_t b1_val = (b1 == 0) ? 0 : get_register(b1); 11847 intptr_t b1_val = (b1 == 0) ? 0 : get_register(b1);
9962 11848
9963 int d1_val = d1; 11849 int d1_val = d1;
9964 intptr_t addr = b1_val + d1_val; 11850 intptr_t addr = b1_val + d1_val;
9965 11851
9966 int64_t mem_val = ReadDW(addr); 11852 int64_t mem_val = ReadDW(addr);
9967 int isOF = CheckOverflowForIntAdd(mem_val, i2, int64_t); 11853 int isOF = CheckOverflowForIntAdd(mem_val, i2, int64_t);
9968 int64_t alu_out = mem_val + i2; 11854 int64_t alu_out = mem_val + i2;
9969 SetS390ConditionCode<uint64_t>(alu_out, 0); 11855 SetS390ConditionCode<uint64_t>(alu_out, 0);
9970 SetS390OverflowCode(isOF); 11856 SetS390OverflowCode(isOF);
9971 WriteDW(addr, alu_out); 11857 WriteDW(addr, alu_out);
9972 return length; 11858 return length;
9973 } 11859 }
9974 11860
9975 EVALUATE(ALGSI) { return DecodeInstructionOriginal(instr); } 11861 EVALUATE(ALGSI) {
11862 UNIMPLEMENTED();
11863 USE(instr);
11864 return 0;
11865 }
9976 11866
9977 EVALUATE(ICMH) { return DecodeInstructionOriginal(instr); } 11867 EVALUATE(ICMH) {
11868 UNIMPLEMENTED();
11869 USE(instr);
11870 return 0;
11871 }
9978 11872
9979 EVALUATE(ICMY) { return DecodeInstructionOriginal(instr); } 11873 EVALUATE(ICMY) {
11874 UNIMPLEMENTED();
11875 USE(instr);
11876 return 0;
11877 }
9980 11878
9981 EVALUATE(MVCLU) { return DecodeInstructionOriginal(instr); } 11879 EVALUATE(MVCLU) {
11880 UNIMPLEMENTED();
11881 USE(instr);
11882 return 0;
11883 }
9982 11884
9983 EVALUATE(CLCLU) { return DecodeInstructionOriginal(instr); } 11885 EVALUATE(CLCLU) {
11886 UNIMPLEMENTED();
11887 USE(instr);
11888 return 0;
11889 }
9984 11890
9985 EVALUATE(STMY) { 11891 EVALUATE(STMY) {
9986 DCHECK_OPCODE(STMY); 11892 DCHECK_OPCODE(STMY);
9987 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2); 11893 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2);
9988 // Load/Store Multiple (32) 11894 // Load/Store Multiple (32)
9989 int offset = d2; 11895 int offset = d2;
9990 11896
9991 // Regs roll around if r3 is less than r1. 11897 // Regs roll around if r3 is less than r1.
9992 // Artifically increase r3 by 16 so we can calculate 11898 // Artifically increase r3 by 16 so we can calculate
9993 // the number of regs stored properly. 11899 // the number of regs stored properly.
9994 if (r3 < r1) r3 += 16; 11900 if (r3 < r1) r3 += 16;
9995 11901
9996 int32_t b2_val = (b2 == 0) ? 0 : get_low_register<int32_t>(b2); 11902 int32_t b2_val = (b2 == 0) ? 0 : get_low_register<int32_t>(b2);
9997 11903
9998 // Store each register in ascending order. 11904 // Store each register in ascending order.
9999 for (int i = 0; i <= r3 - r1; i++) { 11905 for (int i = 0; i <= r3 - r1; i++) {
10000 int32_t value = get_low_register<int32_t>((r1 + i) % 16); 11906 int32_t value = get_low_register<int32_t>((r1 + i) % 16);
10001 WriteW(b2_val + offset + 4 * i, value, instr); 11907 WriteW(b2_val + offset + 4 * i, value, instr);
10002 } 11908 }
10003 return length; 11909 return length;
10004 } 11910 }
10005 11911
10006 EVALUATE(LMH) { return DecodeInstructionOriginal(instr); } 11912 EVALUATE(LMH) {
11913 UNIMPLEMENTED();
11914 USE(instr);
11915 return 0;
11916 }
10007 11917
10008 EVALUATE(LMY) { 11918 EVALUATE(LMY) {
10009 DCHECK_OPCODE(LMY); 11919 DCHECK_OPCODE(LMY);
10010 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2); 11920 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2);
10011 // Load/Store Multiple (32) 11921 // Load/Store Multiple (32)
10012 int offset = d2; 11922 int offset = d2;
10013 11923
10014 // Regs roll around if r3 is less than r1. 11924 // Regs roll around if r3 is less than r1.
10015 // Artifically increase r3 by 16 so we can calculate 11925 // Artifically increase r3 by 16 so we can calculate
10016 // the number of regs stored properly. 11926 // the number of regs stored properly.
10017 if (r3 < r1) r3 += 16; 11927 if (r3 < r1) r3 += 16;
10018 11928
10019 int32_t b2_val = (b2 == 0) ? 0 : get_low_register<int32_t>(b2); 11929 int32_t b2_val = (b2 == 0) ? 0 : get_low_register<int32_t>(b2);
10020 11930
10021 // Store each register in ascending order. 11931 // Store each register in ascending order.
10022 for (int i = 0; i <= r3 - r1; i++) { 11932 for (int i = 0; i <= r3 - r1; i++) {
10023 int32_t value = ReadW(b2_val + offset + 4 * i, instr); 11933 int32_t value = ReadW(b2_val + offset + 4 * i, instr);
10024 set_low_register((r1 + i) % 16, value); 11934 set_low_register((r1 + i) % 16, value);
10025 } 11935 }
10026 return length; 11936 return length;
10027 } 11937 }
10028 11938
10029 EVALUATE(TP) { return DecodeInstructionOriginal(instr); } 11939 EVALUATE(TP) {
11940 UNIMPLEMENTED();
11941 USE(instr);
11942 return 0;
11943 }
10030 11944
10031 EVALUATE(SRAK) { 11945 EVALUATE(SRAK) {
10032 DCHECK_OPCODE(SRAK); 11946 DCHECK_OPCODE(SRAK);
10033 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2); 11947 DECODE_RSY_A_INSTRUCTION(r1, r3, b2, d2);
10034 // 32-bit non-clobbering shift-left/right arithmetic 11948 // 32-bit non-clobbering shift-left/right arithmetic
10035 // only takes rightmost 6 bits 11949 // only takes rightmost 6 bits
10036 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 11950 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
10037 int shiftBits = (b2_val + d2) & 0x3F; 11951 int shiftBits = (b2_val + d2) & 0x3F;
10038 int32_t r3_val = get_low_register<int32_t>(r3); 11952 int32_t r3_val = get_low_register<int32_t>(r3);
10039 int32_t alu_out = 0; 11953 int32_t alu_out = 0;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
10094 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 12008 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
10095 int shiftBits = (b2_val + d2) & 0x3F; 12009 int shiftBits = (b2_val + d2) & 0x3F;
10096 // unsigned 12010 // unsigned
10097 uint32_t r3_val = get_low_register<uint32_t>(r3); 12011 uint32_t r3_val = get_low_register<uint32_t>(r3);
10098 uint32_t alu_out = 0; 12012 uint32_t alu_out = 0;
10099 alu_out = r3_val << shiftBits; 12013 alu_out = r3_val << shiftBits;
10100 set_low_register(r1, alu_out); 12014 set_low_register(r1, alu_out);
10101 return length; 12015 return length;
10102 } 12016 }
10103 12017
10104 EVALUATE(LOCG) { return DecodeInstructionOriginal(instr); } 12018 EVALUATE(LOCG) {
10105 12019 UNIMPLEMENTED();
10106 EVALUATE(STOCG) { return DecodeInstructionOriginal(instr); } 12020 USE(instr);
10107 12021 return 0;
10108 EVALUATE(LANG) { return DecodeInstructionOriginal(instr); } 12022 }
10109 12023
10110 EVALUATE(LAOG) { return DecodeInstructionOriginal(instr); } 12024 EVALUATE(STOCG) {
10111 12025 UNIMPLEMENTED();
10112 EVALUATE(LAXG) { return DecodeInstructionOriginal(instr); } 12026 USE(instr);
10113 12027 return 0;
10114 EVALUATE(LAAG) { return DecodeInstructionOriginal(instr); } 12028 }
10115 12029
10116 EVALUATE(LAALG) { return DecodeInstructionOriginal(instr); } 12030 EVALUATE(LANG) {
10117 12031 UNIMPLEMENTED();
10118 EVALUATE(LOC) { return DecodeInstructionOriginal(instr); } 12032 USE(instr);
10119 12033 return 0;
10120 EVALUATE(STOC) { return DecodeInstructionOriginal(instr); } 12034 }
10121 12035
10122 EVALUATE(LAN) { return DecodeInstructionOriginal(instr); } 12036 EVALUATE(LAOG) {
10123 12037 UNIMPLEMENTED();
10124 EVALUATE(LAO) { return DecodeInstructionOriginal(instr); } 12038 USE(instr);
10125 12039 return 0;
10126 EVALUATE(LAX) { return DecodeInstructionOriginal(instr); } 12040 }
10127 12041
10128 EVALUATE(LAA) { return DecodeInstructionOriginal(instr); } 12042 EVALUATE(LAXG) {
10129 12043 UNIMPLEMENTED();
10130 EVALUATE(LAAL) { return DecodeInstructionOriginal(instr); } 12044 USE(instr);
10131 12045 return 0;
10132 EVALUATE(BRXHG) { return DecodeInstructionOriginal(instr); } 12046 }
10133 12047
10134 EVALUATE(BRXLG) { return DecodeInstructionOriginal(instr); } 12048 EVALUATE(LAAG) {
10135 12049 UNIMPLEMENTED();
10136 EVALUATE(RISBLG) { return DecodeInstructionOriginal(instr); } 12050 USE(instr);
10137 12051 return 0;
10138 EVALUATE(RNSBG) { return DecodeInstructionOriginal(instr); } 12052 }
10139 12053
10140 EVALUATE(ROSBG) { return DecodeInstructionOriginal(instr); } 12054 EVALUATE(LAALG) {
10141 12055 UNIMPLEMENTED();
10142 EVALUATE(RXSBG) { return DecodeInstructionOriginal(instr); } 12056 USE(instr);
10143 12057 return 0;
10144 EVALUATE(RISBGN) { return DecodeInstructionOriginal(instr); } 12058 }
10145 12059
10146 EVALUATE(RISBHG) { return DecodeInstructionOriginal(instr); } 12060 EVALUATE(LOC) {
10147 12061 UNIMPLEMENTED();
10148 EVALUATE(CGRJ) { return DecodeInstructionOriginal(instr); } 12062 USE(instr);
10149 12063 return 0;
10150 EVALUATE(CGIT) { return DecodeInstructionOriginal(instr); } 12064 }
10151 12065
10152 EVALUATE(CIT) { return DecodeInstructionOriginal(instr); } 12066 EVALUATE(STOC) {
10153 12067 UNIMPLEMENTED();
10154 EVALUATE(CLFIT) { return DecodeInstructionOriginal(instr); } 12068 USE(instr);
10155 12069 return 0;
10156 EVALUATE(CGIJ) { return DecodeInstructionOriginal(instr); } 12070 }
10157 12071
10158 EVALUATE(CIJ) { return DecodeInstructionOriginal(instr); } 12072 EVALUATE(LAN) {
10159 12073 UNIMPLEMENTED();
10160 EVALUATE(ALHSIK) { return DecodeInstructionOriginal(instr); } 12074 USE(instr);
10161 12075 return 0;
10162 EVALUATE(ALGHSIK) { return DecodeInstructionOriginal(instr); } 12076 }
10163 12077
10164 EVALUATE(CGRB) { return DecodeInstructionOriginal(instr); } 12078 EVALUATE(LAO) {
10165 12079 UNIMPLEMENTED();
10166 EVALUATE(CGIB) { return DecodeInstructionOriginal(instr); } 12080 USE(instr);
10167 12081 return 0;
10168 EVALUATE(CIB) { return DecodeInstructionOriginal(instr); } 12082 }
12083
12084 EVALUATE(LAX) {
12085 UNIMPLEMENTED();
12086 USE(instr);
12087 return 0;
12088 }
12089
12090 EVALUATE(LAA) {
12091 UNIMPLEMENTED();
12092 USE(instr);
12093 return 0;
12094 }
12095
12096 EVALUATE(LAAL) {
12097 UNIMPLEMENTED();
12098 USE(instr);
12099 return 0;
12100 }
12101
12102 EVALUATE(BRXHG) {
12103 UNIMPLEMENTED();
12104 USE(instr);
12105 return 0;
12106 }
12107
12108 EVALUATE(BRXLG) {
12109 UNIMPLEMENTED();
12110 USE(instr);
12111 return 0;
12112 }
12113
12114 EVALUATE(RISBLG) {
12115 UNIMPLEMENTED();
12116 USE(instr);
12117 return 0;
12118 }
12119
12120 EVALUATE(RNSBG) {
12121 UNIMPLEMENTED();
12122 USE(instr);
12123 return 0;
12124 }
12125
12126 EVALUATE(ROSBG) {
12127 UNIMPLEMENTED();
12128 USE(instr);
12129 return 0;
12130 }
12131
12132 EVALUATE(RXSBG) {
12133 UNIMPLEMENTED();
12134 USE(instr);
12135 return 0;
12136 }
12137
12138 EVALUATE(RISBGN) {
12139 UNIMPLEMENTED();
12140 USE(instr);
12141 return 0;
12142 }
12143
12144 EVALUATE(RISBHG) {
12145 UNIMPLEMENTED();
12146 USE(instr);
12147 return 0;
12148 }
12149
12150 EVALUATE(CGRJ) {
12151 UNIMPLEMENTED();
12152 USE(instr);
12153 return 0;
12154 }
12155
12156 EVALUATE(CGIT) {
12157 UNIMPLEMENTED();
12158 USE(instr);
12159 return 0;
12160 }
12161
12162 EVALUATE(CIT) {
12163 UNIMPLEMENTED();
12164 USE(instr);
12165 return 0;
12166 }
12167
12168 EVALUATE(CLFIT) {
12169 UNIMPLEMENTED();
12170 USE(instr);
12171 return 0;
12172 }
12173
12174 EVALUATE(CGIJ) {
12175 UNIMPLEMENTED();
12176 USE(instr);
12177 return 0;
12178 }
12179
12180 EVALUATE(CIJ) {
12181 UNIMPLEMENTED();
12182 USE(instr);
12183 return 0;
12184 }
12185
12186 EVALUATE(ALHSIK) {
12187 UNIMPLEMENTED();
12188 USE(instr);
12189 return 0;
12190 }
12191
12192 EVALUATE(ALGHSIK) {
12193 UNIMPLEMENTED();
12194 USE(instr);
12195 return 0;
12196 }
12197
12198 EVALUATE(CGRB) {
12199 UNIMPLEMENTED();
12200 USE(instr);
12201 return 0;
12202 }
12203
12204 EVALUATE(CGIB) {
12205 UNIMPLEMENTED();
12206 USE(instr);
12207 return 0;
12208 }
12209
12210 EVALUATE(CIB) {
12211 UNIMPLEMENTED();
12212 USE(instr);
12213 return 0;
12214 }
10169 12215
10170 EVALUATE(LDEB) { 12216 EVALUATE(LDEB) {
10171 DCHECK_OPCODE(LDEB); 12217 DCHECK_OPCODE(LDEB);
10172 // Load Float 12218 // Load Float
10173 DECODE_RXE_INSTRUCTION(r1, b2, x2, d2); 12219 DECODE_RXE_INSTRUCTION(r1, b2, x2, d2);
10174 int rb = b2; 12220 int rb = b2;
10175 int rx = x2; 12221 int rx = x2;
10176 int offset = d2; 12222 int offset = d2;
10177 int64_t rb_val = (rb == 0) ? 0 : get_register(rb); 12223 int64_t rb_val = (rb == 0) ? 0 : get_register(rb);
10178 int64_t rx_val = (rx == 0) ? 0 : get_register(rx); 12224 int64_t rx_val = (rx == 0) ? 0 : get_register(rx);
10179 double ret = 12225 double ret =
10180 static_cast<double>(*reinterpret_cast<float*>(rx_val + rb_val + offset)); 12226 static_cast<double>(*reinterpret_cast<float*>(rx_val + rb_val + offset));
10181 set_d_register_from_double(r1, ret); 12227 set_d_register_from_double(r1, ret);
10182 return length; 12228 return length;
10183 } 12229 }
10184 12230
10185 EVALUATE(LXDB) { return DecodeInstructionOriginal(instr); } 12231 EVALUATE(LXDB) {
12232 UNIMPLEMENTED();
12233 USE(instr);
12234 return 0;
12235 }
10186 12236
10187 EVALUATE(LXEB) { return DecodeInstructionOriginal(instr); } 12237 EVALUATE(LXEB) {
12238 UNIMPLEMENTED();
12239 USE(instr);
12240 return 0;
12241 }
10188 12242
10189 EVALUATE(MXDB) { return DecodeInstructionOriginal(instr); } 12243 EVALUATE(MXDB) {
12244 UNIMPLEMENTED();
12245 USE(instr);
12246 return 0;
12247 }
10190 12248
10191 EVALUATE(KEB) { return DecodeInstructionOriginal(instr); } 12249 EVALUATE(KEB) {
12250 UNIMPLEMENTED();
12251 USE(instr);
12252 return 0;
12253 }
10192 12254
10193 EVALUATE(CEB) { return DecodeInstructionOriginal(instr); } 12255 EVALUATE(CEB) {
12256 UNIMPLEMENTED();
12257 USE(instr);
12258 return 0;
12259 }
10194 12260
10195 EVALUATE(AEB) { return DecodeInstructionOriginal(instr); } 12261 EVALUATE(AEB) {
12262 UNIMPLEMENTED();
12263 USE(instr);
12264 return 0;
12265 }
10196 12266
10197 EVALUATE(SEB) { return DecodeInstructionOriginal(instr); } 12267 EVALUATE(SEB) {
12268 UNIMPLEMENTED();
12269 USE(instr);
12270 return 0;
12271 }
10198 12272
10199 EVALUATE(MDEB) { return DecodeInstructionOriginal(instr); } 12273 EVALUATE(MDEB) {
12274 UNIMPLEMENTED();
12275 USE(instr);
12276 return 0;
12277 }
10200 12278
10201 EVALUATE(DEB) { return DecodeInstructionOriginal(instr); } 12279 EVALUATE(DEB) {
12280 UNIMPLEMENTED();
12281 USE(instr);
12282 return 0;
12283 }
10202 12284
10203 EVALUATE(MAEB) { return DecodeInstructionOriginal(instr); } 12285 EVALUATE(MAEB) {
12286 UNIMPLEMENTED();
12287 USE(instr);
12288 return 0;
12289 }
10204 12290
10205 EVALUATE(MSEB) { return DecodeInstructionOriginal(instr); } 12291 EVALUATE(MSEB) {
12292 UNIMPLEMENTED();
12293 USE(instr);
12294 return 0;
12295 }
10206 12296
10207 EVALUATE(TCEB) { return DecodeInstructionOriginal(instr); } 12297 EVALUATE(TCEB) {
12298 UNIMPLEMENTED();
12299 USE(instr);
12300 return 0;
12301 }
10208 12302
10209 EVALUATE(TCDB) { return DecodeInstructionOriginal(instr); } 12303 EVALUATE(TCDB) {
12304 UNIMPLEMENTED();
12305 USE(instr);
12306 return 0;
12307 }
10210 12308
10211 EVALUATE(TCXB) { return DecodeInstructionOriginal(instr); } 12309 EVALUATE(TCXB) {
12310 UNIMPLEMENTED();
12311 USE(instr);
12312 return 0;
12313 }
10212 12314
10213 EVALUATE(SQEB) { return DecodeInstructionOriginal(instr); } 12315 EVALUATE(SQEB) {
12316 UNIMPLEMENTED();
12317 USE(instr);
12318 return 0;
12319 }
10214 12320
10215 EVALUATE(SQDB) { 12321 EVALUATE(SQDB) {
10216 DCHECK_OPCODE(SQDB); 12322 DCHECK_OPCODE(SQDB);
10217 DECODE_RXE_INSTRUCTION(r1, b2, x2, d2); 12323 DECODE_RXE_INSTRUCTION(r1, b2, x2, d2);
10218 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 12324 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
10219 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 12325 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
10220 intptr_t d2_val = d2; 12326 intptr_t d2_val = d2;
10221 double r1_val = get_double_from_d_register(r1); 12327 double r1_val = get_double_from_d_register(r1);
10222 double dbl_val = ReadDouble(b2_val + x2_val + d2_val); 12328 double dbl_val = ReadDouble(b2_val + x2_val + d2_val);
10223 r1_val = std::sqrt(dbl_val); 12329 r1_val = std::sqrt(dbl_val);
10224 set_d_register_from_double(r1, r1_val); 12330 set_d_register_from_double(r1, r1_val);
10225 return length; 12331 return length;
10226 } 12332 }
10227 12333
10228 EVALUATE(MEEB) { return DecodeInstructionOriginal(instr); } 12334 EVALUATE(MEEB) {
12335 UNIMPLEMENTED();
12336 USE(instr);
12337 return 0;
12338 }
10229 12339
10230 EVALUATE(KDB) { return DecodeInstructionOriginal(instr); } 12340 EVALUATE(KDB) {
12341 UNIMPLEMENTED();
12342 USE(instr);
12343 return 0;
12344 }
10231 12345
10232 EVALUATE(CDB) { 12346 EVALUATE(CDB) {
10233 DCHECK_OPCODE(CDB); 12347 DCHECK_OPCODE(CDB);
10234 12348
10235 DECODE_RXE_INSTRUCTION(r1, b2, x2, d2); 12349 DECODE_RXE_INSTRUCTION(r1, b2, x2, d2);
10236 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 12350 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
10237 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 12351 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
10238 intptr_t d2_val = d2; 12352 intptr_t d2_val = d2;
10239 double r1_val = get_double_from_d_register(r1); 12353 double r1_val = get_double_from_d_register(r1);
10240 double dbl_val = ReadDouble(b2_val + x2_val + d2_val); 12354 double dbl_val = ReadDouble(b2_val + x2_val + d2_val);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
10292 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 12406 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
10293 intptr_t d2_val = d2; 12407 intptr_t d2_val = d2;
10294 double r1_val = get_double_from_d_register(r1); 12408 double r1_val = get_double_from_d_register(r1);
10295 double dbl_val = ReadDouble(b2_val + x2_val + d2_val); 12409 double dbl_val = ReadDouble(b2_val + x2_val + d2_val);
10296 r1_val /= dbl_val; 12410 r1_val /= dbl_val;
10297 set_d_register_from_double(r1, r1_val); 12411 set_d_register_from_double(r1, r1_val);
10298 SetS390ConditionCode<double>(r1_val, 0); 12412 SetS390ConditionCode<double>(r1_val, 0);
10299 return length; 12413 return length;
10300 } 12414 }
10301 12415
10302 EVALUATE(MADB) { return DecodeInstructionOriginal(instr); } 12416 EVALUATE(MADB) {
12417 UNIMPLEMENTED();
12418 USE(instr);
12419 return 0;
12420 }
10303 12421
10304 EVALUATE(MSDB) { return DecodeInstructionOriginal(instr); } 12422 EVALUATE(MSDB) {
12423 UNIMPLEMENTED();
12424 USE(instr);
12425 return 0;
12426 }
10305 12427
10306 EVALUATE(SLDT) { return DecodeInstructionOriginal(instr); } 12428 EVALUATE(SLDT) {
12429 UNIMPLEMENTED();
12430 USE(instr);
12431 return 0;
12432 }
10307 12433
10308 EVALUATE(SRDT) { return DecodeInstructionOriginal(instr); } 12434 EVALUATE(SRDT) {
12435 UNIMPLEMENTED();
12436 USE(instr);
12437 return 0;
12438 }
10309 12439
10310 EVALUATE(SLXT) { return DecodeInstructionOriginal(instr); } 12440 EVALUATE(SLXT) {
12441 UNIMPLEMENTED();
12442 USE(instr);
12443 return 0;
12444 }
10311 12445
10312 EVALUATE(SRXT) { return DecodeInstructionOriginal(instr); } 12446 EVALUATE(SRXT) {
12447 UNIMPLEMENTED();
12448 USE(instr);
12449 return 0;
12450 }
10313 12451
10314 EVALUATE(TDCET) { return DecodeInstructionOriginal(instr); } 12452 EVALUATE(TDCET) {
12453 UNIMPLEMENTED();
12454 USE(instr);
12455 return 0;
12456 }
10315 12457
10316 EVALUATE(TDGET) { return DecodeInstructionOriginal(instr); } 12458 EVALUATE(TDGET) {
12459 UNIMPLEMENTED();
12460 USE(instr);
12461 return 0;
12462 }
10317 12463
10318 EVALUATE(TDCDT) { return DecodeInstructionOriginal(instr); } 12464 EVALUATE(TDCDT) {
12465 UNIMPLEMENTED();
12466 USE(instr);
12467 return 0;
12468 }
10319 12469
10320 EVALUATE(TDGDT) { return DecodeInstructionOriginal(instr); } 12470 EVALUATE(TDGDT) {
12471 UNIMPLEMENTED();
12472 USE(instr);
12473 return 0;
12474 }
10321 12475
10322 EVALUATE(TDCXT) { return DecodeInstructionOriginal(instr); } 12476 EVALUATE(TDCXT) {
12477 UNIMPLEMENTED();
12478 USE(instr);
12479 return 0;
12480 }
10323 12481
10324 EVALUATE(TDGXT) { return DecodeInstructionOriginal(instr); } 12482 EVALUATE(TDGXT) {
12483 UNIMPLEMENTED();
12484 USE(instr);
12485 return 0;
12486 }
10325 12487
10326 EVALUATE(LEY) { 12488 EVALUATE(LEY) {
10327 DCHECK_OPCODE(LEY); 12489 DCHECK_OPCODE(LEY);
10328 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 12490 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
10329 // Miscellaneous Loads and Stores 12491 // Miscellaneous Loads and Stores
10330 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 12492 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
10331 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 12493 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
10332 intptr_t addr = x2_val + b2_val + d2; 12494 intptr_t addr = x2_val + b2_val + d2;
10333 float float_val = *reinterpret_cast<float*>(addr); 12495 float float_val = *reinterpret_cast<float*>(addr);
10334 set_d_register_from_float32(r1, float_val); 12496 set_d_register_from_float32(r1, float_val);
(...skipping 29 matching lines...) Expand all
10364 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); 12526 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2);
10365 // Miscellaneous Loads and Stores 12527 // Miscellaneous Loads and Stores
10366 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); 12528 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2);
10367 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); 12529 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2);
10368 intptr_t addr = x2_val + b2_val + d2; 12530 intptr_t addr = x2_val + b2_val + d2;
10369 int64_t frs_val = get_d_register(r1); 12531 int64_t frs_val = get_d_register(r1);
10370 WriteDW(addr, frs_val); 12532 WriteDW(addr, frs_val);
10371 return length; 12533 return length;
10372 } 12534 }
10373 12535
10374 EVALUATE(CZDT) { return DecodeInstructionOriginal(instr); } 12536 EVALUATE(CZDT) {
12537 UNIMPLEMENTED();
12538 USE(instr);
12539 return 0;
12540 }
10375 12541
10376 EVALUATE(CZXT) { return DecodeInstructionOriginal(instr); } 12542 EVALUATE(CZXT) {
12543 UNIMPLEMENTED();
12544 USE(instr);
12545 return 0;
12546 }
10377 12547
10378 EVALUATE(CDZT) { return DecodeInstructionOriginal(instr); } 12548 EVALUATE(CDZT) {
12549 UNIMPLEMENTED();
12550 USE(instr);
12551 return 0;
12552 }
10379 12553
10380 EVALUATE(CXZT) { return DecodeInstructionOriginal(instr); } 12554 EVALUATE(CXZT) {
12555 UNIMPLEMENTED();
12556 USE(instr);
12557 return 0;
12558 }
10381 12559
10382 #undef EVALUATE 12560 #undef EVALUATE
10383 12561
10384 } // namespace internal 12562 } // namespace internal
10385 } // namespace v8 12563 } // namespace v8
10386 12564
10387 #endif // USE_SIMULATOR 12565 #endif // USE_SIMULATOR
10388 #endif // V8_TARGET_ARCH_S390 12566 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698