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

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

Issue 1044793002: [turbofan] Add backend support for float32 operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add MachineOperator unit tests. Created 5 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
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/ia32/assembler-ia32.h" 10 #include "src/ia32/assembler-ia32.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 case kIA32Ror: 443 case kIA32Ror:
444 if (HasImmediateInput(instr, 1)) { 444 if (HasImmediateInput(instr, 1)) {
445 __ ror(i.OutputOperand(), i.InputInt5(1)); 445 __ ror(i.OutputOperand(), i.InputInt5(1));
446 } else { 446 } else {
447 __ ror_cl(i.OutputOperand()); 447 __ ror_cl(i.OutputOperand());
448 } 448 }
449 break; 449 break;
450 case kIA32Lzcnt: 450 case kIA32Lzcnt:
451 __ Lzcnt(i.OutputRegister(), i.InputOperand(0)); 451 __ Lzcnt(i.OutputRegister(), i.InputOperand(0));
452 break; 452 break;
453 case kSSEFloat32Cmp:
454 __ ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
455 break;
456 case kSSEFloat32Add:
457 __ addss(i.InputDoubleRegister(0), i.InputOperand(1));
458 break;
459 case kSSEFloat32Sub:
460 __ subss(i.InputDoubleRegister(0), i.InputOperand(1));
461 break;
462 case kSSEFloat32Mul:
463 __ mulss(i.InputDoubleRegister(0), i.InputOperand(1));
464 break;
465 case kSSEFloat32Div:
466 __ divss(i.InputDoubleRegister(0), i.InputOperand(1));
467 break;
468 case kSSEFloat32Max:
469 __ maxss(i.InputDoubleRegister(0), i.InputOperand(1));
470 break;
471 case kSSEFloat32Min:
472 __ minss(i.InputDoubleRegister(0), i.InputOperand(1));
473 break;
474 case kSSEFloat32Sqrt:
475 __ sqrtss(i.OutputDoubleRegister(), i.InputOperand(0));
476 break;
453 case kSSEFloat64Cmp: 477 case kSSEFloat64Cmp:
454 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); 478 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
455 break; 479 break;
456 case kSSEFloat64Add: 480 case kSSEFloat64Add:
457 __ addsd(i.InputDoubleRegister(0), i.InputOperand(1)); 481 __ addsd(i.InputDoubleRegister(0), i.InputOperand(1));
458 break; 482 break;
459 case kSSEFloat64Sub: 483 case kSSEFloat64Sub:
460 __ subsd(i.InputDoubleRegister(0), i.InputOperand(1)); 484 __ subsd(i.InputDoubleRegister(0), i.InputOperand(1));
461 break; 485 break;
462 case kSSEFloat64Mul: 486 case kSSEFloat64Mul:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 case kSSEFloat64Sqrt: 523 case kSSEFloat64Sqrt:
500 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0)); 524 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0));
501 break; 525 break;
502 case kSSEFloat64Round: { 526 case kSSEFloat64Round: {
503 CpuFeatureScope sse_scope(masm(), SSE4_1); 527 CpuFeatureScope sse_scope(masm(), SSE4_1);
504 RoundingMode const mode = 528 RoundingMode const mode =
505 static_cast<RoundingMode>(MiscField::decode(instr->opcode())); 529 static_cast<RoundingMode>(MiscField::decode(instr->opcode()));
506 __ roundsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode); 530 __ roundsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode);
507 break; 531 break;
508 } 532 }
509 case kSSECvtss2sd: 533 case kSSEFloat32ToFloat64:
510 __ cvtss2sd(i.OutputDoubleRegister(), i.InputOperand(0)); 534 __ cvtss2sd(i.OutputDoubleRegister(), i.InputOperand(0));
511 break; 535 break;
512 case kSSECvtsd2ss: 536 case kSSEFloat64ToFloat32:
513 __ cvtsd2ss(i.OutputDoubleRegister(), i.InputOperand(0)); 537 __ cvtsd2ss(i.OutputDoubleRegister(), i.InputOperand(0));
514 break; 538 break;
515 case kSSEFloat64ToInt32: 539 case kSSEFloat64ToInt32:
516 __ cvttsd2si(i.OutputRegister(), i.InputOperand(0)); 540 __ cvttsd2si(i.OutputRegister(), i.InputOperand(0));
517 break; 541 break;
518 case kSSEFloat64ToUint32: { 542 case kSSEFloat64ToUint32: {
519 XMMRegister scratch = xmm0; 543 XMMRegister scratch = xmm0;
520 __ Move(scratch, -2147483648.0); 544 __ Move(scratch, -2147483648.0);
521 __ addsd(scratch, i.InputOperand(0)); 545 __ addsd(scratch, i.InputOperand(0));
522 __ cvttsd2si(i.OutputRegister(), scratch); 546 __ cvttsd2si(i.OutputRegister(), scratch);
(...skipping 22 matching lines...) Expand all
545 break; 569 break;
546 case kSSEFloat64InsertLowWord32: 570 case kSSEFloat64InsertLowWord32:
547 __ Pinsrd(i.OutputDoubleRegister(), i.InputOperand(1), 0); 571 __ Pinsrd(i.OutputDoubleRegister(), i.InputOperand(1), 0);
548 break; 572 break;
549 case kSSEFloat64InsertHighWord32: 573 case kSSEFloat64InsertHighWord32:
550 __ Pinsrd(i.OutputDoubleRegister(), i.InputOperand(1), 1); 574 __ Pinsrd(i.OutputDoubleRegister(), i.InputOperand(1), 1);
551 break; 575 break;
552 case kSSEFloat64LoadLowWord32: 576 case kSSEFloat64LoadLowWord32:
553 __ movd(i.OutputDoubleRegister(), i.InputOperand(0)); 577 __ movd(i.OutputDoubleRegister(), i.InputOperand(0));
554 break; 578 break;
579 case kAVXFloat32Add: {
580 CpuFeatureScope avx_scope(masm(), AVX);
581 __ vaddss(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
582 i.InputOperand(1));
583 break;
584 }
585 case kAVXFloat32Sub: {
586 CpuFeatureScope avx_scope(masm(), AVX);
587 __ vsubss(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
588 i.InputOperand(1));
589 break;
590 }
591 case kAVXFloat32Mul: {
592 CpuFeatureScope avx_scope(masm(), AVX);
593 __ vmulss(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
594 i.InputOperand(1));
595 break;
596 }
597 case kAVXFloat32Div: {
598 CpuFeatureScope avx_scope(masm(), AVX);
599 __ vdivss(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
600 i.InputOperand(1));
601 break;
602 }
603 case kAVXFloat32Max: {
604 CpuFeatureScope avx_scope(masm(), AVX);
605 __ vmaxss(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
606 i.InputOperand(1));
607 break;
608 }
609 case kAVXFloat32Min: {
610 CpuFeatureScope avx_scope(masm(), AVX);
611 __ vminss(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
612 i.InputOperand(1));
613 break;
614 }
555 case kAVXFloat64Add: { 615 case kAVXFloat64Add: {
556 CpuFeatureScope avx_scope(masm(), AVX); 616 CpuFeatureScope avx_scope(masm(), AVX);
557 __ vaddsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 617 __ vaddsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
558 i.InputOperand(1)); 618 i.InputOperand(1));
559 break; 619 break;
560 } 620 }
561 case kAVXFloat64Sub: { 621 case kAVXFloat64Sub: {
562 CpuFeatureScope avx_scope(masm(), AVX); 622 CpuFeatureScope avx_scope(masm(), AVX);
563 __ vsubsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 623 __ vsubsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
564 i.InputOperand(1)); 624 i.InputOperand(1));
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 case kCheckedStoreFloat64: 800 case kCheckedStoreFloat64:
741 ASSEMBLE_CHECKED_STORE_FLOAT(movsd); 801 ASSEMBLE_CHECKED_STORE_FLOAT(movsd);
742 break; 802 break;
743 case kIA32StackCheck: { 803 case kIA32StackCheck: {
744 ExternalReference const stack_limit = 804 ExternalReference const stack_limit =
745 ExternalReference::address_of_stack_limit(isolate()); 805 ExternalReference::address_of_stack_limit(isolate());
746 __ cmp(esp, Operand::StaticVariable(stack_limit)); 806 __ cmp(esp, Operand::StaticVariable(stack_limit));
747 break; 807 break;
748 } 808 }
749 } 809 }
750 } 810 } // NOLINT(readability/fn_size)
751 811
752 812
753 // Assembles a branch after an instruction. 813 // Assembles a branch after an instruction.
754 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { 814 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
755 IA32OperandConverter i(this, instr); 815 IA32OperandConverter i(this, instr);
756 Label::Distance flabel_distance = 816 Label::Distance flabel_distance =
757 branch->fallthru ? Label::kNear : Label::kFar; 817 branch->fallthru ? Label::kNear : Label::kFar;
758 Label* tlabel = branch->true_label; 818 Label* tlabel = branch->true_label;
759 Label* flabel = branch->false_label; 819 Label* flabel = branch->false_label;
760 switch (branch->condition) { 820 switch (branch->condition) {
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 } 1392 }
1333 } 1393 }
1334 MarkLazyDeoptSite(); 1394 MarkLazyDeoptSite();
1335 } 1395 }
1336 1396
1337 #undef __ 1397 #undef __
1338 1398
1339 } // namespace compiler 1399 } // namespace compiler
1340 } // namespace internal 1400 } // namespace internal
1341 } // namespace v8 1401 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698