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

Side by Side Diff: src/mips/macro-assembler-mips.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
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/macro-assembler-mips64.h » ('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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
11 #include "src/bootstrapper.h" 11 #include "src/bootstrapper.h"
12 #include "src/codegen.h" 12 #include "src/codegen.h"
13 #include "src/debug/debug.h" 13 #include "src/debug/debug.h"
14 #include "src/mips/macro-assembler-mips.h" 14 #include "src/mips/macro-assembler-mips.h"
15 #include "src/register-configuration.h" 15 #include "src/register-configuration.h"
16 #include "src/runtime/runtime.h" 16 #include "src/runtime/runtime.h"
17 17
18 namespace v8 { 18 namespace v8 {
19 namespace internal { 19 namespace internal {
20 20
21 // Floating point constants.
22 const uint32_t kDoubleExponentShift = HeapNumber::kExponentShift;
23 const uint32_t kDoubleNaNShift = kDoubleExponentShift - 1;
24 const uint32_t kDoubleNaNMask =
25 HeapNumber::kExponentMask | (1 << kDoubleNaNShift);
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
21 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, 32 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size,
22 CodeObjectRequired create_code_object) 33 CodeObjectRequired create_code_object)
23 : Assembler(arg_isolate, buffer, size), 34 : Assembler(arg_isolate, buffer, size),
24 generating_stub_(false), 35 generating_stub_(false),
25 has_frame_(false), 36 has_frame_(false),
26 has_double_zero_reg_set_(false) { 37 has_double_zero_reg_set_(false) {
27 if (create_code_object == CodeObjectRequired::kYes) { 38 if (create_code_object == CodeObjectRequired::kYes) {
28 code_object_ = 39 code_object_ =
29 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); 40 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate());
30 } 41 }
(...skipping 4677 matching lines...) Expand 10 before | Expand all | Expand 10 after
4708 // scratch1 is now effective address of the double element 4719 // scratch1 is now effective address of the double element
4709 4720
4710 Register untagged_value = scratch2; 4721 Register untagged_value = scratch2;
4711 SmiUntag(untagged_value, value_reg); 4722 SmiUntag(untagged_value, value_reg);
4712 mtc1(untagged_value, f2); 4723 mtc1(untagged_value, f2);
4713 cvt_d_w(f0, f2); 4724 cvt_d_w(f0, f2);
4714 sdc1(f0, MemOperand(scratch1, 0)); 4725 sdc1(f0, MemOperand(scratch1, 0));
4715 bind(&done); 4726 bind(&done);
4716 } 4727 }
4717 4728
4729 void MacroAssembler::SubNanPreservePayloadAndSign_s(FloatRegister fd,
4730 FloatRegister fs,
4731 FloatRegister ft) {
4732 FloatRegister dest = fd.is(fs) || fd.is(ft) ? kLithiumScratchDouble : fd;
4733 Label check_nan, save_payload, done;
4734 Register scratch1 = t8;
4735 Register scratch2 = t9;
4736
4737 sub_s(dest, fs, ft);
4738 // Check if the result of subtraction is NaN.
4739 BranchF32(nullptr, &check_nan, eq, fs, ft);
4740 Branch(USE_DELAY_SLOT, &done);
4741 dest.is(fd) ? nop() : mov_s(fd, dest);
4742
4743 bind(&check_nan);
4744 // Check if first operand is a NaN.
4745 mfc1(scratch1, fs);
4746 BranchF32(nullptr, &save_payload, eq, fs, fs);
4747 // Second operand must be a NaN.
4748 mfc1(scratch1, ft);
4749
4750 bind(&save_payload);
4751 // Reserve payload.
4752 And(scratch1, scratch1, Operand((1 << kSingleNaNShift) - 1));
4753 mfc1(scratch2, dest);
4754 And(scratch2, scratch2, Operand(kSingleNaNMask));
Marija Antic 2016/06/16 11:25:26 This will set the sign bit to 0 (ci20 board was ch
balazs.kilvady 2016/06/16 12:00:03 Yes. The test expects + quiet NaN with payload (In
4755 Or(scratch2, scratch2, scratch1);
4756 mtc1(scratch2, fd);
4757
4758 bind(&done);
4759 }
4760
4761 void MacroAssembler::SubNanPreservePayloadAndSign_d(DoubleRegister fd,
4762 DoubleRegister fs,
4763 DoubleRegister ft) {
4764 FloatRegister dest = fd.is(fs) || fd.is(ft) ? kLithiumScratchDouble : fd;
4765 Label check_nan, save_payload, done;
4766 Register scratch1 = t8;
4767 Register scratch2 = t9;
4768
4769 sub_d(dest, fs, ft);
4770 // Check if the result of subtraction is NaN.
4771 BranchF64(nullptr, &check_nan, eq, fs, ft);
4772 Branch(USE_DELAY_SLOT, &done);
4773 dest.is(fd) ? nop() : mov_d(fd, dest);
4774
4775 bind(&check_nan);
4776 // Check if first operand is a NaN.
4777 Mfhc1(scratch1, fs);
4778 mov_s(dest, fs);
4779 BranchF64(nullptr, &save_payload, eq, fs, fs);
4780 // Second operand must be a NaN.
4781 Mfhc1(scratch1, ft);
4782 mov_s(dest, ft);
4783
4784 bind(&save_payload);
4785 // Reserve payload.
4786 And(scratch1, scratch1, Operand((1 << (kDoubleNaNShift)) - 1));
4787 Mfhc1(scratch2, dest);
4788 And(scratch2, scratch2, Operand(kDoubleNaNMask));
4789 Or(scratch2, scratch2, scratch1);
4790 Move_s(fd, dest);
4791 Mthc1(scratch2, fd);
4792
4793 bind(&done);
4794 }
4718 4795
4719 void MacroAssembler::CompareMapAndBranch(Register obj, 4796 void MacroAssembler::CompareMapAndBranch(Register obj,
4720 Register scratch, 4797 Register scratch,
4721 Handle<Map> map, 4798 Handle<Map> map,
4722 Label* early_success, 4799 Label* early_success,
4723 Condition cond, 4800 Condition cond,
4724 Label* branch_to) { 4801 Label* branch_to) {
4725 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); 4802 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
4726 CompareMapAndBranch(scratch, map, early_success, cond, branch_to); 4803 CompareMapAndBranch(scratch, map, early_success, cond, branch_to);
4727 } 4804 }
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
6795 if (mag.shift > 0) sra(result, result, mag.shift); 6872 if (mag.shift > 0) sra(result, result, mag.shift);
6796 srl(at, dividend, 31); 6873 srl(at, dividend, 31);
6797 Addu(result, result, Operand(at)); 6874 Addu(result, result, Operand(at));
6798 } 6875 }
6799 6876
6800 6877
6801 } // namespace internal 6878 } // namespace internal
6802 } // namespace v8 6879 } // namespace v8
6803 6880
6804 #endif // V8_TARGET_ARCH_MIPS 6881 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698