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

Side by Side Diff: src/mips64/macro-assembler-mips64.cc

Issue 2066483008: MIPS: Followup '[turbofan] Introduce new operators Float32SubPreserveNan and Float64SubPreserveNan'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove 'make quiet' blocks. 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
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"
11 #include "src/codegen.h" 11 #include "src/codegen.h"
12 #include "src/debug/debug.h" 12 #include "src/debug/debug.h"
13 #include "src/mips64/macro-assembler-mips64.h" 13 #include "src/mips64/macro-assembler-mips64.h"
14 #include "src/register-configuration.h" 14 #include "src/register-configuration.h"
15 #include "src/runtime/runtime.h" 15 #include "src/runtime/runtime.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
20 // Floating point constants.
21 const uint32_t kDoubleExponentShift = HeapNumber::kMantissaBits;
22 const uint32_t kDoubleNaNShift = kDoubleExponentShift - 1;
23 const uint64_t kDoubleNaNMask =
24 (HeapNumber::kExponentMask | (1L << (HeapNumber::kExponentShift - 1)))
25 << 32;
26
27 const uint32_t kSingleExponentMask = kBinary32ExponentMask;
28 const uint32_t kSingleExponentShift = kBinary32ExponentShift;
29 const uint32_t kSingleNaNShift = kSingleExponentShift - 1;
30 const uint32_t kSingleNaNMask = kSingleExponentMask | (1 << kSingleNaNShift);
31
20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, 32 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size,
21 CodeObjectRequired create_code_object) 33 CodeObjectRequired create_code_object)
22 : Assembler(arg_isolate, buffer, size), 34 : Assembler(arg_isolate, buffer, size),
23 generating_stub_(false), 35 generating_stub_(false),
24 has_frame_(false), 36 has_frame_(false),
25 has_double_zero_reg_set_(false) { 37 has_double_zero_reg_set_(false) {
26 if (create_code_object == CodeObjectRequired::kYes) { 38 if (create_code_object == CodeObjectRequired::kYes) {
27 code_object_ = 39 code_object_ =
28 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); 40 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate());
29 } 41 }
(...skipping 4817 matching lines...) Expand 10 before | Expand all | Expand 10 after
4847 bind(&done); 4859 bind(&done);
4848 Daddu(scratch1, elements_reg, 4860 Daddu(scratch1, elements_reg,
4849 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - 4861 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag -
4850 elements_offset)); 4862 elements_offset));
4851 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2); 4863 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2);
4852 Daddu(scratch1, scratch1, scratch2); 4864 Daddu(scratch1, scratch1, scratch2);
4853 // scratch1 is now effective address of the double element. 4865 // scratch1 is now effective address of the double element.
4854 sdc1(double_result, MemOperand(scratch1, 0)); 4866 sdc1(double_result, MemOperand(scratch1, 0));
4855 } 4867 }
4856 4868
4869 void MacroAssembler::SubNanPreservePayloadAndSign_s(FPURegister fd,
4870 FPURegister fs,
4871 FPURegister ft) {
4872 FloatRegister dest = fd.is(fs) || fd.is(ft) ? kLithiumScratchDouble : fd;
4873 Label check_nan, save_payload, done;
4874 Register scratch1 = t8;
4875 Register scratch2 = t9;
4876
4877 sub_s(dest, fs, ft);
4878 // Check if the result of subtraction is NaN.
4879 BranchF32(nullptr, &check_nan, eq, fs, ft);
4880 Branch(USE_DELAY_SLOT, &done);
4881 dest.is(fd) ? nop() : mov_s(fd, dest);
4882
4883 bind(&check_nan);
4884 // Check if first operand is a NaN.
4885 mfc1(scratch1, fs);
4886 BranchF32(nullptr, &save_payload, eq, fs, fs);
4887 // Second operand must be a NaN.
4888 mfc1(scratch1, ft);
4889
4890 bind(&save_payload);
4891 // Reserve payload.
4892 And(scratch1, scratch1, Operand((1 << kSingleNaNShift) - 1));
4893 mfc1(scratch2, dest);
4894 And(scratch2, scratch2, Operand(kSingleNaNMask));
4895 Or(scratch2, scratch2, scratch1);
4896 mtc1(scratch2, fd);
4897
4898 bind(&done);
4899 }
4900
4901 void MacroAssembler::SubNanPreservePayloadAndSign_d(FPURegister fd,
4902 FPURegister fs,
4903 FPURegister ft) {
4904 FloatRegister dest = fd.is(fs) || fd.is(ft) ? kLithiumScratchDouble : fd;
4905 Label check_nan, save_payload, done;
4906 Register scratch1 = t8;
4907 Register scratch2 = t9;
4908
4909 sub_d(dest, fs, ft);
4910 // Check if the result of subtraction is NaN.
4911 BranchF64(nullptr, &check_nan, eq, fs, ft);
4912 Branch(USE_DELAY_SLOT, &done);
4913 dest.is(fd) ? nop() : mov_d(fd, dest);
4914
4915 bind(&check_nan);
4916 // Check if first operand is a NaN.
4917 dmfc1(scratch1, fs);
4918 BranchF64(nullptr, &save_payload, eq, fs, fs);
4919 // Second operand must be a NaN.
4920 dmfc1(scratch1, ft);
4921
4922 bind(&save_payload);
4923 // Reserve payload.
4924 li(at, Operand(1L << kDoubleNaNShift));
4925 Dsubu(at, at, Operand(1));
4926 And(scratch1, scratch1, at);
4927 dmfc1(scratch2, dest);
4928 And(scratch2, scratch2, Operand(kDoubleNaNMask));
4929 Or(scratch2, scratch2, scratch1);
4930 dmtc1(scratch2, fd);
4931
4932 bind(&done);
4933 }
4857 4934
4858 void MacroAssembler::CompareMapAndBranch(Register obj, 4935 void MacroAssembler::CompareMapAndBranch(Register obj,
4859 Register scratch, 4936 Register scratch,
4860 Handle<Map> map, 4937 Handle<Map> map,
4861 Label* early_success, 4938 Label* early_success,
4862 Condition cond, 4939 Condition cond,
4863 Label* branch_to) { 4940 Label* branch_to) {
4864 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); 4941 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
4865 CompareMapAndBranch(scratch, map, early_success, cond, branch_to); 4942 CompareMapAndBranch(scratch, map, early_success, cond, branch_to);
4866 } 4943 }
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after
7143 if (mag.shift > 0) sra(result, result, mag.shift); 7220 if (mag.shift > 0) sra(result, result, mag.shift);
7144 srl(at, dividend, 31); 7221 srl(at, dividend, 31);
7145 Addu(result, result, Operand(at)); 7222 Addu(result, result, Operand(at));
7146 } 7223 }
7147 7224
7148 7225
7149 } // namespace internal 7226 } // namespace internal
7150 } // namespace v8 7227 } // namespace v8
7151 7228
7152 #endif // V8_TARGET_ARCH_MIPS64 7229 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698