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/mips64/macro-assembler-mips64.cc

Issue 2019693002: MIPS: Fix '[turbofan] Introduce new operators Float32SubPreserveNan and Float64SubPreserveNan'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix instruction selector mips64. Created 4 years, 6 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/mips64/macro-assembler-mips64.h ('k') | src/wasm/wasm-interpreter.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/base/division-by-constant.h" 9 #include "src/base/division-by-constant.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4836 matching lines...) Expand 10 before | Expand all | Expand 10 after
4847 bind(&done); 4847 bind(&done);
4848 Daddu(scratch1, elements_reg, 4848 Daddu(scratch1, elements_reg,
4849 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - 4849 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag -
4850 elements_offset)); 4850 elements_offset));
4851 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2); 4851 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2);
4852 Daddu(scratch1, scratch1, scratch2); 4852 Daddu(scratch1, scratch1, scratch2);
4853 // scratch1 is now effective address of the double element. 4853 // scratch1 is now effective address of the double element.
4854 sdc1(double_result, MemOperand(scratch1, 0)); 4854 sdc1(double_result, MemOperand(scratch1, 0));
4855 } 4855 }
4856 4856
4857 void MacroAssembler::SubNanPreservePayloadAndSign_s(FPURegister fd,
4858 FPURegister fs,
4859 FPURegister ft) {
4860 Label maybe_nan, nan2008, not_nan2008, done;
4861 Register scratch1 = t8;
4862 Register scratch2 = t9;
4863 DoubleRegister double_scratch = f8;
4864
4865 sub_s(fd, fs, ft);
4866 // Check if the result of subtraction is NaN or infinity.
4867 sub_s(double_scratch, fd, fd);
4868 BranchF32(&done, nullptr, eq, double_scratch, kDoubleRegZero);
4869
4870 // Check if first operand is a possible NaN.
4871 dmfc1(scratch1, fs);
4872 And(scratch2, scratch1, Operand(FloatConstants::kExponentMask));
4873 Branch(&maybe_nan, eq, scratch2, Operand(FloatConstants::kExponentMask));
4874 // Check if second operand is a possible NaN.
4875 dmfc1(scratch1, ft);
4876 And(scratch2, scratch1, Operand(FloatConstants::kExponentMask));
4877 Branch(&done, ne, scratch2, Operand(FloatConstants::kExponentMask));
4878
4879 // Check if possible NaN is actually NaN.
4880 bind(&maybe_nan);
4881 And(scratch2, scratch1, Operand(FloatConstants::kMantissaMask));
4882 Branch(&done, eq, scratch2, Operand(zero_reg));
4883 // If NaN is found, return it as qNaN with same payload.
4884 // Determine the qNaN encoding for the current architecture.
4885 LoadRoot(scratch2, Heap::kNanValueRootIndex);
4886 ldc1(double_scratch, FieldMemOperand(scratch2, HeapNumber::kValueOffset));
4887 dmfc1(scratch2, double_scratch);
4888 And(scratch2, scratch2, Operand(DoubleConstants::kNanTypeMask));
4889 // Make NaN quiet.
4890 Branch(&nan2008, gt, scratch2, Operand(zero_reg));
4891 And(scratch1, scratch1, Operand(~FloatConstants::kNanTypeMask));
4892 Branch(&not_nan2008);
4893 bind(&nan2008);
4894 Or(scratch1, scratch1, Operand(FloatConstants::kNanTypeMask));
4895 bind(&not_nan2008);
4896 dmtc1(scratch1, fd);
4897 bind(&done);
4898 }
4899
4900 void MacroAssembler::SubNanPreservePayloadAndSign_d(FPURegister fd,
4901 FPURegister fs,
4902 FPURegister ft) {
4903 Label maybe_nan, nan2008, not_nan2008, done;
4904 Register scratch1 = t8;
4905 Register scratch2 = t9;
4906 DoubleRegister double_scratch = f8;
4907
4908 sub_d(fd, fs, ft);
4909 // Check if the result of subtraction is NaN or infinity.
4910 sub_d(double_scratch, fd, fd);
4911 BranchF64(&done, nullptr, eq, double_scratch, kDoubleRegZero);
4912
4913 // Check if first operand is a possible NaN.
4914 dmfc1(scratch1, fs);
4915 And(scratch2, scratch1, Operand(DoubleConstants::kExponentMask));
4916 Branch(&maybe_nan, eq, scratch2, Operand(DoubleConstants::kExponentMask));
4917 // Check if second operand is a possible NaN.
4918 dmfc1(scratch1, ft);
4919 And(scratch2, scratch1, Operand(DoubleConstants::kExponentMask));
4920 Branch(&done, ne, scratch2, Operand(DoubleConstants::kExponentMask));
4921
4922 // Check if possible NaN is actually NaN.
4923 bind(&maybe_nan);
4924 And(scratch2, scratch1, Operand(DoubleConstants::kMantissaMask));
4925 Branch(&done, eq, scratch2, Operand(zero_reg));
4926 // If NaN is found, return it as qNaN with same payload.
4927 // Determine the qNaN encoding for the current architecture.
4928 LoadRoot(scratch2, Heap::kNanValueRootIndex);
4929 ldc1(double_scratch, FieldMemOperand(scratch2, HeapNumber::kValueOffset));
4930 dmfc1(scratch2, double_scratch);
4931 And(scratch2, scratch2, Operand(DoubleConstants::kNanTypeMask));
4932 // Make NaN quiet.
4933 Branch(&nan2008, gt, scratch2, Operand(zero_reg));
4934 And(scratch1, scratch1, Operand(~DoubleConstants::kNanTypeMask));
4935 Branch(&not_nan2008);
4936 bind(&nan2008);
4937 Or(scratch1, scratch1, Operand(DoubleConstants::kNanTypeMask));
4938 bind(&not_nan2008);
4939 dmtc1(scratch1, fd);
4940 bind(&done);
4941 }
4857 4942
4858 void MacroAssembler::CompareMapAndBranch(Register obj, 4943 void MacroAssembler::CompareMapAndBranch(Register obj,
4859 Register scratch, 4944 Register scratch,
4860 Handle<Map> map, 4945 Handle<Map> map,
4861 Label* early_success, 4946 Label* early_success,
4862 Condition cond, 4947 Condition cond,
4863 Label* branch_to) { 4948 Label* branch_to) {
4864 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); 4949 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
4865 CompareMapAndBranch(scratch, map, early_success, cond, branch_to); 4950 CompareMapAndBranch(scratch, map, early_success, cond, branch_to);
4866 } 4951 }
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after
7140 if (mag.shift > 0) sra(result, result, mag.shift); 7225 if (mag.shift > 0) sra(result, result, mag.shift);
7141 srl(at, dividend, 31); 7226 srl(at, dividend, 31);
7142 Addu(result, result, Operand(at)); 7227 Addu(result, result, Operand(at));
7143 } 7228 }
7144 7229
7145 7230
7146 } // namespace internal 7231 } // namespace internal
7147 } // namespace v8 7232 } // namespace v8
7148 7233
7149 #endif // V8_TARGET_ARCH_MIPS64 7234 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | src/wasm/wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698