OLD | NEW |
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 6566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6577 int32_t r1_val = get_low_register<int32_t>(r1); | 6577 int32_t r1_val = get_low_register<int32_t>(r1); |
6578 int32_t r2_val = get_low_register<int32_t>(r2); | 6578 int32_t r2_val = get_low_register<int32_t>(r2); |
6579 DCHECK(r1 % 2 == 0); | 6579 DCHECK(r1 % 2 == 0); |
6580 r1_val = get_low_register<int32_t>(r1 + 1); | 6580 r1_val = get_low_register<int32_t>(r1 + 1); |
6581 int64_t product = static_cast<int64_t>(r1_val) * static_cast<int64_t>(r2_val); | 6581 int64_t product = static_cast<int64_t>(r1_val) * static_cast<int64_t>(r2_val); |
6582 int32_t high_bits = product >> 32; | 6582 int32_t high_bits = product >> 32; |
6583 r1_val = high_bits; | 6583 r1_val = high_bits; |
6584 int32_t low_bits = product & 0x00000000FFFFFFFF; | 6584 int32_t low_bits = product & 0x00000000FFFFFFFF; |
6585 set_low_register(r1, high_bits); | 6585 set_low_register(r1, high_bits); |
6586 set_low_register(r1 + 1, low_bits); | 6586 set_low_register(r1 + 1, low_bits); |
6587 set_low_register(r1, r1_val); | |
6588 return length; | 6587 return length; |
6589 } | 6588 } |
6590 | 6589 |
6591 EVALUATE(DR) { | 6590 EVALUATE(DR) { |
6592 DCHECK_OPCODE(DR); | 6591 DCHECK_OPCODE(DR); |
6593 DECODE_RR_INSTRUCTION(r1, r2); | 6592 DECODE_RR_INSTRUCTION(r1, r2); |
6594 int32_t r1_val = get_low_register<int32_t>(r1); | 6593 int32_t r1_val = get_low_register<int32_t>(r1); |
6595 int32_t r2_val = get_low_register<int32_t>(r2); | 6594 int32_t r2_val = get_low_register<int32_t>(r2); |
6596 // reg-reg pair should be even-odd pair, assert r1 is an even register | 6595 // reg-reg pair should be even-odd pair, assert r1 is an even register |
6597 DCHECK(r1 % 2 == 0); | 6596 DCHECK(r1 % 2 == 0); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6933 bool isOF = false; | 6932 bool isOF = false; |
6934 isOF = CheckOverflowForIntSub(r1_val, mem_val, int32_t); | 6933 isOF = CheckOverflowForIntSub(r1_val, mem_val, int32_t); |
6935 alu_out = r1_val - mem_val; | 6934 alu_out = r1_val - mem_val; |
6936 SetS390ConditionCode<int32_t>(alu_out, 0); | 6935 SetS390ConditionCode<int32_t>(alu_out, 0); |
6937 SetS390OverflowCode(isOF); | 6936 SetS390OverflowCode(isOF); |
6938 set_low_register(r1, alu_out); | 6937 set_low_register(r1, alu_out); |
6939 return length; | 6938 return length; |
6940 } | 6939 } |
6941 | 6940 |
6942 EVALUATE(M) { | 6941 EVALUATE(M) { |
6943 UNIMPLEMENTED(); | 6942 DCHECK_OPCODE(M); |
6944 USE(instr); | 6943 DECODE_RX_A_INSTRUCTION(x2, b2, r1, d2_val); |
6945 return 0; | 6944 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); |
| 6945 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); |
| 6946 intptr_t addr = b2_val + x2_val + d2_val; |
| 6947 DCHECK(r1 % 2 == 0); |
| 6948 int32_t mem_val = ReadW(addr, instr); |
| 6949 int32_t r1_val = get_low_register<int32_t>(r1 + 1); |
| 6950 int64_t product = |
| 6951 static_cast<int64_t>(r1_val) * static_cast<int64_t>(mem_val); |
| 6952 int32_t high_bits = product >> 32; |
| 6953 r1_val = high_bits; |
| 6954 int32_t low_bits = product & 0x00000000FFFFFFFF; |
| 6955 set_low_register(r1, high_bits); |
| 6956 set_low_register(r1 + 1, low_bits); |
| 6957 return length; |
6946 } | 6958 } |
6947 | 6959 |
6948 EVALUATE(D) { | 6960 EVALUATE(D) { |
6949 UNIMPLEMENTED(); | 6961 UNIMPLEMENTED(); |
6950 USE(instr); | 6962 USE(instr); |
6951 return 0; | 6963 return 0; |
6952 } | 6964 } |
6953 | 6965 |
6954 EVALUATE(AL) { | 6966 EVALUATE(AL) { |
6955 UNIMPLEMENTED(); | 6967 UNIMPLEMENTED(); |
(...skipping 4193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11149 bool isOF = false; | 11161 bool isOF = false; |
11150 isOF = CheckOverflowForIntSub(alu_out, mem_val, int32_t); | 11162 isOF = CheckOverflowForIntSub(alu_out, mem_val, int32_t); |
11151 alu_out -= mem_val; | 11163 alu_out -= mem_val; |
11152 SetS390ConditionCode<int32_t>(alu_out, 0); | 11164 SetS390ConditionCode<int32_t>(alu_out, 0); |
11153 SetS390OverflowCode(isOF); | 11165 SetS390OverflowCode(isOF); |
11154 set_low_register(r1, alu_out); | 11166 set_low_register(r1, alu_out); |
11155 return length; | 11167 return length; |
11156 } | 11168 } |
11157 | 11169 |
11158 EVALUATE(MFY) { | 11170 EVALUATE(MFY) { |
11159 UNIMPLEMENTED(); | 11171 DCHECK_OPCODE(MFY); |
11160 USE(instr); | 11172 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); |
11161 return 0; | 11173 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); |
| 11174 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); |
| 11175 DCHECK(r1 % 2 == 0); |
| 11176 int32_t mem_val = ReadW(b2_val + x2_val + d2, instr); |
| 11177 int32_t r1_val = get_low_register<int32_t>(r1 + 1); |
| 11178 int64_t product = |
| 11179 static_cast<int64_t>(r1_val) * static_cast<int64_t>(mem_val); |
| 11180 int32_t high_bits = product >> 32; |
| 11181 r1_val = high_bits; |
| 11182 int32_t low_bits = product & 0x00000000FFFFFFFF; |
| 11183 set_low_register(r1, high_bits); |
| 11184 set_low_register(r1 + 1, low_bits); |
| 11185 return length; |
11162 } | 11186 } |
11163 | 11187 |
11164 EVALUATE(ALY) { | 11188 EVALUATE(ALY) { |
11165 DCHECK_OPCODE(ALY); | 11189 DCHECK_OPCODE(ALY); |
11166 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); | 11190 DECODE_RXY_A_INSTRUCTION(r1, x2, b2, d2); |
11167 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); | 11191 int64_t x2_val = (x2 == 0) ? 0 : get_register(x2); |
11168 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); | 11192 int64_t b2_val = (b2 == 0) ? 0 : get_register(b2); |
11169 uint32_t alu_out = get_low_register<uint32_t>(r1); | 11193 uint32_t alu_out = get_low_register<uint32_t>(r1); |
11170 uint32_t mem_val = ReadWU(b2_val + x2_val + d2, instr); | 11194 uint32_t mem_val = ReadWU(b2_val + x2_val + d2, instr); |
11171 alu_out += mem_val; | 11195 alu_out += mem_val; |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12598 return 0; | 12622 return 0; |
12599 } | 12623 } |
12600 | 12624 |
12601 #undef EVALUATE | 12625 #undef EVALUATE |
12602 | 12626 |
12603 } // namespace internal | 12627 } // namespace internal |
12604 } // namespace v8 | 12628 } // namespace v8 |
12605 | 12629 |
12606 #endif // USE_SIMULATOR | 12630 #endif // USE_SIMULATOR |
12607 #endif // V8_TARGET_ARCH_S390 | 12631 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |