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

Side by Side Diff: src/compiler/arm64/code-generator-arm64.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 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/arm64/macro-assembler-arm64.h" 7 #include "src/arm64/macro-assembler-arm64.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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 break; 637 break;
638 case kArm64Cmn32: 638 case kArm64Cmn32:
639 __ Cmn(i.InputRegister32(0), i.InputOperand32(1)); 639 __ Cmn(i.InputRegister32(0), i.InputOperand32(1));
640 break; 640 break;
641 case kArm64Tst: 641 case kArm64Tst:
642 __ Tst(i.InputRegister(0), i.InputOperand(1)); 642 __ Tst(i.InputRegister(0), i.InputOperand(1));
643 break; 643 break;
644 case kArm64Tst32: 644 case kArm64Tst32:
645 __ Tst(i.InputRegister32(0), i.InputOperand32(1)); 645 __ Tst(i.InputRegister32(0), i.InputOperand32(1));
646 break; 646 break;
647 case kArm64Float32Cmp:
648 if (instr->InputAt(1)->IsDoubleRegister()) {
649 __ Fcmp(i.InputFloat32Register(0), i.InputFloat32Register(1));
650 } else {
651 DCHECK(instr->InputAt(1)->IsImmediate());
652 // 0.0 is the only immediate supported by fcmp instructions.
653 DCHECK(i.InputDouble(1) == 0.0);
654 __ Fcmp(i.InputFloat32Register(0), i.InputDouble(1));
655 }
656 break;
657 case kArm64Float32Add:
658 __ Fadd(i.OutputFloat32Register(), i.InputFloat32Register(0),
659 i.InputFloat32Register(1));
660 break;
661 case kArm64Float32Sub:
662 __ Fsub(i.OutputFloat32Register(), i.InputFloat32Register(0),
663 i.InputFloat32Register(1));
664 break;
665 case kArm64Float32Mul:
666 __ Fmul(i.OutputFloat32Register(), i.InputFloat32Register(0),
667 i.InputFloat32Register(1));
668 break;
669 case kArm64Float32Div:
670 __ Fdiv(i.OutputFloat32Register(), i.InputFloat32Register(0),
671 i.InputFloat32Register(1));
672 break;
673 case kArm64Float32Max:
674 __ Fmax(i.OutputFloat32Register(), i.InputFloat32Register(0),
675 i.InputFloat32Register(1));
676 break;
677 case kArm64Float32Min:
678 __ Fmin(i.OutputFloat32Register(), i.InputFloat32Register(0),
679 i.InputFloat32Register(1));
680 break;
681 case kArm64Float32Sqrt:
682 __ Fsqrt(i.OutputFloat32Register(), i.InputFloat32Register(0));
683 break;
647 case kArm64Float64Cmp: 684 case kArm64Float64Cmp:
648 if (instr->InputAt(1)->IsDoubleRegister()) { 685 if (instr->InputAt(1)->IsDoubleRegister()) {
649 __ Fcmp(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 686 __ Fcmp(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
650 } else { 687 } else {
651 DCHECK(instr->InputAt(1)->IsImmediate()); 688 DCHECK(instr->InputAt(1)->IsImmediate());
652 // 0.0 is the only immediate supported by fcmp instructions. 689 // 0.0 is the only immediate supported by fcmp instructions.
653 DCHECK(i.InputDouble(1) == 0.0); 690 DCHECK(i.InputDouble(1) == 0.0);
654 __ Fcmp(i.InputDoubleRegister(0), i.InputDouble(1)); 691 __ Fcmp(i.InputDoubleRegister(0), i.InputDouble(1));
655 } 692 }
656 break; 693 break;
(...skipping 17 matching lines...) Expand all
674 // TODO(dcarney): implement directly. See note in lithium-codegen-arm64.cc 711 // TODO(dcarney): implement directly. See note in lithium-codegen-arm64.cc
675 FrameScope scope(masm(), StackFrame::MANUAL); 712 FrameScope scope(masm(), StackFrame::MANUAL);
676 DCHECK(d0.is(i.InputDoubleRegister(0))); 713 DCHECK(d0.is(i.InputDoubleRegister(0)));
677 DCHECK(d1.is(i.InputDoubleRegister(1))); 714 DCHECK(d1.is(i.InputDoubleRegister(1)));
678 DCHECK(d0.is(i.OutputDoubleRegister())); 715 DCHECK(d0.is(i.OutputDoubleRegister()));
679 // TODO(dcarney): make sure this saves all relevant registers. 716 // TODO(dcarney): make sure this saves all relevant registers.
680 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), 717 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()),
681 0, 2); 718 0, 2);
682 break; 719 break;
683 } 720 }
721 case kArm64Float64Max:
722 __ Fmax(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
723 i.InputDoubleRegister(1));
724 break;
725 case kArm64Float64Min:
726 __ Fmin(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
727 i.InputDoubleRegister(1));
728 break;
684 case kArm64Float64Sqrt: 729 case kArm64Float64Sqrt:
685 __ Fsqrt(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 730 __ Fsqrt(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
686 break; 731 break;
687 case kArm64Float32ToFloat64: 732 case kArm64Float32ToFloat64:
688 __ Fcvt(i.OutputDoubleRegister(), i.InputDoubleRegister(0).S()); 733 __ Fcvt(i.OutputDoubleRegister(), i.InputDoubleRegister(0).S());
689 break; 734 break;
690 case kArm64Float64ToFloat32: 735 case kArm64Float64ToFloat32:
691 __ Fcvt(i.OutputDoubleRegister().S(), i.InputDoubleRegister(0)); 736 __ Fcvt(i.OutputDoubleRegister().S(), i.InputDoubleRegister(0));
692 break; 737 break;
693 case kArm64Float64ToInt32: 738 case kArm64Float64ToInt32:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 Register tmp = scope.AcquireX(); 770 Register tmp = scope.AcquireX();
726 __ Fmov(tmp.W(), i.InputFloat32Register(0)); 771 __ Fmov(tmp.W(), i.InputFloat32Register(0));
727 __ Bfi(tmp, i.InputRegister(1), 32, 32); 772 __ Bfi(tmp, i.InputRegister(1), 32, 32);
728 __ Fmov(i.OutputFloat64Register(), tmp); 773 __ Fmov(i.OutputFloat64Register(), tmp);
729 break; 774 break;
730 } 775 }
731 case kArm64Float64MoveU64: { 776 case kArm64Float64MoveU64: {
732 __ Fmov(i.OutputFloat64Register(), i.InputRegister(0)); 777 __ Fmov(i.OutputFloat64Register(), i.InputRegister(0));
733 break; 778 break;
734 } 779 }
735 case kArm64Float64Max:
736 __ Fmax(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
737 i.InputDoubleRegister(1));
738 break;
739 case kArm64Float64Min:
740 __ Fmin(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
741 i.InputDoubleRegister(1));
742 break;
743 case kArm64Ldrb: 780 case kArm64Ldrb:
744 __ Ldrb(i.OutputRegister(), i.MemoryOperand()); 781 __ Ldrb(i.OutputRegister(), i.MemoryOperand());
745 break; 782 break;
746 case kArm64Ldrsb: 783 case kArm64Ldrsb:
747 __ Ldrsb(i.OutputRegister(), i.MemoryOperand()); 784 __ Ldrsb(i.OutputRegister(), i.MemoryOperand());
748 break; 785 break;
749 case kArm64Strb: 786 case kArm64Strb:
750 __ Strb(i.InputRegister(2), i.MemoryOperand()); 787 __ Strb(i.InputRegister(2), i.MemoryOperand());
751 break; 788 break;
752 case kArm64Ldrh: 789 case kArm64Ldrh:
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 } 1248 }
1212 } 1249 }
1213 MarkLazyDeoptSite(); 1250 MarkLazyDeoptSite();
1214 } 1251 }
1215 1252
1216 #undef __ 1253 #undef __
1217 1254
1218 } // namespace compiler 1255 } // namespace compiler
1219 } // namespace internal 1256 } // namespace internal
1220 } // namespace v8 1257 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698