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

Side by Side Diff: src/compiler/s390/instruction-selector-s390.cc

Issue 2785773002: [turbofan] introduce Int32/64AbsWithOverflow optional operator (Closed)
Patch Set: add base impl Created 3 years, 8 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/compiler/s390/instruction-scheduler-s390.cc ('k') | src/compiler/verifier.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/s390/frames-s390.h" 9 #include "src/s390/frames-s390.h"
10 10
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // return true; 382 // return true;
383 // default: 383 // default:
384 // return false; 384 // return false;
385 // } 385 // }
386 // } 386 // }
387 case IrOpcode::kLoad: { 387 case IrOpcode::kLoad: {
388 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); 388 LoadRepresentation load_rep = LoadRepresentationOf(node->op());
389 switch (load_rep.representation()) { 389 switch (load_rep.representation()) {
390 case MachineRepresentation::kWord32: 390 case MachineRepresentation::kWord32:
391 return true; 391 return true;
392 case MachineRepresentation::kWord8:
393 if (load_rep.IsSigned())
394 return false;
395 else
396 return true;
392 default: 397 default:
393 return false; 398 return false;
394 } 399 }
395 } 400 }
396 default: 401 default:
397 return false; 402 return false;
398 } 403 }
399 #endif 404 #endif
400 } 405 }
401 406
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 513
509 // Generate The following variations: 514 // Generate The following variations:
510 // VisitWord32UnaryOp, VisitWord32BinOp, 515 // VisitWord32UnaryOp, VisitWord32BinOp,
511 // VisitWord64UnaryOp, VisitWord64BinOp, 516 // VisitWord64UnaryOp, VisitWord64BinOp,
512 // VisitFloat32UnaryOp, VisitFloat32BinOp, 517 // VisitFloat32UnaryOp, VisitFloat32BinOp,
513 // VisitFloat64UnaryOp, VisitFloat64BinOp 518 // VisitFloat64UnaryOp, VisitFloat64BinOp
514 #define VISIT_OP_LIST_32(V) \ 519 #define VISIT_OP_LIST_32(V) \
515 V(Word32, Unary, [](ArchOpcode opcode) { \ 520 V(Word32, Unary, [](ArchOpcode opcode) { \
516 return opcode == kS390_LoadWordS32 || opcode == kS390_LoadWordU32; \ 521 return opcode == kS390_LoadWordS32 || opcode == kS390_LoadWordU32; \
517 }) \ 522 }) \
523 V(Word64, Unary, \
524 [](ArchOpcode opcode) { return opcode == kS390_LoadWord64; }) \
518 V(Float32, Unary, \ 525 V(Float32, Unary, \
519 [](ArchOpcode opcode) { return opcode == kS390_LoadFloat32; }) \ 526 [](ArchOpcode opcode) { return opcode == kS390_LoadFloat32; }) \
520 V(Float64, Unary, \ 527 V(Float64, Unary, \
521 [](ArchOpcode opcode) { return opcode == kS390_LoadDouble; }) \ 528 [](ArchOpcode opcode) { return opcode == kS390_LoadDouble; }) \
522 V(Word32, Bin, [](ArchOpcode opcode) { \ 529 V(Word32, Bin, [](ArchOpcode opcode) { \
523 return opcode == kS390_LoadWordS32 || opcode == kS390_LoadWordU32; \ 530 return opcode == kS390_LoadWordS32 || opcode == kS390_LoadWordU32; \
524 }) \ 531 }) \
525 V(Float32, Bin, \ 532 V(Float32, Bin, \
526 [](ArchOpcode opcode) { return opcode == kS390_LoadFloat32; }) \ 533 [](ArchOpcode opcode) { return opcode == kS390_LoadFloat32; }) \
527 V(Float64, Bin, [](ArchOpcode opcode) { return opcode == kS390_LoadDouble; }) 534 V(Float64, Bin, [](ArchOpcode opcode) { return opcode == kS390_LoadDouble; })
528 535
529 #if V8_TARGET_ARCH_S390X 536 #if V8_TARGET_ARCH_S390X
530 #define VISIT_OP_LIST(V) \ 537 #define VISIT_OP_LIST(V) \
531 VISIT_OP_LIST_32(V) \ 538 VISIT_OP_LIST_32(V) \
532 V(Word64, Unary, \
533 [](ArchOpcode opcode) { return opcode == kS390_LoadWord64; }) \
534 V(Word64, Bin, [](ArchOpcode opcode) { return opcode == kS390_LoadWord64; }) 539 V(Word64, Bin, [](ArchOpcode opcode) { return opcode == kS390_LoadWord64; })
535 #else 540 #else
536 #define VISIT_OP_LIST VISIT_OP_LIST_32 541 #define VISIT_OP_LIST VISIT_OP_LIST_32
537 #endif 542 #endif
538 543
539 #define DECLARE_VISIT_HELPER_FUNCTIONS(type1, type2, canCombineWithLoad) \ 544 #define DECLARE_VISIT_HELPER_FUNCTIONS(type1, type2, canCombineWithLoad) \
540 static inline void Visit##type1##type2##Op( \ 545 static inline void Visit##type1##type2##Op( \
541 InstructionSelector* selector, Node* node, InstructionCode opcode, \ 546 InstructionSelector* selector, Node* node, InstructionCode opcode, \
542 OperandModes operand_mode, FlagsContinuation* cont) { \ 547 OperandModes operand_mode, FlagsContinuation* cont) { \
543 Visit##type2##Op(selector, node, opcode, operand_mode, cont, \ 548 Visit##type2##Op(selector, node, opcode, operand_mode, cont, \
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 #if V8_TARGET_ARCH_S390X 1240 #if V8_TARGET_ARCH_S390X
1236 void InstructionSelector::VisitWord64Ctz(Node* node) { UNREACHABLE(); } 1241 void InstructionSelector::VisitWord64Ctz(Node* node) { UNREACHABLE(); }
1237 #endif 1242 #endif
1238 1243
1239 void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); } 1244 void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); }
1240 1245
1241 #if V8_TARGET_ARCH_S390X 1246 #if V8_TARGET_ARCH_S390X
1242 void InstructionSelector::VisitWord64ReverseBits(Node* node) { UNREACHABLE(); } 1247 void InstructionSelector::VisitWord64ReverseBits(Node* node) { UNREACHABLE(); }
1243 #endif 1248 #endif
1244 1249
1250 void InstructionSelector::VisitInt32AbsWithOverflow(Node* node) {
1251 VisitWord32UnaryOp(this, node, kS390_Abs32, OperandMode::kNone);
1252 }
1253
1254 void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) {
1255 VisitWord64UnaryOp(this, node, kS390_Abs64, OperandMode::kNone);
1256 }
1257
1245 void InstructionSelector::VisitWord64ReverseBytes(Node* node) { 1258 void InstructionSelector::VisitWord64ReverseBytes(Node* node) {
1246 S390OperandGenerator g(this); 1259 S390OperandGenerator g(this);
1247 Emit(kS390_LoadReverse64RR, g.DefineAsRegister(node), 1260 Emit(kS390_LoadReverse64RR, g.DefineAsRegister(node),
1248 g.UseRegister(node->InputAt(0))); 1261 g.UseRegister(node->InputAt(0)));
1249 } 1262 }
1250 1263
1251 void InstructionSelector::VisitWord32ReverseBytes(Node* node) { 1264 void InstructionSelector::VisitWord32ReverseBytes(Node* node) {
1252 S390OperandGenerator g(this); 1265 S390OperandGenerator g(this);
1253 NodeMatcher input(node->InputAt(0)); 1266 NodeMatcher input(node->InputAt(0));
1254 if (CanCover(node, input.node()) && input.IsLoad()) { 1267 if (CanCover(node, input.node()) && input.IsLoad()) {
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 case IrOpcode::kInt32SubWithOverflow: 2043 case IrOpcode::kInt32SubWithOverflow:
2031 cont->OverwriteAndNegateIfEqual(kOverflow); 2044 cont->OverwriteAndNegateIfEqual(kOverflow);
2032 return VisitWord32BinOp(selector, node, kS390_Sub32, 2045 return VisitWord32BinOp(selector, node, kS390_Sub32,
2033 SubOperandMode, cont); 2046 SubOperandMode, cont);
2034 case IrOpcode::kInt32MulWithOverflow: 2047 case IrOpcode::kInt32MulWithOverflow:
2035 cont->OverwriteAndNegateIfEqual(kNotEqual); 2048 cont->OverwriteAndNegateIfEqual(kNotEqual);
2036 return VisitWord32BinOp( 2049 return VisitWord32BinOp(
2037 selector, node, kS390_Mul32WithOverflow, 2050 selector, node, kS390_Mul32WithOverflow,
2038 OperandMode::kInt32Imm | OperandMode::kAllowDistinctOps, 2051 OperandMode::kInt32Imm | OperandMode::kAllowDistinctOps,
2039 cont); 2052 cont);
2053 case IrOpcode::kInt32AbsWithOverflow:
2054 cont->OverwriteAndNegateIfEqual(kOverflow);
2055 return VisitWord32UnaryOp(selector, node, kS390_Abs32,
2056 OperandMode::kNone, cont);
2040 #if V8_TARGET_ARCH_S390X 2057 #if V8_TARGET_ARCH_S390X
2058 case IrOpcode::kInt64AbsWithOverflow:
2059 cont->OverwriteAndNegateIfEqual(kOverflow);
2060 return VisitWord64UnaryOp(selector, node, kS390_Abs64,
2061 OperandMode::kNone, cont);
2041 case IrOpcode::kInt64AddWithOverflow: 2062 case IrOpcode::kInt64AddWithOverflow:
2042 cont->OverwriteAndNegateIfEqual(kOverflow); 2063 cont->OverwriteAndNegateIfEqual(kOverflow);
2043 return VisitWord64BinOp(selector, node, kS390_Add64, 2064 return VisitWord64BinOp(selector, node, kS390_Add64,
2044 AddOperandMode, cont); 2065 AddOperandMode, cont);
2045 case IrOpcode::kInt64SubWithOverflow: 2066 case IrOpcode::kInt64SubWithOverflow:
2046 cont->OverwriteAndNegateIfEqual(kOverflow); 2067 cont->OverwriteAndNegateIfEqual(kOverflow);
2047 return VisitWord64BinOp(selector, node, kS390_Sub64, 2068 return VisitWord64BinOp(selector, node, kS390_Sub64,
2048 SubOperandMode, cont); 2069 SubOperandMode, cont);
2049 #endif 2070 #endif
2050 default: 2071 default:
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 return MachineOperatorBuilder::kFloat32RoundDown | 2464 return MachineOperatorBuilder::kFloat32RoundDown |
2444 MachineOperatorBuilder::kFloat64RoundDown | 2465 MachineOperatorBuilder::kFloat64RoundDown |
2445 MachineOperatorBuilder::kFloat32RoundUp | 2466 MachineOperatorBuilder::kFloat32RoundUp |
2446 MachineOperatorBuilder::kFloat64RoundUp | 2467 MachineOperatorBuilder::kFloat64RoundUp |
2447 MachineOperatorBuilder::kFloat32RoundTruncate | 2468 MachineOperatorBuilder::kFloat32RoundTruncate |
2448 MachineOperatorBuilder::kFloat64RoundTruncate | 2469 MachineOperatorBuilder::kFloat64RoundTruncate |
2449 MachineOperatorBuilder::kFloat64RoundTiesAway | 2470 MachineOperatorBuilder::kFloat64RoundTiesAway |
2450 MachineOperatorBuilder::kWord32Popcnt | 2471 MachineOperatorBuilder::kWord32Popcnt |
2451 MachineOperatorBuilder::kWord32ReverseBytes | 2472 MachineOperatorBuilder::kWord32ReverseBytes |
2452 MachineOperatorBuilder::kWord64ReverseBytes | 2473 MachineOperatorBuilder::kWord64ReverseBytes |
2474 MachineOperatorBuilder::kInt32AbsWithOverflow |
2475 MachineOperatorBuilder::kInt64AbsWithOverflow |
2453 MachineOperatorBuilder::kWord64Popcnt; 2476 MachineOperatorBuilder::kWord64Popcnt;
2454 } 2477 }
2455 2478
2456 // static 2479 // static
2457 MachineOperatorBuilder::AlignmentRequirements 2480 MachineOperatorBuilder::AlignmentRequirements
2458 InstructionSelector::AlignmentRequirements() { 2481 InstructionSelector::AlignmentRequirements() {
2459 return MachineOperatorBuilder::AlignmentRequirements:: 2482 return MachineOperatorBuilder::AlignmentRequirements::
2460 FullUnalignedAccessSupport(); 2483 FullUnalignedAccessSupport();
2461 } 2484 }
2462 2485
2463 } // namespace compiler 2486 } // namespace compiler
2464 } // namespace internal 2487 } // namespace internal
2465 } // namespace v8 2488 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/s390/instruction-scheduler-s390.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698