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

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

Issue 2152363002: PPC: [turbofan] Introduce integer multiplication with overflow. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed mullw instruction as suggested Created 4 years, 5 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 | src/compiler/ppc/instruction-codes-ppc.h » ('j') | 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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 case kArchPrepareCallCFunction: { 968 case kArchPrepareCallCFunction: {
969 int const num_parameters = MiscField::decode(instr->opcode()); 969 int const num_parameters = MiscField::decode(instr->opcode());
970 __ PrepareCallCFunction(num_parameters, kScratchReg); 970 __ PrepareCallCFunction(num_parameters, kScratchReg);
971 // Frame alignment requires using FP-relative frame addressing. 971 // Frame alignment requires using FP-relative frame addressing.
972 frame_access_state()->SetFrameAccessToFP(); 972 frame_access_state()->SetFrameAccessToFP();
973 break; 973 break;
974 } 974 }
975 case kArchPrepareTailCall: 975 case kArchPrepareTailCall:
976 AssemblePrepareTailCall(); 976 AssemblePrepareTailCall();
977 break; 977 break;
978 case kArchComment: {
979 Address comment_string = i.InputExternalReference(0).address();
980 __ RecordComment(reinterpret_cast<const char*>(comment_string));
981 break;
982 }
978 case kArchCallCFunction: { 983 case kArchCallCFunction: {
979 int const num_parameters = MiscField::decode(instr->opcode()); 984 int const num_parameters = MiscField::decode(instr->opcode());
980 if (instr->InputAt(0)->IsImmediate()) { 985 if (instr->InputAt(0)->IsImmediate()) {
981 ExternalReference ref = i.InputExternalReference(0); 986 ExternalReference ref = i.InputExternalReference(0);
982 __ CallCFunction(ref, num_parameters); 987 __ CallCFunction(ref, num_parameters);
983 } else { 988 } else {
984 Register func = i.InputRegister(0); 989 Register func = i.InputRegister(0);
985 __ CallCFunction(func, num_parameters); 990 __ CallCFunction(func, num_parameters);
986 } 991 }
987 frame_access_state()->SetFrameAccessToDefault(); 992 frame_access_state()->SetFrameAccessToDefault();
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 case kPPC_Mul32: 1298 case kPPC_Mul32:
1294 __ mullw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 1299 __ mullw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
1295 LeaveOE, i.OutputRCBit()); 1300 LeaveOE, i.OutputRCBit());
1296 break; 1301 break;
1297 #if V8_TARGET_ARCH_PPC64 1302 #if V8_TARGET_ARCH_PPC64
1298 case kPPC_Mul64: 1303 case kPPC_Mul64:
1299 __ mulld(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 1304 __ mulld(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
1300 LeaveOE, i.OutputRCBit()); 1305 LeaveOE, i.OutputRCBit());
1301 break; 1306 break;
1302 #endif 1307 #endif
1308
1309 case kPPC_Mul32WithHigh32:
1310 if (i.OutputRegister(0).is(i.InputRegister(0)) ||
1311 i.OutputRegister(0).is(i.InputRegister(1)) ||
1312 i.OutputRegister(1).is(i.InputRegister(0)) ||
1313 i.OutputRegister(1).is(i.InputRegister(1))) {
1314 __ mullw(kScratchReg,
1315 i.InputRegister(0), i.InputRegister(1)); // low
1316 __ mulhw(i.OutputRegister(1),
1317 i.InputRegister(0), i.InputRegister(1)); // high
1318 __ mr(i.OutputRegister(0), kScratchReg);
1319 } else {
1320 __ mullw(i.OutputRegister(0),
1321 i.InputRegister(0), i.InputRegister(1)); // low
1322 __ mulhw(i.OutputRegister(1),
1323 i.InputRegister(0), i.InputRegister(1)); // high
1324 }
1325 break;
1303 case kPPC_MulHigh32: 1326 case kPPC_MulHigh32:
1304 __ mulhw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 1327 __ mulhw(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
1305 i.OutputRCBit()); 1328 i.OutputRCBit());
1306 break; 1329 break;
1307 case kPPC_MulHighU32: 1330 case kPPC_MulHighU32:
1308 __ mulhwu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1), 1331 __ mulhwu(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
1309 i.OutputRCBit()); 1332 i.OutputRCBit());
1310 break; 1333 break;
1311 case kPPC_MulDouble: 1334 case kPPC_MulDouble:
1312 ASSEMBLE_FLOAT_BINOP_RC(fmul, MiscField::decode(instr->opcode())); 1335 ASSEMBLE_FLOAT_BINOP_RC(fmul, MiscField::decode(instr->opcode()));
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 padding_size -= v8::internal::Assembler::kInstrSize; 2367 padding_size -= v8::internal::Assembler::kInstrSize;
2345 } 2368 }
2346 } 2369 }
2347 } 2370 }
2348 2371
2349 #undef __ 2372 #undef __
2350 2373
2351 } // namespace compiler 2374 } // namespace compiler
2352 } // namespace internal 2375 } // namespace internal
2353 } // namespace v8 2376 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-codes-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698