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

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

Issue 1803113002: PPC: [wasm] Int64Lowering of Int64Add. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « src/ppc/disasm-ppc.cc ('k') | 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_PPC 9 #if V8_TARGET_ARCH_PPC
10 10
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 break; 2039 break;
2040 } 2040 }
2041 case ADDCX: { 2041 case ADDCX: {
2042 int rt = instr->RTValue(); 2042 int rt = instr->RTValue();
2043 int ra = instr->RAValue(); 2043 int ra = instr->RAValue();
2044 int rb = instr->RBValue(); 2044 int rb = instr->RBValue();
2045 // int oe = instr->Bit(10); 2045 // int oe = instr->Bit(10);
2046 uintptr_t ra_val = get_register(ra); 2046 uintptr_t ra_val = get_register(ra);
2047 uintptr_t rb_val = get_register(rb); 2047 uintptr_t rb_val = get_register(rb);
2048 uintptr_t alu_out = ra_val + rb_val; 2048 uintptr_t alu_out = ra_val + rb_val;
2049 // Check overflow 2049 // Set carry
2050 if (~ra_val < rb_val) { 2050 if (~ra_val < rb_val) {
2051 special_reg_xer_ = (special_reg_xer_ & ~0xF0000000) | 0x20000000; 2051 special_reg_xer_ = (special_reg_xer_ & ~0xF0000000) | 0x20000000;
2052 } else { 2052 } else {
2053 special_reg_xer_ &= ~0xF0000000; 2053 special_reg_xer_ &= ~0xF0000000;
2054 } 2054 }
2055 set_register(rt, alu_out); 2055 set_register(rt, alu_out);
2056 if (instr->Bit(0)) { // RC bit set 2056 if (instr->Bit(0)) { // RC bit set
2057 SetCR0(static_cast<intptr_t>(alu_out)); 2057 SetCR0(static_cast<intptr_t>(alu_out));
2058 } 2058 }
2059 // todo - handle OE bit 2059 // todo - handle OE bit
2060 break; 2060 break;
2061 } 2061 }
2062 case ADDEX: {
2063 int rt = instr->RTValue();
2064 int ra = instr->RAValue();
2065 int rb = instr->RBValue();
2066 // int oe = instr->Bit(10);
2067 uintptr_t ra_val = get_register(ra);
2068 uintptr_t rb_val = get_register(rb);
2069 uintptr_t alu_out = ra_val + rb_val;
2070 if (special_reg_xer_ & 0x20000000) {
2071 alu_out += 1;
2072 }
2073 set_register(rt, alu_out);
2074 if (instr->Bit(0)) { // RC bit set
2075 SetCR0(static_cast<intptr_t>(alu_out));
2076 }
2077 // todo - handle OE bit
2078 break;
2079 }
2062 case MULHWX: { 2080 case MULHWX: {
2063 int rt = instr->RTValue(); 2081 int rt = instr->RTValue();
2064 int ra = instr->RAValue(); 2082 int ra = instr->RAValue();
2065 int rb = instr->RBValue(); 2083 int rb = instr->RBValue();
2066 int32_t ra_val = (get_register(ra) & 0xFFFFFFFF); 2084 int32_t ra_val = (get_register(ra) & 0xFFFFFFFF);
2067 int32_t rb_val = (get_register(rb) & 0xFFFFFFFF); 2085 int32_t rb_val = (get_register(rb) & 0xFFFFFFFF);
2068 int64_t alu_out = (int64_t)ra_val * (int64_t)rb_val; 2086 int64_t alu_out = (int64_t)ra_val * (int64_t)rb_val;
2069 alu_out >>= 32; 2087 alu_out >>= 32;
2070 set_register(rt, alu_out); 2088 set_register(rt, alu_out);
2071 if (instr->Bit(0)) { // RC bit set 2089 if (instr->Bit(0)) { // RC bit set
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after
4093 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); 4111 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
4094 uintptr_t address = *stack_slot; 4112 uintptr_t address = *stack_slot;
4095 set_register(sp, current_sp + sizeof(uintptr_t)); 4113 set_register(sp, current_sp + sizeof(uintptr_t));
4096 return address; 4114 return address;
4097 } 4115 }
4098 } // namespace internal 4116 } // namespace internal
4099 } // namespace v8 4117 } // namespace v8
4100 4118
4101 #endif // USE_SIMULATOR 4119 #endif // USE_SIMULATOR
4102 #endif // V8_TARGET_ARCH_PPC 4120 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/disasm-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698