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

Side by Side Diff: src/compiler/ppc/code-generator-ppc.cc

Issue 2043553002: PPC: Store Floats as 4 bytes and Double as 8 bytes for codegen (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 frame_access_state()->IncreaseSPDelta(kDoubleSize / kPointerSize); 1333 frame_access_state()->IncreaseSPDelta(kDoubleSize / kPointerSize);
1334 } else { 1334 } else {
1335 __ Push(i.InputRegister(0)); 1335 __ Push(i.InputRegister(0));
1336 frame_access_state()->IncreaseSPDelta(1); 1336 frame_access_state()->IncreaseSPDelta(1);
1337 } 1337 }
1338 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1338 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1339 break; 1339 break;
1340 case kPPC_PushFrame: { 1340 case kPPC_PushFrame: {
1341 int num_slots = i.InputInt32(1); 1341 int num_slots = i.InputInt32(1);
1342 if (instr->InputAt(0)->IsFPRegister()) { 1342 if (instr->InputAt(0)->IsFPRegister()) {
1343 __ StoreDoubleU(i.InputDoubleRegister(0), 1343 LocationOperand* op = LocationOperand::cast(instr->InputAt(0));
1344 if (op->representation() == MachineRepresentation::kFloat64) {
1345 __ StoreDoubleU(i.InputDoubleRegister(0),
1344 MemOperand(sp, -num_slots * kPointerSize), r0); 1346 MemOperand(sp, -num_slots * kPointerSize), r0);
1347 } else {
1348 DCHECK(op->representation() == MachineRepresentation::kFloat32);
1349 __ StoreSingleU(i.InputDoubleRegister(0),
1350 MemOperand(sp, -num_slots * kPointerSize), r0);
1351 }
1345 } else { 1352 } else {
1346 __ StorePU(i.InputRegister(0), 1353 __ StorePU(i.InputRegister(0),
1347 MemOperand(sp, -num_slots * kPointerSize), r0); 1354 MemOperand(sp, -num_slots * kPointerSize), r0);
1348 } 1355 }
1349 break; 1356 break;
1350 } 1357 }
1351 case kPPC_StoreToStackSlot: { 1358 case kPPC_StoreToStackSlot: {
1352 int slot = i.InputInt32(1); 1359 int slot = i.InputInt32(1);
1353 if (instr->InputAt(0)->IsFPRegister()) { 1360 if (instr->InputAt(0)->IsFPRegister()) {
1354 __ StoreDouble(i.InputDoubleRegister(0), 1361 LocationOperand* op = LocationOperand::cast(instr->InputAt(0));
1355 MemOperand(sp, slot * kPointerSize), r0); 1362 if (op->representation() == MachineRepresentation::kFloat64) {
1363 __ StoreDouble(i.InputDoubleRegister(0),
1364 MemOperand(sp, slot * kPointerSize), r0);
1365 } else {
1366 DCHECK(op->representation() == MachineRepresentation::kFloat32);
1367 __ StoreSingle(i.InputDoubleRegister(0),
1368 MemOperand(sp, slot * kPointerSize), r0);
1369 }
1356 } else { 1370 } else {
1357 __ StoreP(i.InputRegister(0), MemOperand(sp, slot * kPointerSize), r0); 1371 __ StoreP(i.InputRegister(0), MemOperand(sp, slot * kPointerSize), r0);
1358 } 1372 }
1359 break; 1373 break;
1360 } 1374 }
1361 case kPPC_ExtendSignWord8: 1375 case kPPC_ExtendSignWord8:
1362 __ extsb(i.OutputRegister(), i.InputRegister(0)); 1376 __ extsb(i.OutputRegister(), i.InputRegister(0));
1363 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1377 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1364 break; 1378 break;
1365 case kPPC_ExtendSignWord16: 1379 case kPPC_ExtendSignWord16:
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 __ StoreDouble(dst, g.ToMemOperand(destination), r0); 2023 __ StoreDouble(dst, g.ToMemOperand(destination), r0);
2010 } 2024 }
2011 } 2025 }
2012 } else if (source->IsFPRegister()) { 2026 } else if (source->IsFPRegister()) {
2013 DoubleRegister src = g.ToDoubleRegister(source); 2027 DoubleRegister src = g.ToDoubleRegister(source);
2014 if (destination->IsFPRegister()) { 2028 if (destination->IsFPRegister()) {
2015 DoubleRegister dst = g.ToDoubleRegister(destination); 2029 DoubleRegister dst = g.ToDoubleRegister(destination);
2016 __ Move(dst, src); 2030 __ Move(dst, src);
2017 } else { 2031 } else {
2018 DCHECK(destination->IsFPStackSlot()); 2032 DCHECK(destination->IsFPStackSlot());
2019 __ StoreDouble(src, g.ToMemOperand(destination), r0); 2033 LocationOperand* op = LocationOperand::cast(source);
2034 if (op->representation() == MachineRepresentation::kFloat64) {
2035 __ StoreDouble(src, g.ToMemOperand(destination), r0);
2036 } else {
2037 __ StoreSingle(src, g.ToMemOperand(destination), r0);
2038 }
2020 } 2039 }
2021 } else if (source->IsFPStackSlot()) { 2040 } else if (source->IsFPStackSlot()) {
2022 DCHECK(destination->IsFPRegister() || destination->IsFPStackSlot()); 2041 DCHECK(destination->IsFPRegister() || destination->IsFPStackSlot());
2023 MemOperand src = g.ToMemOperand(source); 2042 MemOperand src = g.ToMemOperand(source);
2024 if (destination->IsFPRegister()) { 2043 if (destination->IsFPRegister()) {
2025 __ LoadDouble(g.ToDoubleRegister(destination), src, r0); 2044 LocationOperand* op = LocationOperand::cast(source);
2045 if (op->representation() == MachineRepresentation::kFloat64) {
2046 __ LoadDouble(g.ToDoubleRegister(destination), src, r0);
2047 } else {
2048 __ LoadSingle(g.ToDoubleRegister(destination), src, r0);
2049 }
2026 } else { 2050 } else {
2051 LocationOperand* op = LocationOperand::cast(source);
2027 DoubleRegister temp = kScratchDoubleReg; 2052 DoubleRegister temp = kScratchDoubleReg;
2028 __ LoadDouble(temp, src, r0); 2053 if (op->representation() == MachineRepresentation::kFloat64) {
2029 __ StoreDouble(temp, g.ToMemOperand(destination), r0); 2054 __ LoadDouble(temp, src, r0);
2055 __ StoreDouble(temp, g.ToMemOperand(destination), r0);
2056 } else {
2057 __ LoadSingle(temp, src, r0);
2058 __ StoreSingle(temp, g.ToMemOperand(destination), r0);
2059 }
2030 } 2060 }
2031 } else { 2061 } else {
2032 UNREACHABLE(); 2062 UNREACHABLE();
2033 } 2063 }
2034 } 2064 }
2035 2065
2036 2066
2037 void CodeGenerator::AssembleSwap(InstructionOperand* source, 2067 void CodeGenerator::AssembleSwap(InstructionOperand* source,
2038 InstructionOperand* destination) { 2068 InstructionOperand* destination) {
2039 PPCOperandConverter g(this, nullptr); 2069 PPCOperandConverter g(this, nullptr);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 padding_size -= v8::internal::Assembler::kInstrSize; 2160 padding_size -= v8::internal::Assembler::kInstrSize;
2131 } 2161 }
2132 } 2162 }
2133 } 2163 }
2134 2164
2135 #undef __ 2165 #undef __
2136 2166
2137 } // namespace compiler 2167 } // namespace compiler
2138 } // namespace internal 2168 } // namespace internal
2139 } // namespace v8 2169 } // namespace v8
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