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

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

Issue 436593002: [turbofan] Add Int32AddWithOverflow machine operator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add more tests. Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/code-generator-impl.h ('k') | src/compiler/ia32/instruction-selector-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // Fall through. 457 // Fall through.
458 case kUnsignedLessThanOrEqual: 458 case kUnsignedLessThanOrEqual:
459 __ j(below_equal, tlabel); 459 __ j(below_equal, tlabel);
460 break; 460 break;
461 case kUnorderedGreaterThan: 461 case kUnorderedGreaterThan:
462 __ j(parity_even, tlabel); 462 __ j(parity_even, tlabel);
463 // Fall through. 463 // Fall through.
464 case kUnsignedGreaterThan: 464 case kUnsignedGreaterThan:
465 __ j(above, tlabel); 465 __ j(above, tlabel);
466 break; 466 break;
467 case kOverflow:
468 __ j(overflow, tlabel);
469 break;
470 case kNotOverflow:
471 __ j(no_overflow, tlabel);
472 break;
467 } 473 }
468 if (!fallthru) __ jmp(flabel, flabel_distance); // no fallthru to flabel. 474 if (!fallthru) __ jmp(flabel, flabel_distance); // no fallthru to flabel.
469 __ bind(&done); 475 __ bind(&done);
470 } 476 }
471 477
472 478
473 // Assembles boolean materializations after an instruction. 479 // Assembles boolean materializations after an instruction.
474 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 480 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
475 FlagsCondition condition) { 481 FlagsCondition condition) {
476 IA32OperandConverter i(this, instr); 482 IA32OperandConverter i(this, instr);
477 Label done; 483 Label done;
478 484
479 // Materialize a full 32-bit 1 or 0 value. 485 // Materialize a full 32-bit 1 or 0 value. The result register is always the
486 // last output of the instruction.
480 Label check; 487 Label check;
481 Register reg = i.OutputRegister(); 488 ASSERT_NE(0, instr->OutputCount());
489 Register reg = i.OutputRegister(instr->OutputCount() - 1);
482 Condition cc = no_condition; 490 Condition cc = no_condition;
483 switch (condition) { 491 switch (condition) {
484 case kUnorderedEqual: 492 case kUnorderedEqual:
485 __ j(parity_odd, &check, Label::kNear); 493 __ j(parity_odd, &check, Label::kNear);
486 __ mov(reg, Immediate(0)); 494 __ mov(reg, Immediate(0));
487 __ jmp(&done, Label::kNear); 495 __ jmp(&done, Label::kNear);
488 // Fall through. 496 // Fall through.
489 case kEqual: 497 case kEqual:
490 cc = equal; 498 cc = equal;
491 break; 499 break;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 cc = below_equal; 542 cc = below_equal;
535 break; 543 break;
536 case kUnorderedGreaterThan: 544 case kUnorderedGreaterThan:
537 __ j(parity_odd, &check, Label::kNear); 545 __ j(parity_odd, &check, Label::kNear);
538 __ mov(reg, Immediate(1)); 546 __ mov(reg, Immediate(1));
539 __ jmp(&done, Label::kNear); 547 __ jmp(&done, Label::kNear);
540 // Fall through. 548 // Fall through.
541 case kUnsignedGreaterThan: 549 case kUnsignedGreaterThan:
542 cc = above; 550 cc = above;
543 break; 551 break;
552 case kOverflow:
553 cc = overflow;
554 break;
555 case kNotOverflow:
556 cc = no_overflow;
557 break;
544 } 558 }
545 __ bind(&check); 559 __ bind(&check);
546 if (reg.is_byte_register()) { 560 if (reg.is_byte_register()) {
547 // setcc for byte registers (al, bl, cl, dl). 561 // setcc for byte registers (al, bl, cl, dl).
548 __ setcc(cc, reg); 562 __ setcc(cc, reg);
549 __ movzx_b(reg, reg); 563 __ movzx_b(reg, reg);
550 } else { 564 } else {
551 // Emit a branch to set a register to either 1 or 0. 565 // Emit a branch to set a register to either 1 or 0.
552 Label set; 566 Label set;
553 __ j(cc, &set, Label::kNear); 567 __ j(cc, &set, Label::kNear);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 return false; 947 return false;
934 } 948 }
935 return *(code->instruction_start() + start_pc) == 949 return *(code->instruction_start() + start_pc) ==
936 v8::internal::Assembler::kNopByte; 950 v8::internal::Assembler::kNopByte;
937 } 951 }
938 952
939 #endif // DEBUG 953 #endif // DEBUG
940 } 954 }
941 } 955 }
942 } // namespace v8::internal::compiler 956 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/code-generator-impl.h ('k') | src/compiler/ia32/instruction-selector-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698