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

Side by Side Diff: src/builtins/mips64/builtins-mips64.cc

Issue 2534413002: MIPS: Improve Float(32|64)(Max|Min). (Closed)
Patch Set: MIPS: Improve Float(32|64)(Max|Min). Created 4 years 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/builtins/mips/builtins-mips.cc ('k') | src/compiler/mips/code-generator-mips.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 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // ----------------------------------- 132 // -----------------------------------
133 Heap::RootListIndex const root_index = 133 Heap::RootListIndex const root_index =
134 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex 134 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
135 : Heap::kMinusInfinityValueRootIndex; 135 : Heap::kMinusInfinityValueRootIndex;
136 136
137 // Load the accumulator with the default return value (either -Infinity or 137 // Load the accumulator with the default return value (either -Infinity or
138 // +Infinity), with the tagged value in t1 and the double value in f0. 138 // +Infinity), with the tagged value in t1 and the double value in f0.
139 __ LoadRoot(t1, root_index); 139 __ LoadRoot(t1, root_index);
140 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); 140 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset));
141 141
142 Label done_loop, loop; 142 Label done_loop, loop, done;
143 __ mov(a3, a0); 143 __ mov(a3, a0);
144 __ bind(&loop); 144 __ bind(&loop);
145 { 145 {
146 // Check if all parameters done. 146 // Check if all parameters done.
147 __ Dsubu(a3, a3, Operand(1)); 147 __ Dsubu(a3, a3, Operand(1));
148 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); 148 __ Branch(&done_loop, lt, a3, Operand(zero_reg));
149 149
150 // Load the next parameter tagged value into a2. 150 // Load the next parameter tagged value into a2.
151 __ Dlsa(at, sp, a3, kPointerSizeLog2); 151 __ Dlsa(at, sp, a3, kPointerSizeLog2);
152 __ ld(a2, MemOperand(at)); 152 __ ld(a2, MemOperand(at));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset)); 188 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset));
189 __ jmp(&done_convert); 189 __ jmp(&done_convert);
190 __ bind(&convert_smi); 190 __ bind(&convert_smi);
191 __ SmiToDoubleFPURegister(a2, f2, a4); 191 __ SmiToDoubleFPURegister(a2, f2, a4);
192 __ bind(&done_convert); 192 __ bind(&done_convert);
193 193
194 // Perform the actual comparison with using Min/Max macro instructions the 194 // Perform the actual comparison with using Min/Max macro instructions the
195 // accumulator value on the left hand side (f0) and the next parameter value 195 // accumulator value on the left hand side (f0) and the next parameter value
196 // on the right hand side (f2). 196 // on the right hand side (f2).
197 // We need to work out which HeapNumber (or smi) the result came from. 197 // We need to work out which HeapNumber (or smi) the result came from.
198 Label compare_nan; 198 Label compare_nan, ool_min, ool_max;
199 __ BranchF(nullptr, &compare_nan, eq, f0, f2); 199 __ BranchF(nullptr, &compare_nan, eq, f0, f2);
200 __ Move(a4, f0); 200 __ Move(a4, f0);
201 if (kind == MathMaxMinKind::kMin) { 201 if (kind == MathMaxMinKind::kMin) {
202 __ MinNaNCheck_d(f0, f0, f2); 202 __ Float64Min(f0, f0, f2, &ool_min);
203 } else { 203 } else {
204 DCHECK(kind == MathMaxMinKind::kMax); 204 DCHECK(kind == MathMaxMinKind::kMax);
205 __ MaxNaNCheck_d(f0, f0, f2); 205 __ Float64Max(f0, f0, f2, &ool_max);
206 } 206 }
207 __ jmp(&done);
208
209 __ bind(&ool_min);
210 __ Float64MinOutOfLine(f0, f0, f2);
211 __ jmp(&done);
212
213 __ bind(&ool_max);
214 __ Float64MaxOutOfLine(f0, f0, f2);
215
216 __ bind(&done);
207 __ Move(at, f0); 217 __ Move(at, f0);
208 __ Branch(&loop, eq, a4, Operand(at)); 218 __ Branch(&loop, eq, a4, Operand(at));
209 __ mov(t1, a2); 219 __ mov(t1, a2);
210 __ jmp(&loop); 220 __ jmp(&loop);
211 221
212 // At least one side is NaN, which means that the result will be NaN too. 222 // At least one side is NaN, which means that the result will be NaN too.
213 __ bind(&compare_nan); 223 __ bind(&compare_nan);
214 __ LoadRoot(t1, Heap::kNanValueRootIndex); 224 __ LoadRoot(t1, Heap::kNanValueRootIndex);
215 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); 225 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset));
216 __ jmp(&loop); 226 __ jmp(&loop);
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 __ break_(0xCC); 3002 __ break_(0xCC);
2993 } 3003 }
2994 } 3004 }
2995 3005
2996 #undef __ 3006 #undef __
2997 3007
2998 } // namespace internal 3008 } // namespace internal
2999 } // namespace v8 3009 } // namespace v8
3000 3010
3001 #endif // V8_TARGET_ARCH_MIPS64 3011 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/builtins/mips/builtins-mips.cc ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698