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

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

Issue 1419753008: MIPS: [turbofan] Properly implement Float64/32 Min/Max instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove redundant functions. Created 5 years, 1 month 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 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/osr.h" 9 #include "src/compiler/osr.h"
10 #include "src/mips/macro-assembler-mips.h" 10 #include "src/mips/macro-assembler-mips.h"
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 break; 779 break;
780 } 780 }
781 case kMips64Float64RoundTruncate: { 781 case kMips64Float64RoundTruncate: {
782 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(trunc_l_d, Truncate); 782 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(trunc_l_d, Truncate);
783 break; 783 break;
784 } 784 }
785 case kMips64Float64RoundUp: { 785 case kMips64Float64RoundUp: {
786 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(ceil_l_d, Ceil); 786 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(ceil_l_d, Ceil);
787 break; 787 break;
788 } 788 }
789 case kMips64Float64Max: {
790 // (b < a) ? a : b
791 if (kArchVariant == kMips64r6) {
792 __ cmp_d(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(1),
793 i.InputDoubleRegister(0));
794 __ sel_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1),
795 i.InputDoubleRegister(0));
796 } else {
797 __ c_d(OLT, i.InputDoubleRegister(0), i.InputDoubleRegister(1));
798 // Left operand is result, passthrough if false.
799 __ movt_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
800 }
801 break;
802 }
803 case kMips64Float64Min: {
804 // (a < b) ? a : b
805 if (kArchVariant == kMips64r6) {
806 __ cmp_d(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(0),
807 i.InputDoubleRegister(1));
808 __ sel_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1),
809 i.InputDoubleRegister(0));
810 } else {
811 __ c_d(OLT, i.InputDoubleRegister(1), i.InputDoubleRegister(0));
812 // Right operand is result, passthrough if false.
813 __ movt_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
814 }
815 break;
816 }
817 case kMips64Float32Max: {
818 // (b < a) ? a : b
819 if (kArchVariant == kMips64r6) {
820 __ cmp_s(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(1),
821 i.InputDoubleRegister(0));
822 __ sel_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1),
823 i.InputDoubleRegister(0));
824 } else {
825 __ c_s(OLT, i.InputDoubleRegister(0), i.InputDoubleRegister(1));
826 // Left operand is result, passthrough if false.
827 __ movt_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
828 }
829 break;
830 }
831 case kMips64Float32Min: {
832 // (a < b) ? a : b
833 if (kArchVariant == kMips64r6) {
834 __ cmp_s(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(0),
835 i.InputDoubleRegister(1));
836 __ sel_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1),
837 i.InputDoubleRegister(0));
838 } else {
839 __ c_s(OLT, i.InputDoubleRegister(1), i.InputDoubleRegister(0));
840 // Right operand is result, passthrough if false.
841 __ movt_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
842 }
843 break;
844 }
789 case kMips64CvtSD: 845 case kMips64CvtSD:
790 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0)); 846 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0));
791 break; 847 break;
792 case kMips64CvtDS: 848 case kMips64CvtDS:
793 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0)); 849 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0));
794 break; 850 break;
795 case kMips64CvtDW: { 851 case kMips64CvtDW: {
796 FPURegister scratch = kScratchDoubleReg; 852 FPURegister scratch = kScratchDoubleReg;
797 __ mtc1(i.InputRegister(0), scratch); 853 __ mtc1(i.InputRegister(0), scratch);
798 __ cvt_d_w(i.OutputDoubleRegister(), scratch); 854 __ cvt_d_w(i.OutputDoubleRegister(), scratch);
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 padding_size -= v8::internal::Assembler::kInstrSize; 1598 padding_size -= v8::internal::Assembler::kInstrSize;
1543 } 1599 }
1544 } 1600 }
1545 } 1601 }
1546 1602
1547 #undef __ 1603 #undef __
1548 1604
1549 } // namespace compiler 1605 } // namespace compiler
1550 } // namespace internal 1606 } // namespace internal
1551 } // namespace v8 1607 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | src/compiler/mips64/instruction-codes-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698